Allele Frequency Calculator

Calculate allele frequencies p and q and genotype frequencies from disease prevalence, genotype counts, or allele counts. Includes carrier frequency and a Hardy-Weinberg chi-square test.

https://hexacalculator.com/calculators/biology/ecology/allele-frequency-calculator

Biology

Ecology

Allele Frequency Calculator

Calculate allele frequencies p and q and genotype frequencies from disease prevalence, genotype counts, or allele counts. Includes carrier frequency and a Hardy-Weinberg chi-square test.

Allele Frequency Calculator

Choose your method

Pick what you already know: the prevalence of a recessive trait, the counts of each genotype in your sample, or the raw counts of each allele.

Enter what you know

Only the boxes your chosen method needs are shown. Everything is a plain count or a frequency - there are no units to set. The answers update as you type.

How is the frequency of affected (recessive homozygous) individuals given?

%

Results

1 in

Frequency of allele A (p)
Carriers: 1 in ...
AA
Aa
aa

The affected share is q squared, so the recessive allele frequency is its square root, q = 0.1, and p = 0.9. About 0.18 of the population carries one copy without showing the trait.

Visualize the population

The allele pie splits the gene pool into A and a; the genotype pie shows how those alleles pair up into AA, Aa and aa individuals.

Allele pool: A versus a
Genotype distribution: AA, Aa, aa
Loading calculator…

Allele frequency refers to how common a particular variant of a gene is in a population. Imagine you collect the copies of that particular gene from every individual and add them up into one giant gene pool. The allele frequency would then be the proportion of this gene pool made up by a particular allele variant.

This calculator uses three methods to determine these frequencies, based on the prevalence of a recessive trait, the number of genotypes or the original number of alleles. It gives back the frequency of both alleles (p and q), the genotype frequency and the carrier frequency. For inputs with numerical values, it also performs a Hardy-Weinberg equilibrium test.

The meaning of p and q:

For a gene with two alleles, one is designated as dominant (A) and the other as recessive (a). The frequencies of these two alleles are usually denoted by p and q. Since every allele is either one or the other, the sum of their frequencies will be the entire gene pool.

p+q=1p + q = 1

Here p is the frequency of the dominant allele A and q is the frequency of the recessive allele a. If one of these values is known, then the other can be calculated. Recessive alleles are often of interest because they represent rare traits or may cause genetic diseases.

Hardy-Weinberg equation

When alleles are randomly combined to form individuals, the frequency of genotypes is calculated by squaring the gene pools represented by p and q. This is the Hardy-Weinberg equation.

p2+2pq+q2=1p^2 + 2pq + q^2 = 1

Each term represents a particular genotype. The square of p gives the proportion of homozygous dominant individuals (AA), 2pq is the proportion of heterozygotes (Aa) who are carriers and the square of q is the proportion of homozygous recessive individuals (aa). As these three proportions together make up the entire population, their sum is equal to 1.

This principle is exactly true only when the population size is very large, mating is random and there are no selection, mutation, migration or genetic drift. In reality populations deviate from these conditions but that's why this equation is useful. The difference between the predicted genotypes and the observed genotypes indicates that an evolutionary process is going on.

Method 1, calculating from the prevalence of a recessive trait.

For recessive disorders, only homozygous recessives (aa) show the trait. The proportion of affected individuals is exactly q squared. Taking the square root gives you the allele frequency and subtracting from one gives you the other frequency.

q=q2p=1qq = \sqrt{q^2} \qquad p = 1 - q

Suppose a particular disease affects 1 person out of 2500. In a population of 2500 people q squared is equal to the value that results from dividing 1 by 2500. So q is equal to the value that results from dividing 1 by 50, which is 0.02 and p is 0.98. The carrier frequency 2pq is about 0.039, meaning there are approximately 1 carriers per 25 people. This number greatly exceeds the actual disease rate. It's precisely this discrepancy between a rare disease and a relatively high proportion of carriers that makes these calculations important in genetic counseling.

Method 2, start with the number of genotypes.

If you have already counted the number of individuals with genotypes AA, Aa and aa in your sample, then you can count alleles directly. Since each individual has two alleles, a sample of N individuals contains 2N alleles. Each individual with genotype AA contributes two A alleles whereas each individual with genotype Aa contributes one A allele.

p=2nAA+nAa2Nq=2naa+nAa2Np = \frac{2\,n_{AA} + n_{Aa}}{2N} \qquad q = \frac{2\,n_{aa} + n_{Aa}}{2N}

For example, if there are nine pea plants in a population: six have the genotype for purple flowers (AA), one has the genotype for purple flowers (Aa) and two have the genotype for white flowers (aa). The number of A alleles is 13, the number of a alleles is 5, and the total number of alleles is 18. So p is approximately 0.72 and q is approximately 0.28. A calculation tool then uses a chi-square test to compare the counted genotypes with expected values based on Hardy-Weinberg.

Balance test

The chi-square statistic is the sum of the squared differences between the number of each observed genotype and the expected counts, divided by the expected count.

χ2=(OE)2E\chi^2 = \sum \frac{(O - E)^2}{E}

If there are two alleles, the degrees of freedom is one. At a significance level of 5 percent, the critical value is 3.84. If the chi-square value is less than 3.84, then the sample agrees with the equilibrium. If it is greater than 3.84, this indicates that the deviation is significant and could be due to selection, genetic drift, inbreeding, migration or mutation. However, there is also a possibility that the sample size was simply too small for the conclusion to be reliable.

Method 3: Start with the number of alleles for a gene.

Sometimes the original number of alleles is already known. This can be the case for sequencing data where a mutation is reported as multiple copies and makes up part of the total number of alleles. In this case, the frequency of that allele will correspond to the value obtained by dividing the number of those alleles by the total number of alleles.

p=nAnA+naq=nanA+nap = \frac{n_A}{n_A + n_a} \qquad q = \frac{n_a}{n_A + n_a}

On this basis the calculator applies the Hardy-Weinberg equation to calculate expected genotype frequencies if the population were mating at random.

The meaning of each field:

Symbol

Meaning

Example

p

Frequency of the dominant / major allele A

0.9

q

Frequency of the recessive / minor allele a

0.1

p squared

Homozygous dominant AA share

0.81

2pq

Heterozygous Aa (carrier) share

0.18

q squared

Homozygous recessive aa share

0.01

Carrier 1 in N

One carrier per N people (1 / 2pq)

1 in 5.6

Example:

Situation

Input

p and q

1% affected (aa)

prevalence 1%

p 0.9, q 0.1

1 in 2500 affected

1 in 2500

p 0.98, q 0.02

Genotypes 6 / 1 / 2

AA 6, Aa 1, aa 2

p 0.72, q 0.28

Allele counts 120 / 80

A 120, a 80

p 0.6, q 0.4

This calculator assumes that a gene is present in only one copy and there are two alleles. Except for tests using the number of genotypes, it also assumes that the population is at Hardy-Weinberg equilibrium. It is intended as an educational tool to estimate values and does not replace formal population genetic analysis or genetic counseling.

Frequently asked questions

How do you calculate allele frequencies p and q?

Count the number of copies of each allele and divide by the total number of alleles. Since there are two alleles per individual, a sample of N people will contain a total of 2N alleles. p = (2 x number of AA genotypes + number of Aa genotypes) / 2N, and q = (2 x number of aa genotypes + number of Aa genotypes) / 2N. The sum of these two frequencies is always 1.

What do p and q represent in the Hardy-Weinberg equation?

p represents the frequency of the dominant allele, usually denoted by A. q represents the frequency of the recessive allele a. The square of the gene pool gives the genotype frequencies with p squared for AA, 2pq for the heterozygotes Aa and q squared for aa.

How can you calculate allele frequency from disease prevalence?

Since only homozygous recessive individuals show the trait, the proportion of affected individuals is equal to q2. Taking the square root gives q, and p = 1 - q. For a disease that affects 1% of the population, q2 = 0.01, so q = 0.1 and p = 0.9.

What is carrier frequency and how does it differ from disease incidence?

Carriers are heterozygotes of type Aa, whose frequency is given by 2pq. For rare recessive alleles, the carrier frequency exceeds q², which represents the probability that an individual will have the disease. This explains why in a population of 2500 individuals, with one affected, there may be approximately 1 carrier (per 25 people).

How do you determine if a population is in Hardy-Weinberg equilibrium?

A chi-square test with one degree of freedom is used to compare the number of observed genotypes to the numbers predicted by the equation. If the chi-square value exceeds 3.84, this indicates a significant deviation from the expected distribution (p < 0.05). Possible causes for this include selection, genetic drift, non-random mating, migration and mutation.

Related calculators

Disclaimer: This calculator is provided for general informational and educational purposes only. Our calculators are under active development, and results may be inaccurate, incomplete, or unsuitable for your situation. Always verify the figures independently and seek advice from a qualified professional before relying on them. We make no warranties and accept no liability for any loss or decision arising from use of this tool.

References

  1. Hardy-Weinberg principle (Wikipedia)

    Derivation of p + q = 1 and p^2 + 2pq + q^2 = 1, the equilibrium assumptions, and the chi-square test for deviation.

  2. OpenStax Biology 2e: Population Genetics

    University textbook chapter on gene pools, allele and genotype frequencies, and the Hardy-Weinberg model.

  3. National Human Genome Research Institute: Allele

    Plain-language definition of an allele and how allelic variation is described.