Skip to contents

Query lines from a tabixed bedfile

Usage

tabix(
  bedfile,
  regions,
  aligner = "biscuit",
  colnames = NULL,
  raw = FALSE,
  nthreads = NULL
)

Arguments

bedfile

The bedfile to be queried

regions

A vector of genomic region strings

aligner

The aligner used to produce the BED files - one of "biscuit", "bismark", "bsbolt". Will set the result data.table's column names based on this argument.

colnames

A vector of column names for the result data.table. Set if your bedfile is not from the supported aligners or is a general bedfile.

raw

Set true to give a named list of raw strings from the regions in the style of Rsamtools::scanTabix instead of a data.table

nthreads

Set number of threads to use overriding the "iscream.threads" option. See ?set_threads for more information.

Value

A data.table

Examples

bedfiles <- system.file("extdata", package = "iscream") |>
  list.files(pattern = "[a|b|c|d].bed.gz$", full.names = TRUE)
regions <- c("chr1:1-6", "chr1:7-10", "chr1:11-14")
tabix(bedfiles[1], regions, colnames = c("chr", "start", "end", "beta", "coverage"))
#>       chr start   end  beta coverage
#>    <char> <num> <num> <num>    <num>
#> 1:   chr1     1     2   1.0        1
#> 2:   chr1     3     4   1.0        1
#> 3:   chr1     5     6   0.0        2
#> 4:   chr1     7     8   0.0        1
#> 5:   chr1     9    10   0.5        2
#> 6:   chr1    11    12   1.0        2
#> 7:   chr1    13    14   1.0        3