Tutorials › High-Dimensional Genomic Data Analysis › Hardy-Weinberg Deviations in Cases

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

Hardy-Weinberg Deviations in Cases

See how disease association can change Hardy–Weinberg proportions among cases, and work through a case-control comparison that distinguishes a case-only deviation from a control result.

Intermediate 11 min read

What You'll Learn

  • Derive case genotype proportions by conditioning on disease status.
  • Identify when genotype-dependent disease risk produces Hardy–Weinberg disequilibrium in cases.
  • Recognize the multiplicative-risk exception, where cases can remain in equilibrium.
  • Calculate and compare case and control Hardy–Weinberg statistics.
  • Explain why a case-only deviation does not by itself establish a genotyping problem.

Why Case Genotypes Need Not Follow Hardy–Weinberg Proportions

A Hardy–Weinberg check asks whether genotype proportions are consistent with random union of alleles at a locus, given the allele frequency in the group being examined. Among controls, a substantial departure can be a useful quality-control signal. Among cases, however, disease status itself may change the genotype distribution: if genotype affects disease risk, selecting people because they have the disease also selects genotypes unequally.

This distinction matters in a case-control study. A case-only deviation is not automatically evidence that genotype calls are wrong. It may reflect the biological association being studied. Conversely, the fact that a disease association can affect cases does not mean every case-only deviation is genuine or that every disease model must produce one. The relationship depends on how risk varies across genotypes.

Definition: Let the effect allele have frequency \(p\) in the source population and let \(q=1-p\). Under Hardy–Weinberg equilibrium (HWE), the genotype proportions for zero, one, and two copies of the effect allele are \(q^2\), \(2pq\), and \(p^2\), respectively. A group is in HWE when its genotype proportions follow these proportions for that group’s allele frequency.

For this tutorial, assume a biallelic autosomal locus, correctly classified case and control status, and a source population in HWE before selection into cases or controls. Initially, also assume no population mixture or genotype-dependent participation. These assumptions let us isolate the effect of conditioning on disease status. The same logic applies if the effect allele is coded differently, provided the genotype labels and frequency are used consistently.

Conditioning on Disease Status

Let \(f_g=P(\text{case}\mid g)\) be the probability of being a case for genotype \(g\), where \(g=0,1,2\) is the number of effect alleles. In the source population, the genotype proportions are \(q^2,2pq,p^2\). Among cases, each source proportion is multiplied by its case probability and then normalized to make the proportions sum to one:

$$ P(g\mid \text{case}) = \frac{P(g)f_g}{\sum_{j=0}^{2}P(j)f_j}. $$

This is Bayes’ rule applied to each genotype. If the \(f_g\) values differ, the case distribution is reweighted relative to the source population. Its allele frequency must then be recalculated from the case genotypes; it is not generally the source-population frequency \(p\). HWE expectations for cases are based on that recalculated frequency.

Key result: Genotype-dependent disease risk can make cases depart from HWE, even when the source population is in HWE and genotypes are measured without error. Whether it does depends on the pattern of risk across the three genotypes; an association does not guarantee a departure.

The key comparison is between the reweighted case proportions and the HWE proportions calculated using the case allele frequency. A shift in allele frequency alone is not an HWE departure: the genotype proportions could shift while continuing to satisfy HWE at the new frequency.

Worked Example: Reweighting Source Genotypes Into Cases

Suppose the effect allele has source frequency \(p=0.20\), so \(q=0.80\). The source population is in HWE, giving genotype proportions \(0.64, 0.32, 0.04\) for genotypes \(0,1,2\). Suppose the respective probabilities of being a case are \(f_0=0.01\), \(f_1=0.02\), and \(f_2=0.08\). These hypothetical risks increase with the number of effect alleles.

Multiply each source proportion by its case probability. The unnormalized case weights are \(0.64(0.01)=0.0064\), \(0.32(0.02)=0.0064\), and \(0.04(0.08)=0.0032\). Their sum is \(0.0160\), the overall case probability under this model.

$$ P(g\mid\text{case})=(0.0064,0.0064,0.0032)/0.0160 =(0.40,0.40,0.20). $$

The effect-allele frequency among cases is \(p_{\text{case}}=(0.40+2(0.20))/2=0.40\). HWE at this frequency would predict proportions \(0.60^2=0.36\), \(2(0.60)(0.40)=0.48\), and \(0.40^2=0.16\). The actual case proportions, \(0.40,0.40,0.20\), do not match those expectations. Thus disease-related selection has produced case HWE disequilibrium under the specified model.

Comparing Cases and Controls in a Case-Control Study

In a case-control sample, cases and controls are often sampled in numbers chosen by the study design, rather than in proportion to disease prevalence. That design choice does not change genotype proportions within the case group or within the control group, assuming sampling within each disease-status group does not depend on genotype. It does mean that the combined sample should not be treated as a source-population sample for this calculation.

For controls, the analogous conditional probability is \(P(g\mid\text{control})=P(g)(1-f_g)/\sum_{j=0}^{2}P(j)(1-f_j)\). The control genotype proportions can therefore differ from the source proportions too, although for a rare disease the difference may be small. The case and control tests should be carried out separately, using each group’s own estimated allele frequency.

For observed genotype counts \(O_0,O_1,O_2\) among \(n\) individuals, estimate the effect-allele frequency as \(\hat p=(O_1+2O_2)/(2n)\), and set \(\hat q=1-\hat p\). The HWE expected counts are \(n\hat q^2,2n\hat p\hat q,n\hat p^2\). The Pearson statistic is the sum of \((O-E)^2/E\) over the three genotypes; with the allele frequency estimated from the same counts, the usual large-sample reference has \(df=1\). The Pearson approximation requires expected counts large enough for that approximation to be reliable; an exact HWE test is an alternative when counts are sparse.

Worked Example: A Case Deviation With Controls Near HWE

Use the hypothetical risk model from the previous example. Consider 1,000 cases with counts \(400,400,200\) for genotypes \(0,1,2\), and 1,000 controls with counts \(644,319,37\). The counts are hypothetical and are chosen to illustrate a case-control comparison. First check each group using its own allele-frequency estimate.

Cases. The case frequency estimate is \(\hat p=(400+2(200))/2000=0.4000\), so \(\hat q=0.6000\). The expected counts are \(1000(0.60^2)=360\), \(1000(2(0.60)(0.40))=480\), and \(1000(0.40^2)=160\). Therefore,

$$ X^2_{\text{cases}} =\frac{(400-360)^2}{360} +\frac{(400-480)^2}{480} +\frac{(200-160)^2}{160} =4.444+13.333+10.000 =27.78. $$

With \(df=1\), this is strong evidence of case HWE departure under the Pearson approximation (\(p<0.001\)). The statistic describes a mismatch with HWE at the case allele frequency; by itself, it does not identify the cause.

Controls. The control frequency estimate is \(\hat p=(319+2(37))/2000=0.1965\), and \(\hat q=0.8035\). The expected counts are approximately \(645.6,315.8,38.61\). Thus,

$$ X^2_{\text{controls}} =\frac{(644-645.6)^2}{645.6} +\frac{(319-315.8)^2}{315.8} +\frac{(37-38.61)^2}{38.61} \approx 0.104. $$

With \(df=1\), this statistic is small (approximately \(p=0.75\)); the controls show no evidence of HWE departure in this example. All three expected counts exceed five, so the usual Pearson approximation is reasonable here. The contrast—a strong case deviation and a control result close to HWE—is compatible with the specified disease-risk mechanism. It is not proof that the association is genuine or that technical problems are absent.

A Useful Exception: Multiplicative Genotype Weights

A disease association need not create case disequilibrium. Suppose the probabilities of being a case are proportional to \(1,r,r^2\) for genotypes \(0,1,2\), respectively, for some positive \(r\). These weights act multiplicatively per effect allele. Applying them to source HWE proportions gives unnormalized weights \(q^2,2pqr,p^2r^2\). These are the HWE proportions formed from the allele weights \(q\) and \(pr\), before normalization:

$$ q^2+2pqr+p^2r^2=(q+pr)^2. $$

After division by \((q+pr)^2\), the case proportions are HWE proportions with effect-allele frequency \(p'=pr/(q+pr)\). Thus this particular pattern of case weighting changes the allele frequency but preserves HWE exactly. This is a mathematical exception, not a general claim that common disease-association models always preserve HWE: actual probabilities of being affected, and the sampling scheme, determine the relevant weights.

Worked Example: Association Without Case Disequilibrium

Suppose the source frequency is \(p=0.30\), \(q=0.70\), and the case probabilities are proportional to \(1,2,4\) for genotypes \(0,1,2\). This is a genuine genotype-related risk pattern, but its weights are multiplicative, with \(r=2\).

The unnormalized case weights are \(0.70^2=0.49\), \(2(0.70)(0.30)(2)=0.84\), and \(0.30^2(4)=0.36\). Their total is \(1.69=(0.70+0.30(2))^2\). The normalized proportions are approximately \(0.2899,0.4970,0.2130\). The transformed allele frequency is \(p'=0.30(2)/(0.70+0.30(2))=0.4615\), with \(q'=0.5385\).

HWE at \(p'=0.4615\) predicts \(q'^2\approx0.2899\), \(2p'q'\approx0.4970\), and \(p'^2\approx0.2130\), matching the normalized case proportions. The association shifts the case allele frequency, but does not produce case HWE disequilibrium under these exact weights.

Checks, Failure Modes, and Interpretation

A case-control comparison is most informative when the groups are examined separately and the sampling and risk assumptions are made explicit. Before interpreting a departure, check that genotype counts use the same allele and genotype coding in both groups, that allele frequency was estimated separately in each group, and that the expected counts support the chosen test. A case-control imbalance in sample size does not justify pooling the groups for a single HWE test.

Other features can complicate the clean mechanism above. Population substructure can produce non-HWE genotype proportions within a combined group even if subgroups are each in HWE. Genotyping error, relatedness, selection into the study, and missingness can also affect observed counts. These possibilities mean that a case-only departure is compatible with a genuine association, not diagnostic of one. Likewise, a control group close to HWE is reassuring for this particular check but does not rule out all data-quality problems or establish the absence of association.

A common mistake is to say, “The cases fail HWE, so the variant must be a bad call.” That reasoning ignores disease-dependent selection: if genotype affects case probability, case frequencies are reweighted, and the resulting case proportions need not satisfy HWE. The correction is to compare cases and controls separately, assess whether the observed pattern is plausible under genotype-dependent risk, and consider technical and sampling explanations before making a quality-control decision. A case-only HWE test is not itself a test of association, because both a genuine association and other mechanisms can produce departures.

Key takeaway: Start from the source genotype proportions, reweight them by the probability of being a case or control, and then compare the resulting group proportions with HWE expectations at that group’s allele frequency. Disease association can produce case disequilibrium, but it need not.

Check Your Understanding

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

  1. A source population is in HWE. What quantity must be used to reweight each genotype when calculating the case genotype distribution?
  2. For source frequency \(p=0.10\), a case group has 100 individuals with counts \(64,32,4\) for genotypes \(0,1,2\). Calculate \(\hat p\) and the HWE expected counts.
  3. Why should a case HWE check use the case allele frequency rather than the source-population allele frequency?
  4. Can genotype-dependent disease risk change the case allele frequency without producing case HWE disequilibrium? Explain briefly.
  5. In a case-control study, why is pooling cases and controls for one HWE test generally inappropriate?

Solutions. (1) Multiply each source genotype proportion by its genotype-specific case probability, then divide by the sum of the three weighted proportions. (2) \(\hat p=(32+2(4))/200=0.20\), so \(\hat q=0.80\). The expected counts are \(100(0.80^2)=64\), \(100(2(0.80)(0.20))=32\), and \(100(0.20^2)=4\). (3) HWE expectations describe the group being tested; conditioning on case status can change its allele frequency. (4) Yes. Multiplicative genotype weights proportional to \(1,r,r^2\) shift the allele frequency while preserving HWE. (5) Case and control groups have been selected by different disease-status conditions, so their genotype distributions need not share one allele frequency or one HWE-generating population.

Clinical Biostats