addCountGenos-methods | R Documentation |
Adds the total occurences of a set of genotypes as an INFO
field for each variant.
All given genotypes are counted toward a single
total (e.g. grand total of c("0/0", "0|0")
),
while other genotypes are silently ignored.
## S4 method for signature 'ExpandedVCF'
addCountGenos(
vcf, genos, key, description,
samples = 1:ncol(vcf), force = FALSE)
vcf |
|
genos |
|
key |
Name of the INFO field to create or update
( |
description |
|
samples |
|
force |
If |
In all cases, the new INFO field is inserted after the last existing field.
In other words, overwriting an existing INFO field is achieved by dropping
it from the data and header of the info
slot,
and subsequently inserting the new data after the last remaining INFO field.
ExpandedVCF
object including an additional INFO field stating
the count of genotypes.
Kevin Rue-Albrecht
countGenos,ExpandedVCF-method
and geno,VCF-method
# Example data ----
# VCF file
vcfFile <- system.file("extdata", "moderate.vcf", package = "TVTB")
# TVTB parameters
tparam <- TVTBparam(Genotypes(ref = "0|0", het = c("0|1", "1|0"), alt = "1|1"))
# Pre-process variants
vcf <- VariantAnnotation::readVcf(vcfFile, param = tparam)
vcf <- VariantAnnotation::expand(vcf, row.names = TRUE)
# Example usage ----
vcf <- addCountGenos(
vcf, het(tparam),
suffix(tparam)["het"],
"Number of heterozygous genotypes")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.