Tutorials › High-Dimensional Genomic Data Analysis › Expected Genotype Counts Under Hardy-Weinberg Equilibrium

Variant-Level and Sample-Level Quality Control · Tutorial 22 of 795

Expected Genotype Counts Under Hardy-Weinberg Equilibrium

Learn to derive and calculate expected genotype proportions and counts under Hardy-Weinberg equilibrium, and recognize when the calculation’s assumptions or inputs may be unreliable.

Intermediate 11 min read

What You'll Learn

  • Derive the proportions \(p^2\), \(2pq\), and \(q^2\) from random union of alleles.
  • Estimate allele frequencies from called genotypes at a biallelic diploid variant.
  • Calculate expected genotype counts and verify that they sum to the called sample size.
  • Distinguish expected counts from observed counts and from a formal test of equilibrium.
  • Identify how missing calls, population composition, and allele-frequency estimates affect the calculation.

Why Calculate Expected Genotype Counts?

At a biallelic variant, each diploid individual has one of three genotypes: two copies of one allele, one copy of each allele, or two copies of the other allele. Hardy-Weinberg equilibrium (HWE) gives a simple benchmark for the proportions of these genotypes, provided the two alleles combine at random in the population. Comparing observed counts with this benchmark is useful in genomic quality control, but the benchmark itself is not a test and does not establish that the data are error-free.

The calculation depends on the allele frequency and the number of individuals with an observed genotype. In practice, allele frequency is often estimated from those called genotypes. Missing genotypes therefore must not be counted as a fourth genotype or silently included in the denominator.

Definition: For a biallelic variant, label the alleles \(A\) and \(a\), and let \(p\) be the frequency of \(A\) and \(q\) the frequency of \(a\), with \(p+q=1\). Under Hardy-Weinberg equilibrium, the expected genotype proportions are \(p^2\) for \(AA\), \(2pq\) for \(Aa\), and \(q^2\) for \(aa\). For \(n\) individuals with called genotypes, the corresponding expected counts are \(np^2\), \(2npq\), and \(nq^2\).

Deriving the Three Proportions

The derivation follows from the random union of alleles. Imagine drawing one allele from each of two gametes that combine to form an individual. Each draw has probability \(p\) of being \(A\) and probability \(q\) of being \(a\). If the draws are independent and come from the same allele-frequency distribution, the probability of receiving \(A\) from both is \(p\times p=p^2\). The probability of receiving \(a\) from both is \(q\times q=q^2\).

A heterozygote can arise in either of two ways: the first draw is \(A\) and the second is \(a\), or the first is \(a\) and the second is \(A\). These mutually exclusive possibilities each have probability \(pq\), so their combined probability is \(pq+qp=2pq\). The three outcomes cover all possible genotypes, and their proportions sum to one:

$$ p^2+2pq+q^2=(p+q)^2=1. $$

If a population has these genotype proportions, then in a sample of \(n\) called individuals the expected count in a genotype category is the sample size multiplied by that category’s probability. Thus, for example, the expected \(Aa\) count is \(n(2pq)\). “Expected” means an average over repeated samples under the model; it does not mean that the observed count must equal that number. Expected counts can be fractional.

Assumptions behind the benchmark: The calculation concerns a biallelic locus in diploid individuals. The HWE proportions apply when the two alleles combine at random from a common allele pool, so the two allele draws have probabilities \(p\) and \(q\) and are independent. In a genomic sample, the interpretation also depends on using an appropriate population and reliable genotype calls. The proportions are a model-based reference, not a guarantee that every real sample will match them.

Estimating Allele Frequencies From Genotype Calls

When allele frequencies are not supplied, they can be estimated by counting alleles among individuals with called genotypes. Each \(AA\) individual contributes two \(A\) alleles, each \(Aa\) individual contributes one, and each \(aa\) individual contributes none. If the observed genotype counts are \(n_{AA}\), \(n_{Aa}\), and \(n_{aa}\), and \(n=n_{AA}+n_{Aa}+n_{aa}\), there are \(2n\) called alleles. The estimated frequency of \(A\) is therefore the number of \(A\) alleles divided by \(2n\); the estimate for \(a\) is calculated in the same way.

$$ \hat{p}=\frac{2n_{AA}+n_{Aa}}{2n}, \qquad \hat{q}=\frac{2n_{aa}+n_{Aa}}{2n}=1-\hat{p}. $$

Substituting \(\hat{p}\) and \(\hat{q}\) into the HWE proportions gives plug-in expected counts: \(n\hat{p}^{\,2}\), \(2n\hat{p}\hat{q}\), and \(n\hat{q}^{\,2}\). This procedure uses the called genotypes both to estimate allele frequency and to calculate the benchmark. The resulting expected counts need not equal the observed counts, because the observed genotype distribution may have a different balance of homozygotes and heterozygotes even when its allele frequency is unchanged.

Worked Example: Calculating Counts From a Supplied Allele Frequency

Suppose a hypothetical sample has \(n=250\) called diploid genotypes at a biallelic variant. The allele frequency of \(A\) is supplied as \(p=0.80\), so \(q=1-p=0.20\). Calculate the HWE expected proportions and counts.

The proportions are \(p^2=(0.80)^2=0.64\) for \(AA\), \(2pq=2(0.80)(0.20)=0.32\) for \(Aa\), and \(q^2=(0.20)^2=0.04\) for \(aa\). Multiplying each by 250 gives:

$$ E_{AA}=250(0.64)=160,\qquad E_{Aa}=250(0.32)=80,\qquad E_{aa}=250(0.04)=10. $$

The counts sum to \(160+80+10=250\), as required. Under the HWE model with this allele frequency, the expected counts are 160 \(AA\), 80 \(Aa\), and 10 \(aa\). These are reference values, not predictions that the observed sample must contain exactly those counts.

Worked Example: Estimating Frequencies and Calculating Expected Counts

In a hypothetical set of 200 called genotypes, suppose the observed counts are 110 \(AA\), 60 \(Aa\), and 30 \(aa\). Estimate the allele frequencies and calculate the HWE expected counts.

There are \(2(200)=400\) called alleles. The observed number of \(A\) alleles is \(2(110)+60=280\), so \(\hat{p}=280/400=0.70\). The remaining 120 alleles are \(a\), giving \(\hat{q}=120/400=0.30\). The expected proportions are \(0.70^2=0.49\), \(2(0.70)(0.30)=0.42\), and \(0.30^2=0.09\). Thus:

$$ E_{AA}=200(0.49)=98,\qquad E_{Aa}=200(0.42)=84,\qquad E_{aa}=200(0.09)=18. $$

The expected counts sum to \(98+84+18=200\). The observed and expected counts are, respectively, 110 versus 98 for \(AA\), 60 versus 84 for \(Aa\), and 30 versus 18 for \(aa\). The calculation describes the discrepancy; by itself, it does not say whether that discrepancy is larger than would be expected from sampling variation.

Worked Example: Using Called Genotypes When Some Calls Are Missing

A hypothetical dataset contains 435 individuals at a diploid biallelic variant, but 35 have missing genotype calls. Among the 400 called genotypes, there are 240 \(AA\), 120 \(Aa\), and 40 \(aa\). Calculate expected counts using the called individuals.

The appropriate genotype-count denominator is \(n=400\), not 435. There are \(2(400)=800\) called alleles, of which \(2(240)+120=600\) are \(A\). Therefore, \(\hat{p}=600/800=0.75\) and \(\hat{q}=0.25\). The expected proportions are \(0.75^2=0.5625\), \(2(0.75)(0.25)=0.375\), and \(0.25^2=0.0625\). The expected counts are:

$$ E_{AA}=400(0.5625)=225,\qquad E_{Aa}=400(0.375)=150,\qquad E_{aa}=400(0.0625)=25. $$

These sum to 400, the number of called genotypes. The 35 missing calls contribute no observed alleles and are not assigned to any genotype category. If the chance of a call being missing depends on genotype, the called individuals may not represent the full set of 435 individuals; the calculation remains arithmetic on the called data, but its population interpretation may be compromised.

Checking the Calculation and Its Inputs

A short set of checks catches many errors. First, confirm that the two allele frequencies are nonnegative and sum to one. Second, check that the expected proportions sum to one and that the expected counts sum to the number of called diploid genotypes. Third, ensure that the allele labels have been applied consistently: swapping the labels \(A\) and \(a\) swaps the two homozygote expectations but leaves the heterozygote expectation unchanged. The calculation should not depend on which allele is called the reference allele.

For estimated frequencies, the allele count must reflect two alleles per called diploid genotype. A heterozygote contributes one copy of each allele, not two copies of either one. A genotype with no call contributes neither allele. If the variant is not biallelic, these three-category formulas do not describe all possible genotypes. Similarly, these counts should not be applied unmodified to a chromosome or sample for which the diploid genotype representation is inappropriate.

The main alternatives in this calculation are to use an externally supplied allele frequency or to estimate the frequency from the sample’s called genotypes. An external frequency can be useful when it is appropriate to the population being analyzed, but a mismatch in ancestry or other population composition can make it a poor reference. The sample estimate reflects the called data at hand, but it can be affected by sampling variation, genotype errors, or nonrepresentative missingness. State which frequency was used; the same observed genotype counts can lead to different expected counts under different \(p\) and \(q\).

Key distinction: Expected genotype counts are calculated from allele frequencies and a sample size under the HWE proportions. Observed counts are the genotype calls actually present. Their difference may motivate further investigation, but calculating expected counts alone is not a significance test and does not identify the cause of a discrepancy.

Common Mistakes and Limitations

  • Using \(n\) for alleles instead of individuals. There are \(2n\) alleles among \(n\) called diploid genotypes. Divide the allele count by \(2n\) to estimate an allele frequency.
  • Counting missing calls as a genotype. Missing calls are excluded from both the called genotype counts and the allele-frequency denominator. Use the actual number of called genotypes for \(n\).
  • Assuming expected means observed. An expected count is a model-based average, and observed counts vary across samples. A fractional expected count is valid.
  • Interpreting a discrepancy as proof of a specific problem. The calculation alone cannot determine whether a difference reflects sampling variation, population composition, call quality, or another cause.
  • Applying the formula outside its setup. The \(p^2,2pq,q^2\) expression is for a biallelic diploid locus under random union of alleles. Check the locus and genotype representation before using it.

The benchmark is useful because it translates an allele frequency into a complete, interpretable distribution across the three genotypes. Its limitations are equally important: an inaccurate frequency estimate or unsuitable set of called samples can make the resulting expected counts misleading. In quality control, first verify the inputs and denominator, then treat any observed-versus-expected difference as a diagnostic signal requiring context rather than as a conclusion on its own.

Check Your Understanding

Work each calculation using the called sample size and show how the genotype proportions add to one.

  1. A supplied allele frequency is \(p=0.60\), and there are 150 called diploid genotypes. What are the expected proportions and counts?
  2. A sample has 45 \(AA\), 40 \(Aa\), and 15 \(aa\) calls. Find \(\hat{p}\), \(\hat{q}\), and the expected genotype counts.
  3. There are 200 enrolled individuals, of whom 20 have missing genotypes. Which sample size belongs in the expected-count calculation, and why?
  4. If \(p=1\) and \(q=0\), what are the three expected genotype proportions? What does this boundary case mean?

Solutions. (1) \(q=0.40\). The proportions are \(p^2=0.36\), \(2pq=0.48\), and \(q^2=0.16\), which sum to 1. The counts are \(150(0.36)=54\) \(AA\), \(150(0.48)=72\) \(Aa\), and \(150(0.16)=24\) \(aa\), summing to 150. (2) There are 200 called alleles. The \(A\) count is \(2(45)+40=130\), so \(\hat{p}=130/200=0.65\) and \(\hat{q}=0.35\). The expected counts are \(100(0.65^2)=42.25\), \(100[2(0.65)(0.35)]=45.5\), and \(100(0.35^2)=12.25\); they sum to 100. (3) Use \(n=180\), the number with called genotypes. The 20 missing calls provide no observed alleles and are not part of the three genotype categories. (4) The proportions are \(1^2=1\), \(2(1)(0)=0\), and \(0^2=0\). The model assigns all expected genotypes to \(AA\), because the specified allele frequency contains only \(A\).

Clinical Biostats