vcfinfo | R Documentation |
read a INFO tag in the VCF/BCF into R data structure
vcfinfo(
vcffile,
tag,
region = "",
vartype = "all",
ids = NULL,
qual = 0,
pass = FALSE,
setid = FALSE
)
vcffile |
path to the VCF/BCF file |
tag |
the INFO tag to extract. |
region |
region to subset in bcftools-like style: "chr1", "chr1:1-10000000" |
vartype |
restrict to specific type of variants. supports "snps","indels", "sv", "multisnps","multiallelics" |
ids |
character vector. restrict to sites with ID in the given vector. default NULL won't filter any sites. |
qual |
numeric. restrict to variants with QUAL > qual. |
pass |
logical. restrict to variants with FILTER = "PASS". |
setid |
logical. reset ID column as CHR_POS_REF_ALT. |
vcfinfo
uses the C++ API of vcfpp, which is a wrapper of htslib, to read VCF/BCF files.
Thus, it has the full functionalities of htslib, such as restrict to specific variant types,
samples and regions. For the memory efficiency reason, the vcfinfo
is designed
to parse only one tag at a time in the INFO column of the VCF. Currently it does not support
parsing a vector of values for a given INFO tag.
Return a list containing the following components:
: character vector;
the CHR column in the VCF file
: character vector;
the POS column in the VCF file
: character vector;
the ID column in the VCF file
: character vector;
the REF column in the VCF file
: character vector;
the ALT column in the VCF file
: character vector;
the QUAL column in the VCF file
: character vector;
the FILTER column in the VCF file
: vector of either integer, numberic or character values depending on the tag to extract;
a specifiy tag in the INFO column to be extracted
Zilong Li zilong.dk@gmail.com
library('vcfppR')
vcffile <- system.file("extdata", "raw.gt.vcf.gz", package="vcfppR")
res <- vcfinfo(vcffile, "AF", region = "chr21:1-5050000", vartype = "snps", pass = TRUE)
str(res)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.