Skip to main content

Allele Frequency Calculator

Ready to calculate
Hardy-Weinberg.
χ² HWE Test.
p & q Frequency.
100% Free.
Privacy Secure.

How it Works

01Count Genotypes

Enter counts of AA, Aa, and aa individuals in your population.

02Frequency Calculation

p and q allele frequencies computed using Hardy-Weinberg formula.

03Expected Genotypes

Expected AA (p²), Aa (2pq), and aa (q²) genotype counts.

04HWE Chi-Square Test

Automatic χ² test to determine if population is in Hardy-Weinberg equilibrium.

What Is the Allele Frequency Calculator?

Population genetics depends on knowing the frequency of alleles and genotypes within a breeding population. The Allele Frequency Calculator computes allele frequencies p and q, expected Hardy-Weinberg genotype frequencies, and performs a chi-square test for Hardy-Weinberg equilibrium (HWE) — the foundational analysis used in genetics research, conservation biology, plant and animal breeding, and human population genetics.

Hardy-Weinberg equilibrium is the null hypothesis of population genetics: in a large, randomly mating population without selection, mutation, migration, or genetic drift, allele and genotype frequencies remain constant across generations. Departures from HWE indicate evolutionary forces are acting on the locus, population substructure exists, or genotyping errors occurred — each a significant finding in research and applied genetics.

Allele Frequency Calculation

For a biallelic locus with observed genotype counts AA, Aa, and aa: total alleles = 2 times (AA + Aa + aa); p frequency of A = (2 times AA + Aa) divided by total alleles; q = 1 minus p. This direct counting method is unambiguous for codominant markers where heterozygotes are distinguishable from both homozygotes.

Hardy-Weinberg Expected Frequencies

Under HWE: expected AA = p squared times N; expected Aa = 2pq times N; expected aa = q squared times N, where N is total genotype count. Comparing observed to expected genotype counts reveals whether the population is in equilibrium at this locus.

Chi-Square HWE Test

The chi-square statistic with one degree of freedom tests whether observed genotype counts deviate significantly from HWE expectations. Chi-square equals the sum of (observed minus expected) squared divided by expected across all three genotype classes, minus one degree of freedom correction. A p-value below 0.05 indicates significant departure from HWE, prompting investigation of population structure, selection, inbreeding, or data quality issues.

Applications in Plant and Animal Breeding

Plant breeders use allele frequency to track the frequency of favorable quantitative trait loci (QTL) alleles across selection cycles. Animal breeders monitor deleterious recessive allele frequencies to manage genetic disease risk. Conservation geneticists use HWE departure to detect inbreeding depression in small captive or wild populations.

Human Population Genetics

GWAS (Genome-Wide Association Studies) filter SNP markers using HWE p-values — markers with extreme HWE departure are flagged as likely genotyping errors or under strong selection, and are typically excluded from analysis to protect result validity. This calculator performs the same HWE test applied in PLINK, GEMMA, and other GWAS software pipelines.

How the Allele Frequency Calculator Works

Enter Genotype Counts

Input the observed number of AA homozygotes, Aa heterozygotes, and aa homozygotes from your population sample. These are raw counts, not frequencies.

Calculate Allele Frequencies

The calculator computes p (frequency of A allele) and q (frequency of a allele) using direct allele counting: p = (2*AA + Aa) / (2*N), q = 1 - p.

Compute Expected Genotypes

Hardy-Weinberg expected counts are computed as p^2*N, 2pq*N, and q^2*N for AA, Aa, and aa respectively, where N is total sample size.

Chi-Square HWE Test

Chi-square statistic and p-value test whether observed genotype frequencies depart significantly from HWE expectations with 1 degree of freedom.
Real-World Example

Calculation In Practice

Use Cases for the Allele Frequency Calculator

1

GWAS Quality Control

Filter SNP markers in genome-wide association studies by flagging loci with significant HWE departure (p < 0.001 or 0.05) as potential genotyping errors or targets of strong selection before association testing.
2

Conservation Genetics

Monitor inbreeding in small captive or wild populations by tracking HWE departure across loci. Significant heterozygote deficit across multiple loci signals inbreeding depression requiring management intervention.
3

Plant and Animal Breeding Programs

Track frequency of favorable alleles across selection cycles. Monitor deleterious recessive allele frequency to manage genetic disease prevalence in livestock and companion animal breeding programs.
4

Population Structure Analysis

Consistent HWE departure across multiple loci in a sample may indicate population admixture or substructure. Use as a preliminary screen before running STRUCTURE or ADMIXTURE analysis.
5

Academic Genetics Courses

Undergraduate genetics courses use Hardy-Weinberg problems extensively. This calculator verifies manual calculations and demonstrates the relationship between allele frequencies, genotype frequencies, and the chi-square test.

Technical Reference

Key Takeaways

The Allele Frequency Calculator computes p and q allele frequencies, Hardy-Weinberg expected genotype frequencies, and the chi-square HWE test from observed genotype counts. Use it for population genetics research, breeding program monitoring, GWAS quality control, and genetics education.

Frequently Asked Questions

What does a significant chi-square HWE result mean?
A p-value below 0.05 indicates the observed genotype frequencies differ significantly from Hardy-Weinberg expectations. This can result from inbreeding, population substructure, selection, genotyping error, or small sample size. Investigate the cause before interpreting allele frequency data.
What is the minimum sample size for reliable HWE testing?
Chi-square tests are unreliable when expected cell counts fall below 5. With rare alleles and small samples, use Fisher exact test instead. Most population genetics studies use N > 50 for single-locus HWE tests.
Why is q equal to 1 minus p?
For a biallelic locus, all alleles must be either A or a, so their frequencies must sum to 1. Therefore q = 1 - p by definition. This holds for all biallelic markers regardless of actual frequency values.
Can I use this for more than two alleles?
This calculator handles biallelic (two-allele) loci only. For multiallelic loci, allele frequency calculation is the same but the HWE test requires a different chi-square formulation with more degrees of freedom.
What is the degree of freedom for the HWE chi-square test?
The HWE chi-square test uses 1 degree of freedom for a biallelic locus (3 genotype classes minus 2 parameters estimated minus 1 = 1 df). The critical value at p = 0.05 with 1 df is 3.841.
What is the Hardy-Weinberg principle and when does it apply?
Hardy-Weinberg equilibrium states that allele and genotype frequencies remain constant across generations in a large randomly mating population with no selection, mutation, migration, or genetic drift. It is a null model — real populations deviate from HWE due to these forces, making HWE departure a signal of evolutionary activity.
What does a heterozygote excess indicate?
More heterozygotes than HWE predicts (positive FIS) suggests outbreeding, recent admixture of previously isolated populations, or balancing selection maintaining heterozygosity. It can also result from genotyping artifacts that call heterozygotes more readily than homozygotes.
What does a heterozygote deficit indicate?
Fewer heterozygotes than HWE predicts indicates inbreeding, population substructure (Wahlund effect where sampling combines multiple subpopulations), or selection against heterozygotes. Consistent heterozygote deficit across multiple loci strongly suggests inbreeding or population structure.
How is the HWE chi-square test different from a standard chi-square test?
The HWE chi-square uses 1 degree of freedom for a biallelic locus because one parameter (p) is estimated from the data. Standard chi-square tests with 3 classes would normally have 2 degrees of freedom, but estimating p from the data costs one degree of freedom, leaving df = 1.
What p-value threshold is used in GWAS for HWE filtering?
GWAS studies typically use p less than 0.001 or p less than 0.0001 for HWE filtering in control samples. Cases may deviate from HWE due to disease-associated selection, so HWE filtering is often applied only to control samples. The exact threshold varies by study design and ancestry composition.

Author Spotlight

The ToolsACE Team - ToolsACE.io Team

The ToolsACE Team

Our research team at ToolsACE builds genetics and population biology tools backed by peer-reviewed population genetics references.

Population Genetics ReferencesHardy-Weinberg PrincipleSoftware Engineering Team

Disclaimer

Assumes biallelic codominant locus. Chi-square approximation is unreliable for expected cell counts below 5 — use Fisher exact test for rare alleles or small samples. Does not account for population stratification or linkage disequilibrium.