readVariantInfo-methods | R Documentation |
A fast lightweight function that determines information on
variants ocurring in a VCF file and
returns the result as a VariantInfo
object
## S4 method for signature 'TabixFile,GRanges'
readVariantInfo(file, regions, subset,
noIndels=TRUE, onlyPass=TRUE,
na.limit=1, MAF.limit=1,
na.action=c("impute.major", "omit", "fail"),
MAF.action=c("ignore", "omit","invert", "fail"),
omitZeroMAF=TRUE, refAlt=FALSE, sex=NULL)
## S4 method for signature 'TabixFile,missing'
readVariantInfo(file, regions, ...)
## S4 method for signature 'character,GRanges'
readVariantInfo(file, regions, ...)
## S4 method for signature 'character,missing'
readVariantInfo(file, regions, ...)
file |
a |
regions |
a |
subset |
a numeric vector with indices or a character vector with names of samples to restrict to; if specified, only these samples' genotypes are considered when determining the minor allele frequencies (MAFs) of variants. |
noIndels |
if |
onlyPass |
if |
na.limit |
all variants with a missing value ratio above this threshold will be omitted from the output object. |
MAF.limit |
all variants with an MAF above this threshold will be omitted from the output object. |
na.action |
if “impute.major”, all missing values are considered as major alleles when computing MAFs. If “omit”, all variants containing missing values will be omitted in the output object. If “fail”, the function stops with an error if a variant contains any missing values. |
MAF.action |
if “ignore” (default),
no action is taken for variants with an MAF greater than 0.5, these
variants are kept and included in the output object as they are.
If “omit”, all variants with an MAF greater
than 0.5 are omitted in the output object. If “fail”, the
function stops with an error if any variant has an MAF greater than
0.5. If “invert”, all variants with an MAF
exceeding 0.5 will be inverted in the sense that all minor alleles
will be replaced by major alleles and vice versa. Note: if this setting is
used in conjunction with |
omitZeroMAF |
if |
refAlt |
if |
sex |
if |
... |
for the three latter methods above, all other parameters
are passed on to the method with signature
|
This method uses the “tabix” API provided by the
Rsamtools package to parse a VCF file.
The readVariantInfo
method considers each variant and
determines its minor allele frequency (MAF) and the type of the
variant. The result is returned as a VariantInfo
object, i.e. a GRanges
object with two
metadata columns “MAF” and “type”. The former contains
the MAF of each variant, while the latter is a factor column that
contains information about the type of the variant. Possible values
in this column are “INDEL” (insertion or deletion),
“MULTIPLE” (single-nucleotide variant with multiple alternate
alleles), “TRANSITION” (single-nucleotide variation A/G or C/T),
“TRANSVERSION” (single-nucleotide variation A/C, A/T, C/G, or
G/T), or “UNKNOWN” (anything else). If refAlt
is TRUE
,
two further metadata columns “ref” and “alt” are
included which contain reference and alternate alleles of each variant.
For all variants, filters in terms of missing values and MAFs can be
applied. Moreover, variants with MAFs greater than 0.5 can filtered
out or inverted. For details, see descriptions of parameters
na.limit
, MAF.limit
, na.action
, and
MAF.action
above.
returns an object of class VariantInfo
Ulrich Bodenhofer
https://github.com/UBod/podkat
https://github.com/samtools/hts-specs
Li, H., Handsaker, B., Wysoker, A., Fenell, T., Ruan, J., Homer, N., Marth, G., Abecasis, G., Durbin, R., and 1000 Genome Project Data Processing Subgroup (2009) The Sequence Alignment/Map format and SAMtools. Bioinformatics 25, 2078-2079. DOI: \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1093/bioinformatics/btp352")}.
GenotypeMatrix
vcfFile <- system.file("examples/example1.vcf.gz", package="podkat")
## default parameters
vInfo <- readVariantInfo(vcfFile)
vInfo
summary(vInfo)
## including zero MAF variants and reference/alternate alleles
vInfo <- readVariantInfo(vcfFile, omitZeroMAF=FALSE, refAlt=TRUE)
vInfo
summary(vInfo)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.