Adds genotypes counts
(reference homozygote, heterozygote, and alternate homozygote)
and allele frequencies (alternate and minor)
as INFO fields in an
Counts and frequencies may be calculated overall
(i.e. across all samples), or within groups of samples
(i.e. within phenotype levels).
Multiple genotypes can be counted toward a single
frequency (e.g. combined
c("0/0", "0|0") for
homozygote reference genotypes).
1 2 3 4 5 6 7 8
phenos argument is central to control the behaviour of this method.
phenos=NULL, genotypes and frequencies are calculated across all the
samples in the
ExpandedVCF object, and stored in INFO fields
named according to settings stored in the
TVTBparam object (see below).
phenos is a
character vector of phenotypes present in
colnames(colData(vcf)), counts and frequencies are calculated for each
level of those phenotypes, and stored in INFO fields prefixed with
"<phenotype>_<level>_" and suffixed with the settings stored in the
param object (see below).
phenos is a named
names must be
phenotypes present in
colnames(colData(vcf)), and values must be levels
of those phenotypes. In this case, counts and frequencies are calculated for
the given levels of the given phenotypes, and stored in INFO fields as
param object controls the key (suffix) of INFO fields as
Count of reference homozygote genotypes.
Count of heterozygote genotypes.
Count of alternate homozygote genotypes.
Alternate allele frequency.
Minor allele frequency
ExpandedVCF object including additional
INFO fields for genotype counts and allele frequencies.
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 <- addFrequencies(vcf, list(super_pop = "AFR"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.