query_vcf_variantannotation: Query VCF: 'VariantAnnotation'

View source: R/query_vcf_variantannotation.R

query_vcf_variantannotationR Documentation

Query VCF: VariantAnnotation

Description

Query a subset of a VCF file (remote or local) using readVcf. Advantages of VariantAnnotation:

  • Is at least as fast as scanTabix.

  • Can query a specific subset of samples, unlike scanTabix which queries all samples at once.

  • Automatically imports query results as a CollapsedVCF object, which contain lots of organized information about the query data and can be further processed using other functions from VariantAnnotation and snpStats. By contrast, scanTabix returns a raw list of strings that must be parsed by the user.

Usage

query_vcf_variantannotation(
  target_path,
  target_index = paste0(target_path, ".tbi"),
  target_genome = NULL,
  query_granges,
  samples = character(),
  verbose = TRUE
)

Arguments

target_path

Path to local VCF file or remote URL.

target_index

Tabix index file for target_path.

target_genome

Genome build of the VCF file.

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.

samples

[Optional] Sample names to subset the VCF by. If this option is used, the GRanges object will be converted to a ScanVcfParam for usage by readVcf.

verbose

Print messages.

Value

CollapsedVCF object.

Source

VariantAnnotation filtering vignette

gwasvcf GitHub repo

BST1 <- echodata::BST1 query_dat <- BST1[seq(1, 50), ] target_path <- paste( "ftp://ftp-trace.ncbi.nih.gov/1000genomes/ftp/release/20110521/", "ALL.chr4.phase1_release_v3.20101123.snps_indels_svs.genotypes.vcf.gz", sep="/" ) vcf <- echotabix:::query_vcf_variantannotation( target_path = target_path, query_granges = query_dat)


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