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()
#> 168208 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 70927 ranges and 5 metadata columns:
#>           seqnames            ranges strand |        name     score signalValue
#>              <Rle>         <IRanges>  <Rle> | <character> <numeric>   <numeric>
#>       [1]     chr1     629140-629310      * |        id-1        73          -1
#>       [2]     chr1     629871-630319      * |        id-2      1000          -1
#>       [3]     chr1     630455-630776      * |        id-3       142          -1
#>       [4]     chr1     631356-631894      * |        id-4        99          -1
#>       [5]     chr1     632296-632511      * |        id-5        76          -1
#>       ...      ...               ...    ... .         ...       ...         ...
#>   [70923]     chrY 21369025-21369109      * |    id-70923        16          -1
#>   [70924]     chrY 26670426-26670581      * |    id-70924        22          -1
#>   [70925]     chrY 26670669-26671652      * |    id-70925        67          -1
#>   [70926]     chrY 56721700-56721802      * |    id-70926        21          -1
#>   [70927]     chrY 56734849-56734902      * |    id-70927      1000          -1
#>              pValue    qValue
#>           <numeric> <numeric>
#>       [1]        -1   7.27765
#>       [2]        -1 100.00000
#>       [3]        -1  14.18620
#>       [4]        -1   9.94867
#>       [5]        -1   7.59817
#>       ...       ...       ...
#>   [70923]        -1   1.58040
#>   [70924]        -1   2.24428
#>   [70925]        -1   6.67810
#>   [70926]        -1   2.13412
#>   [70927]        -1 100.00000
#>   -------
#>   seqinfo: 711 sequences (1 circular) from hg38 genome