Population Genetics & Hardy-Weinberg Formula • 100% Free & In-Browser

Allele Frequency Calculator

Calculate dominant (p) and recessive (q) gene frequencies from observed genotype counts (AA, Aa, aa), disease phenotype prevalence, X-linked traits, and 3-allele ABO blood groups.

Real-World Population Datasets:

1. Observed Diploid Genotype Counts

Individuals with genotype AA (e.g. MM).
Individuals with genotype Aa (e.g. MN).
Individuals with genotype aa (e.g. NN).
Dominant Allele (p)
0.5425
54.25% of gene pool
Recessive Allele (q)
0.4575
45.75% of gene pool
Hardy-Weinberg Expected vs. Observed N = 1,000 (2,000 Alleles)
Genotype Observed Count Observed % Expected % (HWE) Expected Count
Homozygous AA 298 29.8% 29.4% (p²) 294.3
Heterozygous Aa 489 48.9% 49.6% (2pq) 496.4
Homozygous aa 213 21.3% 20.9% (q²) 209.3
Chi-Square Test: χ² = 0.224 (df = 1, p = 0.636) In HWE Equilibrium

Gene Counting Derivation Breakdown

Theoretical Population Genetics

What is Allele Frequency & How Does It Define the Gene Pool?

In population genetics, an allele frequency (or gene frequency) represents the relative abundance of a specific allele among all gene copies at a designated chromosomal locus in an interbreeding population. While an individual diploid organism carries exactly two alleles per locus, a population's gene pool is characterized by the continuous proportions of all segregating alleles ($p$ and $q$ for biallelic loci):

1. Gene Counting Method (Direct Genotypes)

Direct calculation from homozygous ($N_{AA}, N_{aa}$) and heterozygous ($N_{Aa}$) individuals. Because each homozygote carries 2 copies and each heterozygote carries 1 copy: $p = (2N_{AA} + N_{Aa}) / 2N$ and $q = (2N_{aa} + N_{Aa}) / 2N$.

2. Square Root Method (Phenotype Prevalence)

When complete dominance prevents distinguishing $AA$ from $Aa$, Hardy-Weinberg equilibrium is assumed: $q = \sqrt{q^2} = \sqrt{\text{Recessive Prevalence}}$, and dominant allele frequency is $p = 1 - q$.

Evolutionary Mechanisms

The 5 Hardy-Weinberg Assumptions & Causes of Microevolution

Formulated independently by British mathematician G. H. Hardy and German physician Wilhelm Weinberg in 1908, the Hardy-Weinberg principle demonstrates that in the absence of evolutionary disturbances, allele and genotype frequencies reach an equilibrium state described by the binomial theorem:

p + q = 1  ⟹  p² (AA) + 2pq (Aa) + q² (aa) = 1
1. Natural Selection (w ≠ 1)

Differential reproductive fitness altering allele frequencies over time (e.g., sickle cell heterozygote advantage against severe malaria).

2. Genetic Drift (Small N)

Stochastic sampling error causing random allele fixation or loss in small populations (Founder Effect and Population Bottlenecks).

3. Gene Flow & Assortative Mating

Immigration/emigration of alleles between distinct populations, or positive assortative mating altering genotype proportions without changing $p$ and $q$.

Clinical Medical Genetics

Clinical Genetics: Carrier Frequency Estimation from Disease Prevalence

In medical genetics and genetic counseling, the Hardy-Weinberg square root method enables exact carrier frequency estimation for autosomal recessive disorders:

Why Rare Recessive Alleles "Hide" in Heterozygotes:
When an autosomal recessive disease is rare (e.g. Cystic Fibrosis with a live-birth incidence of $q^2 = 1 / 2,500 = 0.0004$):
• Recessive allele frequency: q = √0.0004 = 0.02 (1 in 50)
• Dominant allele frequency: p = 1 - 0.02 = 0.98
• Carrier frequency: 2pq = 2 × 0.98 × 0.02 = 0.0392 (1 in 25.5 individuals)
In this population, heterozygous carriers are ~100 times more common than affected individuals ($2pq / q^2 \approx 2/q = 100$). Over 98% of all mutant alleles in the gene pool reside safely inside healthy carriers.
Sex Chromosome Dynamics

X-Linked Allele Frequencies & Hemizygous Sex Discrepancy

Because males carry only one X chromosome (hemizygous $XY$), male phenotypic frequency directly equals the underlying allele frequency ($q$). Females carry two X chromosomes ($XX$), requiring two recessive alleles ($q^2$) for phenotypic expression:

Male Affected Incidence = q  |  Female Affected Incidence = q²
Worked Clinical Example: Red-Green Color Blindness (q = 0.08)
• In biological males, disease incidence is q = 8.0% (1 in 12.5 men).
• In biological females, disease incidence is q² = 0.0064 = 0.64% (1 in 156 women).
• Female carrier frequency is 2pq = 2 × 0.92 × 0.08 = 14.72% (1 in 6.8 women).
Tri-Allelic Genetics

Multi-Allele Systems: Bernstein's ABO Blood Group Correction Formula

For tri-allelic systems such as human ABO blood types ($I^A$ with frequency $p$, $I^B$ with frequency $q$, and $i$ with frequency $r$), trinomial expansion dictates $(p + q + r)^2 = p^2 + 2pr + q^2 + 2qr + 2pq + r^2 = 1$. Due to sampling error in field datasets, raw frequencies rarely sum to 1.0. German mathematician Felix Bernstein (1925) formulated the standard normalization algorithm:

D = 1 - (p + q + r)
p* = p(1 + D/2)  |  q* = q(1 + D/2)  |  r* = (r + D/2)(1 + D/2)
Statistical Validation

Statistical Protocol: Testing Hardy-Weinberg Equilibrium with Chi-Square (χ²)

To determine whether an observed sample deviates significantly from Hardy-Weinberg equilibrium, geneticists employ Pearson's Chi-Square ($\chi^2$) goodness-of-fit test:

χ² = Σ [ (Observed - Expected)² / Expected ]
Degrees of Freedom (df): Calculated as $\text{df} = (\text{Genotypic Classes}) - (\text{Alleles Estimated}) = 3 - 2 = 1$. (One degree of freedom is lost because sample size $N$ is fixed, and another because allele frequency $p$ is estimated directly from the dataset).
Critical Decision Threshold: At the standard significance level of $\alpha = 0.05$ with $1\text{ df}$, the critical Chi-Square value is $3.841$. If $\chi^2 < 3.841$ ($p > 0.05$), the null hypothesis is accepted—the population is in Hardy-Weinberg equilibrium. If $\chi^2 \ge 3.841$ ($p \le 0.05$), the population significantly violates HWE.
Frequently Asked Questions

Frequently Asked Questions About Allele & Gene Frequency

What is an allele frequency (gene frequency), and what is the formula to calculate it from genotype counts?

Allele frequency (or gene frequency) represents the relative proportion of a specific allele among all gene copies at a given locus within a biological population. In a diploid population of N individuals (2N total alleles) with genotype counts N_AA, N_Aa, and N_aa: The dominant allele frequency is p = (2N_AA + N_Aa) / (2N), and the recessive allele frequency is q = (2N_aa + N_Aa) / (2N), where p + q = 1.0 (100%).

How do you calculate allele frequencies from phenotypic data when heterozygotes cannot be distinguished?

When complete dominance obscures heterozygotes (both AA and Aa exhibit the dominant phenotype), allele frequencies are estimated under the assumption of Hardy-Weinberg equilibrium using the square root method: (1) Calculate the observed frequency of the homozygous recessive phenotype: q² = N_recessive / N_total; (2) Solve for the recessive allele frequency: q = √(q²); (3) Solve for the dominant allele frequency: p = 1 - q; (4) Calculate the carrier frequency: 2pq = 2 × p × q.

What is the difference between allele frequency and genotype frequency?

Allele frequency measures the abundance of an individual allele (such as A or a) within the total haploid gametic gene pool (p and q). In contrast, genotype frequency measures the proportion of diploid individuals possessing a specific combination of two alleles (such as AA, Aa, or aa). Under Hardy-Weinberg equilibrium, genotype frequencies are the binomial expansion of allele frequencies: p² (AA) + 2pq (Aa) + q² (aa) = 1.

How do you calculate allele frequencies for X-linked (sex-linked) genes?

In species with chromosomal sex determination (females XX, males XY), females carry 2 copies of an X-linked gene while males carry only 1 copy (hemizygous). In a population of N_f females and N_m males (total X alleles = 2N_f + N_m): The dominant allele frequency is p = (2N_XAXA + N_XAXa + N_XAY) / (2N_f + N_m), and the recessive allele frequency is q = (2N_XaXa + N_XAXa + N_XaY) / (2N_f + N_m). In males, the phenotypic disease frequency directly equals the allele frequency (q), whereas in females, it equals q².

How does the Chi-Square (χ²) test determine whether a population is in Hardy-Weinberg equilibrium?

The Chi-Square goodness-of-fit test calculates χ² = Σ [(Observed - Expected)² / Expected] across all genotypes, where Expected_AA = N·p², Expected_Aa = 2N·pq, and Expected_aa = N·q². For a 2-allele system, there is 1 degree of freedom (df = genotypes - alleles = 3 - 2 = 1). If the calculated χ² is less than the critical value of 3.841 (p > 0.05), the population does not deviate significantly from Hardy-Weinberg equilibrium. If χ² ≥ 3.841 (p ≤ 0.05), the population violates HWE due to evolutionary forces (such as non-random mating, natural selection, genetic drift, or gene flow).

How are allele frequencies calculated for a multi-allele system like the ABO blood group?

The human ABO blood group system features three alleles (I^A with frequency p, I^B with frequency q, and i with frequency r, where p + q + r = 1). Under equilibrium: (1) Recessive allele i frequency is r = √(Freq(O)); (2) Dominant allele I^A frequency is p = 1 - √(Freq(B) + Freq(O)); (3) Dominant allele I^B frequency is q = 1 - √(Freq(A) + Freq(O)). Bernstein's standard correction adjustment is then applied: D = 1 - (p + q + r), giving corrected frequencies p* = p(1 + D/2), q* = q(1 + D/2), and r* = (r + D/2)(1 + D/2) ensuring p* + q* + r* = 1.0 exactly.