Biology, Genetics & Clinical Lab Genetics & Heredity Direct gene counting; Wright's fixation index F-IS

Allele Frequency Calculator

Enter how many individuals in your sample carry each of the three genotypes and this calculator counts alleles directly: it returns the two allele frequencies p and q, the minor allele frequency, the observed genotype frequencies, the observed and Hardy-Weinberg-expected heterozygosity, and Wright's inbreeding coefficient FIS, which measures how far your sample sits from random mating. Unlike a Hardy-Weinberg estimate, gene counting makes no assumption about equilibrium — it is simply arithmetic on the genotypes you scored.

Calculator

This calculator runs in your browser. Enable JavaScript for live results — the inputs, formula and worked example below remain fully readable without it.

Inputs this calculator takes, with typical values
InputWhat to enterExample
Homozygous dominant (AA) individualsThe number of individuals genotyped as carrying two copies of the A allele.320
Heterozygous (Aa) individualsIndividuals with one copy of each allele — you need a genotyping assay, not a phenotype, to count these.460
Homozygous recessive (aa) individualsIndividuals carrying two copies of the a allele.220

It returns

  • Frequency of allele A (p) — Counted directly as (2·AA + Aa) ÷ 2N, with no equilibrium assumption.
  • Frequency of allele a (q)
  • Minor allele frequency (MAF) — The smaller of p and q — the figure genotyping platforms and variant databases report.
  • Observed heterozygosity (Ho)
  • Expected heterozygosity (He = 2pq)
  • Inbreeding coefficient F-IS — (He − Ho) ÷ He. Positive means fewer heterozygotes than expected, negative means more, zero means the sample matches Hardy-Weinberg.
  • Allele copies counted (2N)

The formula

p=2nAA+nAa2N
FIS=HeHoHe

In plain text: p = (2·n(AA) + n(Aa)) / 2N, q = 1 − p

  • pFrequency of allele A among all allele copies (decimal)
  • qFrequency of allele a; equal to 1 − p at a two-allele locus (decimal)
  • n(AA)Number of individuals homozygous for A (individuals)
  • n(Aa)Number of heterozygous individuals (individuals)
  • NTotal individuals genotyped (individuals)
  • 2NTotal allele copies, because each diploid individual carries two (alleles)

This is direct gene counting. It assumes only that the locus is autosomal, diploid and biallelic, and that each individual was genotyped rather than phenotyped.

Updated Category Genetics & Heredity Verified against published test cases Reading time 11 min

What allele frequency means and why you count alleles, not people

An allele frequency is the proportion of all copies of a gene in a population that are a particular variant. The unit of accounting is the allele copy, not the individual — and since every diploid individual carries two copies at an autosomal locus, a sample of N people contributes 2N allele copies.

That distinction does all the work. A heterozygote contributes one copy of each allele, so it counts once towards p and once towards q. A homozygote contributes two copies of the same allele. Add them up and the frequency of A is (2 × the number of AA individuals + the number of Aa individuals) divided by 2N. Nothing else is involved: no equilibrium assumption, no square root, no model.

This is the key difference from a Hardy-Weinberg estimate. Hardy-Weinberg infers allele frequencies from a phenotype frequency by assuming the population is in equilibrium. Gene counting measures them from genotypes and assumes nothing. That is why you can legitimately test a sample for Hardy-Weinberg equilibrium using frequencies obtained by counting, but not the other way round — using Hardy-Weinberg to derive the frequencies and then testing the same data for Hardy-Weinberg would be circular.

The formula, and the two heterozygosities it lets you compare

Write the counts as nAA, nAa and naa, with N their sum. Then p = (2nAA + nAa) ÷ 2N and q = (2naa + nAa) ÷ 2N. Computing both and checking that they sum to exactly 1 is a genuine arithmetic check on your counts; at a biallelic locus it must hold to the last digit.

The minor allele frequency is simply the smaller of the two. Variant databases and genotyping arrays report MAF rather than the frequency of a named allele because which allele is called the reference is an arbitrary choice of assembly, while which is rarer is a property of the population.

Two heterozygosity measures are worth separating. Observed heterozygosity Ho = nAa ÷ N is what you saw. Expected heterozygosity He = 2pq is what random mating at the frequencies you just counted would have produced. They answer different questions, and their ratio is informative in a way neither is alone.

Wright's FIS = (HeHo) ÷ He puts a number on the difference. It runs from +1, when every individual is homozygous despite both alleles being present, through 0 when the sample matches Hardy-Weinberg exactly, to −1, when every individual is heterozygous. Its sign is what you read first: positive means a heterozygote deficit, negative means a heterozygote excess. It is undefined when He = 0, which happens whenever the sample is fixed for a single allele — and that is a real result, not an error.

Worked example: 1,000 individuals genotyped at one locus

You genotype 1,000 individuals and score 320 AA, 460 Aa and 220 aa.

  1. Total the individuals. N = 320 + 460 + 220 = 1,000.
  2. Total the allele copies. 2N = 2,000.
  3. Count copies of A. Each AA gives two, each Aa gives one: (2 × 320) + 460 = 640 + 460 = 1,100.
  4. Count copies of a. (2 × 220) + 460 = 440 + 460 = 900. Check: 1,100 + 900 = 2,000. ✓
  5. Divide. p = 1,100 ÷ 2,000 = 0.55; q = 900 ÷ 2,000 = 0.45. They sum to 1.00. ✓
  6. Minor allele frequency. The smaller of the two: 0.45.
  7. Observed heterozygosity. Ho = 460 ÷ 1,000 = 0.460, or 46.0%.
  8. Expected heterozygosity. He = 2 × 0.55 × 0.45 = 0.495, or 49.5%.
  9. Inbreeding coefficient. FIS = (0.495 − 0.460) ÷ 0.495 = 0.035 ÷ 0.495 = 0.0707.
  10. Expected counts. AA: 0.552 × 1,000 = 302.5. Aa: 0.495 × 1,000 = 495. aa: 0.452 × 1,000 = 202.5. These sum to 1,000. ✓

Read the result. You observed 460 heterozygotes where 495 were expected, a shortfall of 35, and 320 AA where 302.5 were expected, a surplus of 17.5 — with a matching surplus of 17.5 in the aa class. The alleles have not changed; they have been repackaged, 35 heterozygotes' worth of them, into homozygotes. FIS = 0.071 says that shortfall is about 7% of the expected heterozygosity. Whether a departure of that size is more than sampling would produce is a question for the chi-square goodness-of-fit test, not for the coefficient itself.

How to read p, MAF and the sign of F-IS

Allele frequency has no good or bad value. A frequency of 0.55 is not better or worse than 0.02; it is a description of one population at one locus. What is interpretable is a comparison — the same locus in two populations, or the same population over time.

Minor allele frequency is the number with conventional thresholds. Human genetics has long used a MAF of 0.01 as the working boundary between a common polymorphism and a rare variant, and genome-wide association studies routinely filter out variants below 0.01 or 0.05 because power to detect an effect collapses at very low frequencies. Those thresholds are analytical conventions, not properties of the genome, and different consortia set them differently.

Read the sign of F-IS before its magnitude. A positive value means heterozygotes are scarcer than random mating predicts. The classical explanation is inbreeding, and for a population of pure self-fertilisers FIS heads towards 1. But two duller explanations are far more common in real data: pooling two subpopulations that differ in allele frequency, which produces a heterozygote deficit called the Wahlund effect, and allele dropout in the assay, where a failed amplification turns a true heterozygote into an apparent homozygote. Before you conclude anything about mating systems, rule out the assay.

A negative F-IS is not an error. It means an excess of heterozygotes, produced by recent admixture between differentiated groups, by negative assortative mating, by selection favouring heterozygotes, or simply by small-sample noise — in a sample of 20 individuals, FIS bounces around zero by several hundredths from nothing but chance. The value is bounded below by −1 and above by +1, and it hits those bounds only in the extreme cases where every individual is heterozygous or none is.

Genotype counts, heterozygosity and F-IS at a fixed p of 0.5

Every row holds N = 1,000 individuals and p = q = 0.50, so expected heterozygosity is 2pq = 0.500 throughout. Only the packaging of the alleles into genotypes changes.
AAAaaaObserved HoExpected HeF-ISPattern
01,00001.0000.500−1.000Every individual heterozygous — an F1 bulk
1507001500.7000.500−0.400Marked heterozygote excess
2505002500.5000.5000.000Exactly Hardy-Weinberg
3004003000.4000.5000.200Moderate heterozygote deficit
3752503750.2500.5000.500Severe deficit, typical of heavy inbreeding
50005000.0000.5001.000No heterozygotes at all

Every row contains exactly 1,000 copies of A and 1,000 copies of a. Allele frequency alone cannot distinguish these populations; only the genotype counts can.

Mistakes that corrupt an allele frequency estimate

  • Dividing by N instead of 2N. The denominator counts allele copies, not individuals. Using N doubles every frequency and breaks the check that p + q = 1.
  • Forgetting that heterozygotes contribute to both alleles. Each Aa individual adds one copy to the A total and one to the a total; it is not neutral.
  • Counting phenotypes instead of genotypes. Under complete dominance you cannot see the difference between AA and Aa, so a phenotype tally cannot support gene counting. That case needs the Hardy-Weinberg route and its assumptions.
  • Applying it unchanged to X-linked or haploid loci. Males carry a single X, so the denominator is 2 × females + males, not 2N. Mitochondrial and chloroplast loci are haploid and uniparentally inherited.
  • Pooling samples from distinct populations. Combining two groups with different allele frequencies produces a heterozygote deficit that has nothing to do with mating within either group.
  • Ignoring missing genotypes. Individuals who failed to genotype must be excluded from N, and if failure is correlated with genotype the estimate is biased, not merely noisier.
  • Reading F-IS as a significance test. It is an effect size. A value of 0.07 in 20 individuals means almost nothing; the same value in 5,000 is a strong signal. Test it separately.

Gene counting is the first step in nearly every population-genetic analysis, and the numbers it produces feed directly into the next ones. Once you have p and q you can generate Hardy-Weinberg expectations and test them formally with the genetics chi-square goodness-of-fit calculator, which uses one fewer degree of freedom than a standard goodness-of-fit test because an allele frequency was estimated from the same data.

If you only have a disease incidence rather than genotype counts — the usual situation for a recessive condition, where heterozygotes are invisible — you cannot count genes and must infer them instead through the Hardy-Weinberg equilibrium calculator. If your question is about a specific mating rather than a population, use the Punnett square probability calculator, and if it is about the risk to a particular couple's child, the autosomal recessive carrier risk calculator.

FIS is one of three Wright fixation indices. FIT compares individuals to the total population and FST compares subpopulations to the total, which is the standard measure of population differentiation. This calculator reports FIS only, because it is the one that a single sample at a single locus can support.

Key terms

Allele copy
One physical instance of a gene variant. A diploid individual carries two at each autosomal locus, which is why the denominator of an allele frequency is 2N.
Minor allele frequency (MAF)
The frequency of the less common allele at a locus. Reported by variant databases because it does not depend on which allele the reference assembly happens to carry.
Observed heterozygosity (Ho)
The proportion of individuals actually scored as heterozygous — a direct count, requiring no model.
Expected heterozygosity (He)
2pq, the heterozygote frequency random mating would produce at the counted allele frequencies. Also called gene diversity.
F-IS
Wright's inbreeding coefficient within a subpopulation, (He − Ho)/He. Positive for a heterozygote deficit, negative for an excess, bounded by −1 and +1.
Allele dropout
A genotyping failure in which one allele does not amplify, so a true heterozygote is called as a homozygote. It inflates F-IS and is a leading cause of apparent heterozygote deficits.

Frequently asked questions

How do I calculate allele frequency from genotype counts?

Count allele copies and divide by 2N. Each homozygote contributes two copies of its allele and each heterozygote contributes one of each, so p = (2 × AA + Aa) ÷ 2N. With 320 AA, 460 Aa and 220 aa, that is (640 + 460) ÷ 2,000 = 0.55. Compute q the same way rather than as 1 − p the first time, and check the two sum to exactly 1 — it catches counting slips immediately.

What is the difference between allele frequency and genotype frequency?

Allele frequency counts gene copies out of 2N; genotype frequency counts individuals out of N. In the worked example the genotype frequency of Aa is 460 ÷ 1,000 = 0.46, while the allele frequency of A is 1,100 ÷ 2,000 = 0.55. Different populations can share allele frequencies while having completely different genotype frequencies, which is exactly what F-IS measures.

What counts as a normal minor allele frequency?

Any value from just above zero to 0.5, since MAF is by definition the smaller of the two frequencies and cannot exceed one half. Human genetics conventionally treats variants above 0.01 as common polymorphisms and those below as rare, and association studies often filter at 0.01 or 0.05 because statistical power falls away sharply below that. These are analysis conventions rather than biological boundaries.

Can F-IS be negative, and what does that mean?

Yes, down to −1. A negative value means you observed more heterozygotes than random mating at those allele frequencies would produce. Real causes include recent admixture between two differentiated groups, mating systems that avoid like-with-like, and selection favouring heterozygotes. Small samples also drift negative or positive by chance, so treat a small negative value in a small sample as noise until you have tested it.

Why can I not use this calculator with phenotype counts?

Because under complete dominance the AA and Aa individuals look identical, so you cannot fill in the first two boxes. Gene counting needs a genotyping assay. If all you have is the frequency of the recessive phenotype, you must assume Hardy-Weinberg equilibrium and take a square root instead — which is a genuinely different calculation resting on assumptions this one does not need.

How large a sample do I need?

The standard error of an estimated allele frequency is √(pq ÷ 2N), so at p = 0.5 a sample of 100 individuals gives an error of about 0.035 and a sample of 1,000 about 0.011. Quadrupling the sample halves the error. For rare alleles the binding constraint is different: you need enough individuals that the rare allele appears at least several times, which for a MAF of 0.01 means hundreds of people before the estimate stabilises.

Does a large F-IS prove inbreeding?

No. A heterozygote deficit is consistent with inbreeding but also with pooled population structure, non-random sampling, null alleles and allele dropout in the assay. Check the assay first: if the deficit appears at only some loci it points to a technical cause, while genuine inbreeding depresses heterozygosity across the whole genome. Comparing the pattern across many loci is what distinguishes the two.

What happens if one genotype class has zero individuals?

The arithmetic still works. Zero heterozygotes gives Ho = 0 and, if both homozygotes are present, F-IS = 1. Zero of both homozygous classes gives Ho = 1 and F-IS = −1. The only genuinely undefined case is a sample fixed for one allele: then He = 0, the F-IS denominator vanishes, and the calculator returns a dash rather than a number, which is the honest answer.

References

  • Principles of Population Genetics, 4th ed. — Hartl & Clark, Sinauer Associates
  • The genetical structure of populations, Annals of Eugenics 15:323-354 (1951) — Sewall Wright
  • An Introduction to Genetic Analysis, 12th ed. — Griffiths, Wessler, Carroll & Doebley, W. H. Freeman