Convert a GenomicRanges or a data.frame BED to standard data.table BED

as.bedtorch_table(x, genome = NULL)

Arguments

x

An input. Must be either GenomicRanges or data.frame. If a data.frame, the first three columns should be chrom, start and end. For column names, refer to GenomicRanges::makeGRangesFromDataFrame().

Value

data.table converted from x.

Examples

gr <- read_bed(system.file("extdata", "example_merge.bed", package = "bedtorch"), 
               use_gr = TRUE, genome = "hs37-1kg")
as.bedtorch_table(gr)
#>     chrom start end score
#>  1:    21     3   6     8
#>  2:    21    10  16     5
#>  3:    21    12  17     4
#>  4:    21    15  22     5
#>  5:    21    22  25     7
#>  6:    21    26  30     7
#>  7:    21    29  35     9
#>  8:    21    36  49     1
#>  9:    21    45  50     2
#> 10:    21    53  56     5
#> 11:    22    27  36     3
#> 12:    22    30  33    10
#> 13:    22    36  41     8
#> 14:    22    42  44     9
#> 15:    22    46  50     0
#> 16:    22    51  59     9
#> 17:    22    53  57     5
#> 18:    22    57  65     9
#> 19:    22    62  70     8
#> 20:    22    65  72     2
#> -------
#> genome: hs37-1kg.