Counts, proportions and tables · Choose a method
Mendelian ratios in mouse crosses: genotype counts, goodness of fit and partial lethality
Test pup genotype counts from a heterozygous cross against 1:2:1, report knockout viability with a confidence interval, and plan enough pups: in simulation, losing a quarter of knockouts went undetected in most studies of 160 pups.
On this page
Quick answer. To ask whether a heterozygous × heterozygous cross gives the expected 1 wild-type : 2 heterozygous : 1 knockout, count genotypes in every pup and compare the counts with 1:2:1 (a chi-square goodness-of-fit test, or an exact test when any expected count is below 5). Because the usual question is whether knockouts die, also test the knockout count against one quarter of pups, and report knockout viability relative to wild-type littermates with a 95% confidence interval. A non-significant test does not show that the line is viable: in a simulation of crosses genotyped at weaning, when knockouts survived at 75% of their littermates’ rate, about 160 pups detected it in only 20–28% of studies, and about 320 pups in 38–55% of studies.
Terms used below. p-value: the probability of counts at least this far from the expected ratio if the ratio were true. Intercross: a heterozygous × heterozygous mating. Transmission ratio distortion: one allele passing to offspring more often than the expected half. Exact 95% CI: a Clopper–Pearson interval, computed from the binomial distribution. Degrees of freedom: the number of classes minus one for a goodness-of-fit test (2 for three genotypes). Genotype ratio: the proportions of wild-type, heterozygous and knockout offspring; Mendel’s expectation for a heterozygous × heterozygous cross is 1:2:1. Goodness-of-fit test: a test of observed counts against expected proportions. Exact test: a test that computes the probability of the observed counts directly instead of from the chi-square approximation; the binomial test does this for two classes and the multinomial test for three or more. Partial (incomplete) lethality: some, but not all, knockouts die before genotyping. Relative viability: knockout count ÷ wild-type count, which is 1 when knockouts survive as well as wild-types. 95% confidence interval (CI): the range of values compatible with the data. Power: the chance of detecting an effect that is really there. False positive: a “significant” result when there is no real effect.
Which analysis for your question
| Question | Analysis | Report |
|---|---|---|
| Do genotypes follow 1:2:1? | Chi-square goodness of fit (2 degrees of freedom), or the exact multinomial test, which is required when any expected count is below 5 and preferred by McDonald below 1,000 pups (in the example, p = 0.54 against 0.50) | Counts observed and expected, chi-square and p |
| Are knockouts lost before genotyping? | Exact binomial test of knockouts against 1/4 of pups, and knockout ÷ wild-type with an exact 95% CI | Relative viability with 95% CI, n pups and litters |
| Is the line lethal (no knockouts)? | Zero knockouts: the chance of none among n pups is 0.75 to the power n (28 pups: 0.00032, one-sided), and the two-sided exact binomial p from the code below is 0.00061 for 28 pups; the International Mouse Phenotyping Consortium (IMPC) called a line lethal with no homozygotes among at least 28 pups before weaning (p < 0.001, Fisher’s exact test). Code: binom.test(0, n, 0.25) in R, stats.binomtest(0, n, 0.25) in Python |
Number of pups and litters screened; this rule detects complete lethality, not partial loss |
| Heterozygote × wild-type cross (expected 1:1) | Exact binomial test against 1/2 | Proportion with 95% CI |
| Sex ratio or transmission ratio distortion | The same goodness-of-fit test against 1:1 (or 1:2:1 in an intercross); the exact (binomial or multinomial) test when any expected count is below 5 | Counts and p |
| Comparing viability between two lines or stages | Knockout proportion in each, compared with a 2 × 2 test (chi-square vs Fisher’s exact test) | Difference with 95% CI |
McDonald’s handbook describes the goodness-of-fit test as comparing “the observed counts of observations in each category with the expected counts, which you calculate using some kind of theoretical expectation (such as a 1:1 sex ratio or a 1:2:1 ratio in a genetic cross)”, notes that “the usual rule of thumb is that you should use the exact test when the smallest expected value is less than 5”, and recommends “the exact test when the total sample size is less than 1000” (McDonald 2014). His power example shows how many offspring a subtle deviation needs: to detect 5% more heterozygotes than expected in a 1:2:1 cross with 80% power, “your result should be a total sample size of 964”; that number is for a subtle excess of heterozygotes, not for lost knockouts, which the simulation below covers. The International Mouse Phenotyping Consortium defined lethality as “the absence of homozygous mice after screening of at least 28 pups (p<0.001 Fisher’s exact test) prior to weaning” (Dickinson et al. 2016).
Worked example: knockouts that survive at 60% of their littermates’ rate
Constructed data: 12 heterozygous × heterozygous litters of 5 to 10 pups at birth, genotyped at weaning (postnatal day 21). Every pup survives to weaning with probability 0.95, and knockouts survive with 60% of that probability (0.57), so by design knockouts survive at 60% of their littermates’ rate. The data’s random seed was the first one tried and was not chosen for its result. Stored code and data: pups.csv, model.py, make_data.py, analysis.py, analysis.R and the analysis output; analysis.py and analysis.R print the same output.
The 71 weaned pups were 17 wild-type, 40 heterozygous and 14 knockout, against 17.75, 35.5 and 17.75 expected.
| Analysis of constructed data with knockout survival at 60% of the littermates’ rate (built in) | Result |
|---|---|
| A. Chi-square goodness of fit to 1:2:1 | chi2(2) = 1.39, p = 0.50 |
| B. Exact multinomial test of 1:2:1 | p = 0.54 |
| C. Exact binomial test, knockouts against 1/4 of pups | 14 of 71 (19.7%), p = 0.34 |
| D. Knockout viability relative to wild-type littermates | 0.82 (exact 95% CI 0.38 to 1.78); compatible with both normal viability and large loss |
No test detected the lethality that was built in. Writing “genotypes followed Mendelian ratios (p = 0.50)” would be wrong; the confidence interval in D says the data are compatible with anything from knockouts surviving at 38% of the wild-type rate to 178% of it. Across 5,000 simulated breeding studies per row (simulation.py, the simulation output):
| Scenario (heterozygous × heterozygous, genotyped at weaning) | Mean pups | A. Chi-square 1:2:1 | C. Knockouts vs 1/4 | D. Relative viability (knockouts vs wild-type) |
|---|---|---|---|---|
| No lethality, 12 litters (false positives) | 85 | 5.0% | 4.2% | 3.5% |
| Knockouts survive at 75%, 12 litters | 80 | 12.2% | 14.2% | 10.8% |
| Knockouts survive at 75%, 24 litters | 160 | 22.6% | 27.9% | 20.0% |
| Knockouts survive at 75%, 48 litters | 321 | 43.8% | 54.7% | 38.3% |
| Knockouts survive at 50%, 12 litters | 75 | 48.5% | 57.3% | 40.1% |
| Knockouts survive at 50%, 24 litters | 149 | 83.1% | 89.3% | 73.9% |
These percentages describe this simulated design (litters of 5 to 10, 95% survival of non-knockouts), not every breeding colony. With 6 or more litters, all three tests kept false positives near 5% (2.9–5.2%); with only 2 litters (about 14 pups) they stayed at or below 5% (chi-square 4.0%, exact multinomial 4.2%, knockouts vs wild-type 1.6%), but a study that small has almost no power. The binomial test of knockouts against one quarter was the most sensitive to lost knockouts, because it asks only about the class that dies; the chi-square test spreads its attention over all three classes. Losing half of the knockouts was detected in most studies of about 150 pups. Losing a quarter was missed in most studies of about 320 pups by the chi-square and viability tests, and in 45% of them by the binomial test.
The tests treat each pup as an independent draw, which holds for genotypes in a Mendelian cross when survival does not cluster by litter; if losses cluster in some litters (one dam with poor transmission, or a litter lost before genotyping), look at the counts per litter and analyse knockouts per litter with litters as units (litter effects). For an X-linked allele, sexes differ in expected ratios, so test males and females separately. The code expects one row per genotyped pup with columns litter, pup, sex (exactly male or female) and genotype (labels exactly wild-type, heterozygous and knockout); pups that died before genotyping have no genotype, so count them separately and report them. Relative viability is undefined when no wild-type pup was genotyped. The exact multinomial test is in analysis.py and analysis.R; the blocks below reproduce the other tests. Rename your labels to match, save the table as pups.csv (or change the file name in the code), and run the code in that folder (python analysis.py or Rscript analysis.R). Python needs pandas and SciPy 1.7 or later (pip install pandas scipy); the R code uses base R only.
import pandas as pd
from scipy import stats
d = pd.read_csv("pups.csv"); n = d.genotype.value_counts()
assert set(d.genotype) <= {"wild-type", "heterozygous", "knockout"}, set(d.genotype) # labels must match exactly
wt, het, ko = (int(n.get(g, 0)) for g in ("wild-type", "heterozygous", "knockout")); total = wt + het + ko
c = stats.chisquare([wt, het, ko], [total / 4, total / 2, total / 4]) # 1:2:1 goodness of fit
b = stats.binomtest(ko, total, 0.25) # knockouts against 1/4
assert wt > 0, "no wild-type pups: relative viability is undefined"
r = stats.binomtest(ko, ko + wt, 0.5); ci = r.proportion_ci(method="exact"); v = lambda q: q / (1 - q)
print(f"chi-square p = {c.pvalue:.2g}; knockouts {ko} of {total}, p = {b.pvalue:.2g}")
print(f"knockout / wild-type {v(ko / (ko + wt)):.2f} (95% CI {v(ci.low):.2f} to {v(ci.high):.2f})")
# chi-square p = 0.5; knockouts 14 of 71, p = 0.34
# knockout / wild-type 0.82 (95% CI 0.38 to 1.78)
d <- read.csv("pups.csv"); stopifnot(all(d$genotype %in% c("wild-type", "heterozygous", "knockout"))) # labels must match exactly
n <- table(factor(d$genotype, levels = c("wild-type", "heterozygous", "knockout")))
chisq.test(n, p = c(1, 2, 1) / 4) # 1:2:1 goodness of fit: X-squared = 1.39, p = 0.5
binom.test(n[["knockout"]], sum(n), 0.25) # knockouts against 1/4: 14 of 71, p = 0.34
r <- binom.test(n[["knockout"]], n[["knockout"]] + n[["wild-type"]]); v <- function(q) q / (1 - q)
round(c(v(r$estimate), v(r$conf.int)), 2) # knockout / wild-type 0.82, 95% CI 0.38 to 1.78
Before you analyse
- Record the stage of genotyping (embryonic day, birth or weaning) and count every pup born, including those found dead before genotyping; lethality can happen before birth, between birth and weaning, or later.
- Genotype every pup in every litter, not a selection, and keep the litter ID with each pup.
- Decide the question and the primary test before counting: for knockout loss, the binomial test against one quarter is the sharper test; report the others as supporting results, because trying several tests and keeping the smallest p raises the false-positive rate.
- Plan the number of pups for the loss you want to detect: in our simulation, losing half of the knockouts was detected in most studies of about 150 pups, and losing a quarter needed more than 320 pups.
- Report relative viability with its confidence interval, not only a p-value, so that a reader can see which losses the data exclude.
Check what an AI assistant ran
- The assistant concluded “Mendelian” from a non-significant chi-square test. Ask for knockout viability with its 95% CI and the number of pups.
- The assistant ran a chi-square test with expected counts below 5. Ask for the exact test.
- The assistant compared knockout numbers between litters or groups with a t-test on percentages. Ask for the counts and a test for counts.
- The assistant did not say when pups were genotyped. Ask for the stage and for pups lost before genotyping.
Report it
Offspring of [12] heterozygous × heterozygous matings were genotyped at [postnatal day 21] ([71] pups; [n] further pups born died before genotyping). Genotype counts were compared with the expected 1:2:1 ratio by a chi-square goodness-of-fit test, knockouts were compared with the expected one quarter by an exact binomial test, and knockout viability was expressed relative to wild-type littermates with an exact 95% confidence interval (R [4.3.3]).
In the constructed example, in which knockouts survive at 60% of their littermates’ rate, genotypes were [17] wild-type, [40] heterozygous and [14] knockout (chi-square p = [0.50]; knockouts against one quarter p = [0.34]); knockout viability relative to wild-type was [0.82] (95% CI [0.38] to [1.78]), so the data neither confirm nor exclude substantial loss.
Replace the bracketed values with your own.
References
- McDonald JH (2014). Handbook of Biological Statistics, 3rd ed. Sparky House Publishing. Chi-square test of goodness-of-fit. biostathandbook.com/chigof.html
- Dickinson ME, Flenniken AM, Ji X, et al. (2016). High-throughput discovery of novel developmental phenotypes. Nature 537:508–514. doi:10.1038/nature19356
How this page was made
- Written and published by Licklider. Recommendations cite peer-reviewed methods papers, a statistics handbook and consortium documentation listed under References; cited passages were checked against the source text.
- The worked example uses constructed data. Its numbers were produced by stored code (Python 3.13 with SciPy 1.18.1; R 4.3.3, base R), and the two languages print identical output; the simulation was run in Python.
- Separate review passes checked the statistics, the citations and readability before publication.