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()
#> 130451 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 758 ranges and 6 metadata columns:
#>         seqnames              ranges strand |        name     score signalValue
#>            <Rle>           <IRanges>  <Rle> | <character> <numeric>   <numeric>
#>     [1]     chr1     1309757-1310040      * |        <NA>       628     27.1098
#>     [2]     chr1     1361050-1361333      * |        <NA>       969     46.9058
#>     [3]     chr1     1595600-1595883      * |        <NA>       544     37.8757
#>     [4]     chr1     1596172-1596455      * |        <NA>      1000     60.3260
#>     [5]     chr1     2896839-2897122      * |        <NA>       670     27.9391
#>     ...      ...                 ...    ... .         ...       ...         ...
#>   [754]     chrX 137592599-137592882      * |        <NA>       621     35.1752
#>   [755]     chrX 140723887-140724170      * |        <NA>       570     20.7953
#>   [756]     chrX 140725202-140725485      * |        <NA>       770     39.3965
#>   [757]     chrX 153382538-153382821      * |        <NA>       586     37.2207
#>   [758]     chrY   11327531-11327814      * |        <NA>       768     38.3850
#>            pValue    qValue      peak
#>         <numeric> <numeric> <integer>
#>     [1]        -1  -0.32846       142
#>     [2]        -1  -0.12926       142
#>     [3]        -1  -0.37348       142
#>     [4]        -1   0.33303       142
#>     [5]        -1  -0.34152       142
#>     ...       ...       ...       ...
#>   [754]        -1  -0.39023       142
#>   [755]        -1  -0.18003       142
#>   [756]        -1  -0.33490       142
#>   [757]        -1  -0.37418       142
#>   [758]        -1  -0.36814       142
#>   -------
#>   seqinfo: 711 sequences (1 circular) from hg38 genome