geno_freq_monogenic {clipp} | R Documentation |
Calculate genotype frequencies from allele frequencies using Hardy-Weinberg equilibrium
Description
A function to calculate the unphased genotype frequencies for a single autosomal genetic locus that has given allele frequencies and is at Hardy-Weinberg equilibrium (HWE).
Usage
geno_freq_monogenic(p_alleles, annotate = FALSE)
Arguments
p_alleles |
A vector of strictly positive numbers that sum to |
annotate |
A logical flag. When |
Details
For a genetic locus at Hardy-Weinberg equilibrium, the population
allele frequencies at the locus determine the population genotype frequencies;
see Sections 1.2 and 1.3 of (Lange, 2002).
Given a vector p_alleles
containing the allele
frequencies, this function returns the frequencies of the possible unphased
genotypes, in a particular order that can be viewed by setting annotate
to
TRUE
. If the alleles are named 1:length(p_alleles)
, so that p_alleles[i]
is the frequency of allele i
, then the unphased genotypes are named
1/1, 1/2, ...
. Note that if the output of this function is to be used
as the geno_freq
argument of pedigree_loglikelihood
then the annotate
option must be set to FALSE
.
Value
A vector of strictly positive numbers (the genotype frequencies)
that sum to 1
, named with the genotype names if annotate
is TRUE
.
References
Lange K. Mathematical and Statistical Methods for Genetic Analysis (second edition). Springer, New York. 2002.
Examples
# Genotype frequencies for a biallelic locus at HWE and with a minor allele frequency of 10%
p_alleles <- c(0.9, 0.1)
geno_freq_monogenic(p_alleles, annotate = TRUE)
# Genotype frequencies for a triallelic locus at Hardy-Weinberg equilibrium
p_alleles <- c(0.85, 0.1, 0.05)
geno_freq_monogenic(p_alleles, annotate = TRUE)
sum(geno_freq_monogenic(p_alleles))