convert: Convert to tabix

View source: R/convert.R

convertR Documentation

Convert to tabix

Description

Convert a tabular file to compressed (bgzip), indexed, tabix format for rapid querying.

Usage

convert(
  target_path,
  bgz_file = construct_tabix_path(target_path = target_path),
  chrom_col = "CHR",
  start_col = "POS",
  end_col = start_col,
  comment_char = NULL,
  format = NULL,
  convert_methods = list(sort_coordinates = "bash", run_bgzip = "Rsamtools", index =
    "Rsamtools"),
  conda_env = "echoR_mini",
  force_new = TRUE,
  verbose = TRUE
)

Arguments

target_path

Path to full GWAS/QTL summary statistics file.

bgz_file

Path to resulting bgz-compressed file after target_path has been converted to tabix format.

chrom_col

Name of the chromosome column in the target_path file.

start_col

Name of the genomic start position column in the target_path file.

end_col

Name of the genomic end position column in the target_path file.

comment_char

A single character which, when present as the first character in a line, indicates that the line is to be omitted from indexing.

format

Format of the target_path file: "vcf" or "table".

convert_methods

A named list containing methods to run each step with.

conda_env

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

force_new

Force the creation of a new bgzip file (.bgz) and a new tabix index file (.tbi).

verbose

Print messages.

Source

samtools/tabix GitHub repo

Rhtslib (which Rsamtools and seqminer depend on for tabix) is very out of date (1.7 vs. 1.15).

conda install tabix was recently fixed so it installs htslib

See Also

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

Examples

#### Example with full data ####
# tmp <- echodata::example_fullSS()
#### Example with single locus ####
dat <- echodata::BST1
tmp <- tempfile()
data.table::fwrite(dat, tmp, sep="\t")
 
tabix_files <- echotabix::convert(target_path = tmp)

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