Description Usage Arguments Details Value Warning Author(s) See Also Examples
Adds genotypes counts
(reference homozygote, heterozygote, and alternate homozygote)
and allele frequencies (alternate and minor) calculated
in a group of samples associated with a given level of a given phenotype
as INFO fields in an ExpandedVCF
object.
Multiple genotypes can be counted toward a single
frequency (e.g. combined c("0/0", "0|0")
for
homozygote reference genotypes).
1 2 3 | ## S4 method for signature 'ExpandedVCF'
addPhenoLevelFrequencies(
vcf, pheno, level, force = FALSE)
|
vcf |
|
pheno |
Phenotype in |
level |
Phenotype level in |
force |
If If |
Genotypes and frequencies are calculated within the groups of samples
associated with the given level of the given phenotype,
and stored in INFO fields
named according to settings stored in
metadata(vcf)[["TVTBparam"]]
(see below).
The TVTBparam
object controls
the key suffix of INFO fields as follows:
names(ref(param))
Count of reference homozygote genotypes.
names(het(param))
Count of heterozygote genotypes.
names(alt(param))
Count of alternate homozygote genotypes.
aaf(param)
Alternate allele frequency.
maf(param)
Minor allele frequency
ExpandedVCF
object including additional
INFO fields for genotype counts and allele frequencies.
See Details.
A warning
message is issued if genotypes are not fully defined in the
TVTBparam
.
Kevin Rue-Albrecht
addFrequencies,ExpandedVCF,list-method
,
addOverallFrequencies,ExpandedVCF-method
,
VCF
,
and TVTBparam
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # Example data ----
# VCF file
vcfFile <- system.file("extdata", "moderate.vcf", package = "TVTB")
# Phenotype file
phenoFile <- system.file("extdata", "moderate_pheno.txt", package = "TVTB")
phenotypes <- S4Vectors::DataFrame(read.table(phenoFile, TRUE, row.names = 1))
# TVTB parameters
tparam <- TVTBparam(Genotypes("0|0", c("0|1", "1|0"), "1|1"))
# Pre-process variants
vcf <- VariantAnnotation::readVcf(
vcfFile, param = tparam, colData = phenotypes)
vcf <- VariantAnnotation::expand(vcf, row.names = TRUE)
# Example usage ----
vcf <- addPhenoLevelFrequencies(vcf, "super_pop", "AFR")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.