Why Check Hardy–Weinberg Equilibrium in Controls?
A Hardy–Weinberg (HWE) test in controls compares the observed genotype counts at a variant with the counts expected under a population model. In genomic quality control, this is a diagnostic: an unusual mismatch can flag a locus for review. It is not, by itself, proof that genotype calls are wrong. A small p-value may reflect a technical problem, but it can also arise from features of the sampled population or study design. Conversely, a non-small p-value does not establish that every call is correct.
The practical question is therefore not simply, “Did the test cross a threshold?” It is also, “How different are the observed counts from expectation, how reliable is the test approximation, and what other evidence is available for this locus?” The earlier material on expected genotype counts and Pearson and exact Hardy–Weinberg tests supplies the tests themselves; here the emphasis is their use and interpretation in control samples.
In a sample, the allele frequencies are generally estimated from the genotype counts. If the observed counts are \(n_{11}\), \(n_{12}\), and \(n_{22}\), then the estimated \(A_2\) allele frequency is \( \hat{q}=(2n_{22}+n_{12})/(2n) \), and \( \hat{p}=1-\hat{q} \). Use these estimates to obtain expected counts. The test evaluates whether the observed counts depart from the HWE pattern at the estimated allele frequency.
Assumptions and Choice of Test
The HWE model describes a population under conditions including random mating with respect to the locus, no relevant selection or migration, and a population sufficiently homogeneous for the model to apply. A control sample is not the whole population: it should represent an appropriate source population for the question being asked. In the usual QC test, individuals are treated as independent, diploid observations at an autosomal biallelic locus, and genotype calls are assumed to be available and correctly classified. Violations of these conditions can affect the test, so its result must be read in context.
The Pearson HWE test compares the observed counts with the counts computed using \(\hat{p}\) and \(\hat{q}\). With adequate expected counts, its statistic is compared approximately with a chi-square distribution with \(df=1\). The degrees of freedom are one because three genotype counts have one constraint from their total and one additional fitted quantity, the allele frequency. When expected counts are sparse, the chi-square approximation may be poor; an exact HWE test is preferable. The exact test conditions on the observed allele count and evaluates genotype-count configurations compatible with that count.
Whichever test is used, the p-value is calculated under the HWE null model. It is the probability, assuming that model and the test’s assumptions, of a result at least as extreme as the observed one according to the test statistic. It is not the probability that HWE is true, nor the probability that the variant is erroneous.
Worked Example: A Control Variant with Counts at Expectation
Suppose a hypothetical set of \(n=200\) controls has 98 \(A_1A_1\), 84 \(A_1A_2\), and 18 \(A_2A_2\) calls. Assume the locus is autosomal and biallelic, the individuals are independent, and the expected counts are large enough for the Pearson approximation.
The estimated frequency of \(A_2\) is \( \hat{q}=(84+2(18))/(2(200))=120/400=0.300 \), so \( \hat{p}=0.700 \). The expected counts are \(200(0.700)^2=98\), \(200(2)(0.700)(0.300)=84\), and \(200(0.300)^2=18\).
The Pearson statistic is \( \chi^2=(98-98)^2/98+(84-84)^2/84+(18-18)^2/18=0 \). With \(df=1\), the upper-tail p-value is 1.00. The observed counts match the fitted HWE expectations exactly, so this test shows no deviation. It does not certify that the calls are error-free; other QC evidence still matters.
Read the Counts Alongside the P-Value
A p-value compresses the comparison between observed and expected counts into one measure of statistical evidence against the null. It does not describe the size or direction of the departure. To see those, inspect the three genotype counts and their differences from expectation. In particular, ask whether the mismatch is concentrated in one genotype class, whether the counts are sufficient for the chosen test, and whether the departure is large relative to the sample size.
Worked Example: A Clear Departure in a Moderate-Sized Control Sample
Consider hypothetical control counts \(n=100\): 55 \(A_1A_1\), 30 \(A_1A_2\), and 15 \(A_2A_2\). Assume independent diploid observations at an autosomal biallelic locus. The estimated allele frequency is \( \hat{q}=(30+2(15))/200=0.300 \), so \( \hat{p}=0.700 \). The fitted expected counts are 49, 42, and 9.
All expected counts are at least 5, so the Pearson approximation is reasonable for this illustration. The statistic is \( \chi^2=(55-49)^2/49+(30-42)^2/42+(15-9)^2/9 \) \( =36/49+144/42+36/9=0.7347+3.4286+4.000=8.163 \).
For \(df=1\), the p-value is approximately 0.0043. The counts show fewer heterozygotes than expected (30 observed versus 42 expected) and more of each homozygote class (55 versus 49 and 15 versus 9). This is a statistically notable departure in this hypothetical sample and warrants review. The test alone does not identify why the counts differ or establish a calling error.
Magnitude matters in the opposite direction, too. A large sample can yield a small p-value for a modest difference between observed and expected proportions. Looking at count differences and proportions helps separate evidence against the exact null from practical importance for QC. There is no universal count difference that automatically makes a variant unacceptable: the relevance depends on the assay, sample, allele frequency, and other available diagnostics.
Worked Example: A Small Proportional Deviation in a Large Sample
In a hypothetical set of \(n=100{,}000\) controls, suppose the counts are 64,110 \(A_1A_1\), 31,780 \(A_1A_2\), and 4,110 \(A_2A_2\). The estimated \(A_2\) frequency is \( \hat{q}=(31{,}780+2(4{,}110))/200{,}000=40{,}000/200{,}000=0.200 \), so \( \hat{p}=0.800 \). Expected counts are 64,000, 32,000, and 4,000. Each is large, and the independent-observation and diploid autosomal assumptions are taken to hold, so a Pearson approximation is appropriate here.
The statistic is \( \chi^2=110^2/64{,}000+(-220)^2/32{,}000+110^2/4{,}000 \) \( =0.1891+1.5125+3.025=4.727 \). With \(df=1\), the p-value is approximately 0.0297. The heterozygote count is 220 below expectation, a difference of 0.22 percentage points of the full sample; each homozygote count is 110 above expectation, a difference of 0.11 percentage points. Thus the result is statistically detectable at a 0.05 level, while the proportional discrepancy is modest. It should be recorded and assessed with other QC evidence, not treated as an automatic reason to remove the variant.
From Test Result to QC Decision
A control-sample HWE result is most useful as one component of a locus-level review. A small p-value can prioritize a variant for inspection; the genotype counts then show the form and scale of the departure. Other relevant evidence can include call rate, missingness patterns, batch consistency, and genotype-cluster quality. These checks help distinguish an isolated statistical flag from a broader pattern that gives stronger grounds for concern. A non-small p-value should not be used as a substitute for those checks.
For a study examining many variants, the testing context also matters. Even if every tested variant followed the null model, a sufficiently large collection of tests would produce some small p-values by chance. QC teams should use a consistent review policy that accounts for the number of variants and the study’s assay and sample characteristics. A fixed cutoff is a screening rule, not a universal boundary between valid and invalid genotypes.
| Evidence | What it tells you | What it does not establish |
|---|---|---|
| Small HWE p-value in controls | The observed counts are unusual under the fitted HWE null and test assumptions. | That the calls are wrong or that one particular cause is responsible. |
| Observed and expected counts | The direction and numerical size of the count discrepancy. | Whether the discrepancy is technically or biologically explained. |
| Non-small p-value | The test did not find strong evidence of departure at its chosen scale and sample size. | That the locus has passed all quality checks. |
Common Pitfalls and Limitations
- Calling a small p-value the probability that HWE is false. The p-value is a probability of test results under the null model, not a posterior probability about the null or the genotype calls.
- Using the p-value as an effect size. A p-value depends on both the departure and the sample size. Compare observed and expected counts, and consider differences in proportions.
- Removing every flagged variant automatically. A test flags an unusual pattern under assumptions; it does not diagnose the reason. Review the counts and corroborating QC evidence before deciding.
- Using a Pearson approximation with sparse expectations. Small expected counts can make its reference distribution unreliable. Use an exact HWE test when the count pattern calls for it.
- Assuming the population model must fit every control sample perfectly. The test depends on population and sampling assumptions. A departure can reflect a mismatch between those assumptions and the sample as well as a technical issue.
These tests also have limited scope: they summarize genotype-count compatibility at a single locus and do not validate individual calls. The appropriate interpretation is therefore a diagnostic statement—how unusual the counts are under the specified model—followed by a decision about whether the evidence justifies further review.
Confirm that the analysis concerns diploid controls at an autosomal biallelic locus, and consider whether independent sampling and population homogeneity are plausible.
Estimate the allele frequency from the observed counts, calculate the HWE expectations, and use Pearson only when its approximation is suitable; otherwise use an exact test.
Report the p-value with the observed and expected counts, note the direction and scale of the difference, and treat a flag as a prompt for QC review rather than a verdict.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions below.
- Why is the p-value from a control-sample HWE test not the probability that a genotype call is erroneous?
- A test gives \(p=0.20\). What can you conclude, and what can you not conclude?
- For hypothetical controls with \(n=100\), estimated allele frequencies \(\hat{p}=0.5\) and \(\hat{q}=0.5\), what are the HWE expected counts? If observed counts are 30, 50, and 20, what is the Pearson statistic?
- Why might a modest proportional deviation produce a small p-value in a very large sample?
Solutions. (1) The p-value is calculated assuming the HWE null model and describes how often a result at least as extreme would occur under that model. It is not a probability about an individual call or about the null being true. (2) The test does not give strong evidence against HWE at common significance levels, but this does not prove equilibrium or establish that calls passed other QC checks. (3) Expected counts are \(100(0.5)^2=25\), \(100(2)(0.5)(0.5)=50\), and \(100(0.5)^2=25\). The Pearson statistic is \((30-25)^2/25+(50-50)^2/50+(20-25)^2/25=1+0+1=2\). (4) Larger samples provide more information to detect small departures, so a small proportional difference can yield substantial test evidence even when its practical size is modest.