query_table: Query a tabix file

View source: R/query_table.R

query_tableR Documentation

Query a tabix file

Description

Query by genomic coordinates.

Usage

query_table(
  target_path,
  target_index = paste0(target_path, ".tbi"),
  query_granges,
  query_method = c("rsamtools", "seqminer", "conda"),
  local = NULL,
  overlapping_only = FALSE,
  query_save = TRUE,
  save_path = tempfile(fileext = "tsv.gz"),
  cleanup_tbi = TRUE,
  conda_env = "echoR_mini",
  nThread = 1,
  verbose = TRUE
)

Arguments

target_path

Path to tabix file.

target_index

Tabix index file for target_path.

query_granges

GRanges object to be used for querying the target_path file. Alternatively, can be variant-level summary statistics to be converted into a GRanges object by construct_query.

query_method

Method used for querying. See query for available options.

local

Whether target_path is stored locally or on a remote server/website. By default (NULL) will infer local status and use the appropriate query_method.

overlapping_only

Remove variants that do not overlap with the positions in query_dat.

query_save

Whether to save the queried data subset.

save_path

File path to save query subset to (as table).

cleanup_tbi

Remove local copies of tabix index file (.tbi) after completing queries.

conda_env

Conda environments to search in. If NULL (default), will search all conda environments.

nThread

Number of threads to use.

verbose

Print messages.

Value

data.table with the queried subset of genomic data.

See Also

Other tabix functions: construct_tabix_path(), construct_vcf_path(), convert(), index, query_vcf(), read_bgz(), run_bgzip()

Examples

query_dat <- echodata::BST1

#### local ####
target_path <- echodata::example_fullSS()
tabix_files <- echotabix::convert(target_path = target_path, 
                                  start_col = "BP")
query_res <- echotabix::query_table(
    target_path = tabix_files$path,
    query_dat = query_dat)

#### remote ####
target_path <- file.path(
    "https://egg2.wustl.edu/roadmap/data/byFileType",
    "chromhmmSegmentations/ChmmModels/coreMarks/jointModel/final",
    "E099_15_coreMarks_dense.bed.bgz"
)
query_res2 <- echotabix::query_table(
    target_path = target_path,
    query_granges = query_dat) 

RajLabMSSM/echotabix documentation built on Nov. 21, 2023, 8:02 a.m.