Create a GRanges object given a BED id. Columns and types are generated for broad and narrow peak files. Known columns and types can be passed as a named vector through extra_cols. Otherwise, bb_to_granges() attempts to determine the column type and substitute dummy column names.

bb_to_granges(bedbase, bed_id, extra_cols = NULL, quietly = TRUE)

Arguments

bedbase

BEDbase() object

bed_id

integer(1) BED record identifier

extra_cols

character() (default NULL) extra column names to construct GRanges objects

quietly

logical(1) (default TRUE) display messages

Value

GRanges

Examples

bedbase <- BEDbase()
#> 128999 BED files available.
ex_bed <- bb_example(bedbase, "bed")
bb_to_granges(bedbase, ex_bed$id)
#> 'getOption("repos")' replaces Bioconductor standard repositories, see
#> 'help("repositories", package = "BiocManager")' for details.
#> Replacement repositories:
#>     CRAN: https://p3m.dev/cran/__linux__/noble/latest
#> GRanges object with 41694 ranges and 6 metadata columns:
#>           seqnames              ranges strand |        name     score
#>              <Rle>           <IRanges>  <Rle> | <character> <numeric>
#>       [1]     chr1         86935-87280      * |   Peak_3616       148
#>       [2]     chr1       880351-881297      * |   Peak_3441       149
#>       [3]     chr1       883981-884420      * |  Peak_51321        60
#>       [4]     chr1       897321-897632      * |  Peak_39606        66
#>       [5]     chr1       914015-914745      * | Peak_130636        41
#>       ...      ...                 ...    ... .         ...       ...
#>   [41690]     chrX 153829326-153829847      * |  Peak_33691        71
#>   [41691]     chrX 153831173-153831489      * |  Peak_72205        55
#>   [41692]     chrX 153885158-153885865      * |  Peak_43424        66
#>   [41693]     chrX 154751539-154751827      * |  Peak_13276        95
#>   [41694]     chrX 155863388-155863951      * | Peak_123283        43
#>           signalValue    pValue    qValue      peak
#>             <numeric> <numeric> <numeric> <integer>
#>       [1]     4.12363  14.87206  11.48560       176
#>       [2]     4.57585  14.98495  11.57899       188
#>       [3]     2.89001   6.09145   3.57573       264
#>       [4]     3.01043   6.63229   4.03133       176
#>       [5]     2.40834   4.10604   1.98388       455
#>       ...         ...       ...       ...       ...
#>   [41690]     3.13085   7.18963   4.50966       307
#>   [41691]     2.76960   5.56772   3.14046        51
#>   [41692]     3.01043   6.63229   4.03133       385
#>   [41693]     3.61252   9.57284   6.61083        99
#>   [41694]     2.35793   4.35143   2.19496       203
#>   -------
#>   seqinfo: 711 sequences (1 circular) from hg38 genome