Tutorials › High-Dimensional Genomic Data Analysis › Interpreting Hardy-Weinberg Failures

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

Interpreting Hardy-Weinberg Failures

Learn to assess the size and context of a Hardy-Weinberg departure, weigh possible explanations, and decide what follow-up evidence is needed before acting on a variant.

Intermediate 12 min read

What You'll Learn

  • Interpret a Hardy-Weinberg test result alongside genotype counts and effect size.
  • Distinguish evidence of departure from evidence about its cause.
  • Recognize how population mixture can create a pooled departure when subgroups are in equilibrium.
  • Use call-quality evidence to assess genotyping error as one possible explanation.
  • Understand how sample size, sparse counts, and multiple testing affect interpretation.
  • Choose appropriate follow-up checks before filtering a variant.

What a Hardy-Weinberg Departure Can—and Cannot—Tell You

A Hardy-Weinberg (HWE) test asks whether observed genotype counts are compatible with the proportions expected under a specified population model. In genomic quality control, a departure can be a useful warning: genotyping error, population structure, or other departures from the model may be present. But the test does not identify which explanation applies. Nor does a small p-value, by itself, show that a variant's genotype calls are bad.

The central task is therefore interpretation, not simply labelling a variant as “failed.” Begin with the observed and expected counts, the size and direction of the departure, the sample and population being tested, and the quality evidence available for that locus. The earlier material on Hardy-Weinberg deviations in controls and cases explains why the sample context matters: a departure in cases can have a different interpretation from one in controls.

Definition: For a biallelic autosomal variant, let the allele frequencies be \(p\) and \(q=1-p\). Under Hardy-Weinberg equilibrium, the genotype proportions are \(p^2\), \(2pq\), and \(q^2\). A Hardy-Weinberg departure is a difference between observed genotype counts and the counts expected under these proportions. A test evaluates compatibility with this model; it does not determine the cause of a difference.

For observed counts \(O_{AA}, O_{AB}, O_{BB}\), estimate the allele frequency from the called genotypes, for example \(\hat{p}=(2O_{AA}+O_{AB})/(2n)\), where \(n=O_{AA}+O_{AB}+O_{BB}\). The corresponding expected counts are \(n\hat{p}^{\,2}\), \(2n\hat{p}(1-\hat{p})\), and \(n(1-\hat{p})^2\). The Pearson statistic compares each observed count with its expected count. With a biallelic variant and an estimated allele frequency, its usual large-sample reference distribution has \(df=1\). The earlier material on Pearson and exact Hardy-Weinberg tests covers the test procedures; here the emphasis is on reading their results responsibly.

Assumptions and the Meaning of the Test

The HWE proportions describe a model, not a universal requirement for every sample. For the usual interpretation, consider a diploid autosomal locus in a population with random mating, no relevant selection, mutation, or migration affecting the locus, and a sufficiently large population. The sample should represent one population in a way that does not pool groups with substantially different allele frequencies. Statistical testing also relies on appropriately called genotypes and independent sampled individuals; close relatedness can undermine the usual reference distribution.

In a QC setting, these conditions are not guaranteed. A test may flag a departure because one or more model assumptions fail, because genotypes are miscalled, or because random sampling produced a difference. It may also flag a departure for a biologically meaningful reason. The null hypothesis is compatibility with the HWE model in the tested sample, not “the data are error-free.” A p-value is the probability, under the null model and test assumptions, of obtaining a statistic at least as extreme as the one observed. It is not the probability that the null is true, or the probability that a genotype is wrong.

A short derivation clarifies why the usual Pearson test has one degree of freedom. There are three genotype counts, but their sum is fixed at \(n\), leaving two independent count contrasts. Estimating the allele frequency from the same genotype counts uses one of those degrees of freedom. Thus the usual test has \(3-1-1=1\) degree of freedom. This reference distribution is an approximation whose adequacy depends on the sample and expected counts; exact methods are useful when counts are sparse.

$$ X^2=\sum_{g\in\{AA,AB,BB\}}\frac{(O_g-E_g)^2}{E_g}, \qquad E_{AA}=n\hat{p}^{\,2},\quad E_{AB}=2n\hat{p}(1-\hat{p}),\quad E_{BB}=n(1-\hat{p})^2. $$

A p-value addresses the strength of evidence against the specified model, not the practical size or cause of a departure. To describe the data, report the observed and expected counts and identify whether the departure is mainly a deficit or an excess of heterozygotes relative to expectation. Then assess plausible explanations and follow-up evidence. The same p-value can accompany different effect sizes, sample sizes, and QC implications.

Worked Example: A Strong Departure Is a Signal, Not a Diagnosis

Suppose a hypothetical QC sample has \(n=256\) called genotypes: 89 \(AA\), 78 \(AB\), and 89 \(BB\). Estimate the allele frequency and calculate the Pearson HWE statistic.

The estimated frequency of \(A\) is \(\hat{p}=(2(89)+78)/(2(256))=256/512=0.5\). The expected counts are therefore \(256(0.5)^2=64\) for \(AA\), \(256(2(0.5)(0.5))=128\) for \(AB\), and 64 for \(BB\). All expected counts are large enough for the usual Pearson approximation to be reasonable.

Substituting into the statistic gives

$$ X^2=\frac{(89-64)^2}{64}+\frac{(78-128)^2}{128}+\frac{(89-64)^2}{64} =\frac{625}{64}+\frac{2500}{128}+\frac{625}{64} =9.7656+19.5313+9.7656=39.0625. $$

With \(df=1\), the upper-tail p-value is approximately \(4.1\times10^{-10}\). The observed heterozygote count is 50 below expectation, a deficit of \(50/128=39.06\%\) relative to the expected count. This is a strong departure under the test model. It is not proof of genotyping error: the counts alone cannot distinguish error from population structure or another explanation. The locus merits investigation, including review of call quality and sample composition.

How Different Causes Can Produce Departures

Some departures are compatible with technical problems. For example, allele dropout or systematic misclassification can convert heterozygotes into homozygote calls, producing a heterozygote deficit. Other calling problems can create different patterns, including excess apparent heterozygotes. These are hypotheses to check against the assay and calling evidence, not diagnoses inferred from the direction of the departure alone.

Population mixture is another important possibility. If groups with different allele frequencies are pooled, the pooled genotypes need not follow HWE proportions calculated from the pooled allele frequency—even if each group is individually in equilibrium. This is why examining ancestry or other meaningful strata can change interpretation.

Worked Example: A Pooled Population Can Depart from Equilibrium

Consider two hypothetical groups of 500 individuals each. In group 1, the \(A\)-allele frequency is 0.2, so HWE predicts 20 \(AA\), 160 \(AB\), and 320 \(BB\). In group 2, the \(A\)-allele frequency is 0.8, so HWE predicts 320 \(AA\), 160 \(AB\), and 20 \(BB\). Assume these counts are observed in the two groups.

Within each group, the counts exactly match that group's HWE expectations. After pooling, the counts are 340 \(AA\), 320 \(AB\), and 340 \(BB\), with \(n=1000\). The pooled estimated \(A\)-allele frequency is \((2(340)+320)/(2(1000))=0.5\). Under pooled HWE, the expected counts are 250, 500, and 250.

The pooled Pearson statistic is

$$ X^2=\frac{(340-250)^2}{250}+\frac{(320-500)^2}{500}+\frac{(340-250)^2}{250} =32.4+64.8+32.4=129.6. $$

This is a very strong pooled departure, but the stipulated group counts show why it should not automatically be called a calling failure: each group is in equilibrium under its own allele frequency. In real data, subgroup definitions and sample sizes require care, and stratification is informative only when scientifically justified. The example illustrates that a pooled test can flag population mixture rather than faulty genotype calls.

Worked Example: Checking a Plausible Genotyping-Error Mechanism

Suppose a hypothetical sample of 1,000 individuals would have HWE counts of 250 \(AA\), 500 \(AB\), and 250 \(BB\) at an allele frequency of 0.5. Imagine that 150 true heterozygotes are instead called as homozygotes, with 75 assigned to each homozygote class. The resulting observed counts are 325 \(AA\), 350 \(AB\), and 325 \(BB\).

The observed allele frequency remains \((2(325)+350)/2000=0.5\), so the HWE expected counts remain 250, 500, and 250. Thus

$$ X^2=\frac{(325-250)^2}{250}+\frac{(350-500)^2}{500}+\frac{(325-250)^2}{250} =22.5+45+22.5=90. $$

The \(df=1\) upper-tail p-value is approximately \(2.3\times10^{-21}\). In this constructed example, the call-error mechanism explains the heterozygote deficit, but the statistic itself does not establish that mechanism. In actual QC, investigate evidence such as genotype-cluster separation, allele-balance patterns where available, replicate concordance, batch-specific call patterns, and whether the locus has unusual missingness or call quality. A plausible mechanism becomes more credible when independent technical evidence supports it.

Sampling Variation, Sample Size, and Test Choice

A modest departure can occur by chance, especially in a small sample. Conversely, a small proportional difference can yield a small p-value in a very large sample. The counts, the departure's size, and the study context should therefore accompany any p-value. Failure to reject HWE is not proof that the population meets every HWE assumption or that calls are correct; a small sample may simply provide little evidence either way.

Worked Example: The Same Proportional Departure at Two Sample Sizes

Compare two hypothetical samples with allele frequency 0.5. In the first, \(n=40\) and the counts are 12 \(AA\), 16 \(AB\), and 12 \(BB\). Expected counts are 10, 20, and 10, so

$$ X^2=\frac{(12-10)^2}{10}+\frac{(16-20)^2}{20}+\frac{(12-10)^2}{10} =0.4+0.8+0.4=1.6. $$

The approximate \(df=1\) p-value is 0.206. The heterozygote count is 20% below expectation, but this sample does not provide strong evidence against HWE at a conventional 0.05 significance level. Its expected counts are all at least 10; if counts were sparse, an exact test would be preferable to relying on a large-sample approximation.

For \(n=400\), consider counts of 120, 160, and 120. Expected counts are 100, 200, and 100: the same proportions as in the smaller sample. The statistic is \(400/100+1600/200+400/100=16\), with \(df=1\) p-value approximately \(6.3\times10^{-5}\). The proportional departure is unchanged, but the larger sample gives stronger evidence against the model. Neither result identifies why the counts differ from expectation.

For an individual biallelic locus with sufficiently large expected counts, the Pearson test offers a convenient approximation. An exact HWE test avoids the chi-square approximation and is often preferred when expected counts are small; it still tests compatibility with an HWE model and does not diagnose the cause. If a sample contains meaningful subgroups, examining justified strata can help assess mixture. These approaches answer different questions and are not substitutes for examining genotype-call evidence.

In genome-wide QC, many loci are tested. Even when each null model is correct, some small p-values will occur by chance across a large set of tests. Use an appropriate multiple-testing strategy when making scan-wide claims, and do not let a threshold replace context. A result may warrant review without warranting automatic exclusion; conversely, absence of a small p-value does not certify a locus as reliable.

Practical Interpretation and Common Pitfalls

A useful review follows a sequence: verify the sample being tested and the genotype counts; compare observed and expected counts; describe the direction and size of the departure; assess whether the test approximation is suitable; then evaluate plausible causes using independent evidence. Check whether the pattern varies across batches or relevant population strata, and inspect technical call evidence before deciding whether to flag, re-call, or filter a variant. When the data are from cases, interpret departures in light of the case-selection context rather than treating them as identical to control-sample QC signals.

  • Mistake: “The p-value is tiny, so the genotypes are wrong.” A small p-value is evidence against the tested HWE model under its assumptions. It does not identify genotyping error; mixture or other model departures can also explain it. Seek supporting technical evidence.
  • Mistake: “The test was not significant, so the locus passed QC.” Non-significance is not proof of equilibrium or accuracy. Consider sample size, power, call quality, and other QC checks.
  • Mistake: “A heterozygote deficit has one unique cause.” Several mechanisms can produce similar count patterns. Treat the direction as a clue for investigation, not a causal conclusion.
  • Mistake: “A pooled test describes every subgroup.” A pooled departure may arise because allele frequencies differ among groups. Review scientifically meaningful strata before attributing the signal to the assay.

The limitations are fundamental: HWE testing is a one-locus summary, depends on assumptions that may not hold, and does not reveal which individuals are miscalled. It should be combined with other QC evidence and interpreted alongside the research design. A QC action should be proportionate to the strength of the departure and the corroborating evidence, not determined by a p-value cutoff alone.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions below.

  1. Why does a small HWE p-value not establish that genotype calls are erroneous?
  2. Two groups are each in HWE but have different allele frequencies. What can happen when their genotypes are pooled?
  3. For \(n=100\), observed counts are 36 \(AA\), 48 \(AB\), and 16 \(BB\). Find \(\hat{p}\), the expected counts, and the Pearson statistic.
  4. What additional evidence would make a genotyping-error explanation more credible?
  5. Why can the same proportional departure produce different p-values in different sample sizes?

Solutions. (1) The test evaluates compatibility with the HWE model; population mixture or other assumption violations can also cause departures, and the p-value does not identify a cause. (2) The pooled counts can depart from HWE calculated using the pooled allele frequency, even though each group is individually in equilibrium. (3) \(\hat{p}=(2(36)+48)/200=0.6\). Expected counts are \(100(0.6^2)=36\), \(100(2(0.6)(0.4))=48\), and \(100(0.4^2)=16\). Thus \(X^2=0\): the observed counts match expectation exactly. (4) Examples include poor genotype-cluster separation, low replicate concordance, batch-specific anomalies, or other independent evidence of unreliable calls. (5) Larger samples generally provide more information about departures; the test statistic can increase with sample size even when the proportions and relative departure are unchanged.

Clinical Biostats