Allele frequencies and Hardy–Weinberg expectations
Population Genetics Practical 2: Observed summaries and a random-union model
Learning objectives
Count alleles with correct missing-call denominators; distinguish allele frequencies, genotype frequencies and heterozygosity; derive HWE expectations; and explain why a finite-sample departure does not by itself establish disequilibrium or its cause.
Question 1. What is the genotype-frequency denominator? What is the allele-frequency denominator?
Suggested answer
Five called individuals give the genotype denominator. Ten called allele copies give the allele denominator. The missing individual contributes neither a known genotype nor known allele copies. Excluding missing calls describes the called sample; it does not prove missingness is ignorable for population inference.
2. Calculate observed frequencies and heterozygosity
Figure 1: Genotype counts among five called individuals. One missing call is excluded.
Question 2. Is the A frequency 0.6 the same quantity as the AA frequency 0.4?
Suggested answer
No. Allele frequency counts allele copies, while genotype frequency counts individuals. Two AA individuals contribute four A copies, and two AB individuals contribute two more. Observed heterozygosity is the fraction of called individuals with AB, here 0.4.
An all-missing locus has no called denominator: its frequency is undefined, not zero. A monomorphic called locus has a defined frequency of zero or one.
3. Derive HWE expectations
Assume two independently sampled gametes from one pool, each carrying A with probability \(p\) and B with probability \(q=1-p\). AA requires A from both gametes, giving \(p^2\). AB has two ordered possibilities, A then B or B then A, giving \(2pq\). BB has probability \(q^2\).
The proportions sum to \((p+q)^2=1\). This describes genotype formation at supplied frequencies. Stable allele frequencies over generations require additional assumptions about selection, migration, mutation and drift. Random union of gametes does not force a small sample to match its expectations exactly.
Question 3. Why can expected counts be fractional? Should we round them to obtain the model’s predicted sample?
Suggested answer
Expected counts are averages over possible samples, not a particular realized sample. Here they are 1.8, 2.4 and 0.8. Rounding them would replace the model expectation with arbitrary integers.
Figure 2: Observed genotype proportions compared with HWE expectations at the sample’s estimated A frequency.
Observed heterozygosity is 0.4; plug-in expected heterozygosity is 0.48. The same sample supplied both its allele-frequency estimate and observed counts. Their difference is descriptive, not automatically a calibrated test statistic or an inbreeding estimate.
4. Explore the role of allele frequency
Show R code
p_grid <-seq(0,1,length.out=101)curves <-cbind(AA=p_grid^2,AB=2*p_grid*(1-p_grid),BB=(1-p_grid)^2)matplot(p_grid,curves,type="l",lty=1,lwd=2,col=c("#247BA0","#86B7A3","#D8A47F"),xlab="Frequency of A",ylab="Expected genotype proportion")legend("top",colnames(curves),lty=1,lwd=2,col=c("#247BA0","#86B7A3","#D8A47F"),bty="n")
Figure 3: HWE genotype expectations across supplied A frequencies. Heterozygosity is maximal when both alleles have frequency one half.
Question 4. Why is \(H_E=2p(1-p)\) zero at fixation and maximal at \(p=0.5\)?
Suggested answer
At fixation only one allele is present, so different alleles cannot pair. Since \(2p(1-p)=0.5-2(p-0.5)^2\), its maximum is 0.5 at equal allele frequencies. This describes random pairing; an observed sample or a nonrandom mating system need not have heterozygosity at most 0.5.
5. Separate expectation from a finite realization
Draw 20 small samples of five genotypes from the fixed model proportions. This is a seeded toy sampling calculation, not a simulated biological population or an HWE test.
Figure 4: Twenty possible five-individual samples from the fixed HWE model at p(A)=0.6. Finite genotype proportions vary.
Question 5. Does a heterozygote deficit in one sample prove inbreeding?
Suggested answer
No. Finite sampling, population mixtures, relatives, nonrandom mating or genotype errors can affect the comparison. Formal assessment requires a declared sampling model and a suitable test. Expected counts in this five-individual example are too small for an automatic large-sample chi-squared approximation. This practical does not conduct an HWE test or identify a cause of departure.
Exercises
Replace the missing genotype with AB. Recalculate allele frequency and observed heterozygosity.
Set every called genotype to AA. What happens to observed and expected heterozygosity?
Reverse A and B in the HWE model. Which proportions change?
Compare two equally weighted populations, one with \(p_A=0.9\) and the other with \(p_A=0.1\), each under HWE. Is pooled heterozygosity equal to the HWE expectation at the pooled frequency?
The completed sample has \(p_A=7/12\) and \(H_O=0.5\). Fixation gives both heterozygosities zero. Allele reversal exchanges the homozygote proportions. The mixture retains within-population heterozygosity 0.18 while pooled HWE predicts 0.5; this is a Wahlund-effect illustration, not proof of pedigree inbreeding. Pooling groups does not create random mating between them.
Package and app connections
The corresponding gpop examples use the same five-called-individual calculation. They are base-R teaching scripts, not exported scientific functions. If gpop is already installed, its examples can be inspected independently:
For optional local exploration, the existing Gene Pool and Hardy–Weinberg Explorer and random-mating simulator provide Shiny interfaces. They require their existing Shiny/ggplot2 dependencies and are not deployed web apps. This tutorial does not change or qualify their implementations.
Connection to the next topic
Next distinguish population structure, nonrandom mating and inbreeding, then study diversity and evolutionary forces. The central distinction remains: observed counts summarize data; expectations state a model; estimators and tests require additional assumptions.