Calculating allele frequencies starts with a straightforward idea: count how many copies of each version of a gene exist in your sample, then divide by the total number of gene copies. For a gene with two variants in a group of diploid organisms (each carrying two copies), you tally the alleles contributed by every individual and divide by twice the number of individuals sampled. That basic method works well when you can directly observe every person’s genotype, but real-world genetics rarely stays that simple. Population structure, incomplete data, sex-linked genes, and modern sequencing technologies all introduce wrinkles that demand adjusted approaches.
The Gene-Counting Method
The most intuitive way to get allele frequencies is direct gene counting, sometimes called the allele-counting method. Imagine you have a population sample and you can identify each individual’s genotype at a single gene with two variants, call them A and a. Each person who is homozygous AA contributes two A alleles. Each heterozygous Aa person contributes one A and one a. Each homozygous aa person contributes two a alleles. You add up all the A alleles across every individual and divide by the total number of alleles in the sample, which is simply twice the number of people (since each person carries two copies).1Calculations for Molecular Biology and Biotechnology. Forensics and Paternity – Section: 13.1.2 Calculating Allele Frequencies
Say you genotype 100 people and find 36 are AA, 48 are Aa, and 16 are aa. The A alleles total (36 × 2) + (48 × 1) = 120, out of 200 total allele copies, giving an A frequency of 0.60. The a frequency is everything left over: 0.40. Those two frequencies always sum to 1.0 for a two-allele system. When there are more than two variants at a locus, you do the same counting for each variant, and all the frequencies together still sum to 1.0.
This method is exact for your sample. It requires no assumptions about mating patterns, population size, or evolutionary forces. Its only requirement is that you can reliably identify every individual’s genotype. When that requirement breaks down, you need different tools.
When You Cannot See Every Genotype
Gene counting works beautifully for codominant markers, where each genotype looks distinct. But some genetic markers are dominant: one allele masks the other, so you cannot tell the difference between a homozygous dominant individual and a heterozygous one just by looking. Classic examples include many AFLP and RAPD markers used in ecology and conservation genetics. If you cannot distinguish AA from Aa, you cannot directly count alleles.
The standard workaround is the expectation-maximization (EM) algorithm. This is an iterative statistical approach that starts with a rough guess at the allele frequencies, uses that guess to estimate the likely proportion of hidden genotypes (how many of the dominant-phenotype individuals are probably AA versus Aa), then recalculates the allele frequencies based on those estimates. It repeats these two steps until the numbers stabilize. The EM algorithm can also incorporate deviations from random mating, which makes the estimates more realistic for populations that do not mate at random.2JP Journal of Biostatistics. Evaluation of Allele Frequency Estimation Using Expectation-Maximization Algorithm with Hardy-Weinberg Disequilibrium
The same problem of hidden genotypes shows up in modern genomics when sequencing coverage is low. If you only have a handful of sequencing reads for a given individual at a particular site, you may not be confident whether that person is homozygous or heterozygous. Researchers have adapted EM-based approaches for this situation too, estimating allele and genotype frequencies from the raw read counts rather than from hard-called genotypes.3PubMed Central. Population genetic analysis of bi-allelic structural variants from low-coverage sequence data with an expectation-maximization algorithm
Hardy-Weinberg Equilibrium as a Reality Check
Once you have allele frequencies, a natural follow-up is asking whether the population’s genotype frequencies match what you would expect under random mating. Under idealized conditions, a population with allele frequencies p and q for a two-allele gene should have genotype proportions that follow a predictable pattern. When the observed genotypes match that expectation, the population is said to be in Hardy-Weinberg equilibrium (HWE). When they do not match, something interesting is happening: maybe the population is not mating randomly, maybe natural selection is at work, maybe the sample lumps together individuals from distinct subpopulations, or maybe there is a genotyping error.
Testing for HWE is standard practice in genetics studies as a quality-control step. But the statistical tests themselves have quirks. Because genotype counts at a single locus involve small, discrete numbers, the test statistics follow discrete distributions rather than the smooth continuous curves that many standard statistical tools assume. Research has shown that relying on continuous approximations can underestimate how much a sample departs from equilibrium, meaning real deviations get missed.4PubMed Central. Distributions of Hardy-Weinberg equilibrium test statistics Exact tests, which compute probabilities directly from the discrete distribution, tend to be more reliable, especially for small samples or rare alleles.
X-Linked Genes Need a Different Approach
The standard allele-frequency formula assumes every individual carries two copies of the gene. That assumption fails for genes on the X chromosome in species where one sex is hemizygous, meaning males carry only one X. A male with allele A on his X chromosome is not “AA” in any meaningful sense, even though some database file formats store his genotype that way for software compatibility.
Because males receive their X chromosome from their mother, male allele frequencies for X-linked markers reflect the previous generation’s female allele frequencies. If male and female allele frequencies differ, the population has not yet reached equilibrium at that locus, and it can take several generations for the frequencies to converge. The common shortcut of testing HWE only in females and ignoring males is statistically inadequate, because it throws away information and can miss real departures from equilibrium. A proper test for X-linked markers needs to account for males’ hemizygous state and include both sexes in the analysis.5PubMed Central. Testing for Hardy–Weinberg equilibrium at biallelic genetic markers on the X chromosome
Population Structure Can Distort Your Numbers
One of the most common reasons allele frequency estimates go wrong in practice is population structure, the situation where your sample actually contains individuals from two or more genetically distinct subgroups. When you lump those subgroups together, the combined sample almost always shows fewer heterozygotes than expected under HWE. This is the Wahlund effect, and it can make a population look like it has inbreeding when the real issue is just mixing.
Disentangling this from other causes of heterozygote deficits, like null alleles (alleles that fail to amplify during genotyping, making heterozygotes look like homozygotes), is a persistent headache in population genetics. Research has shown that these two phenomena leave different statistical fingerprints. The Wahlund effect tends to produce a weak or absent correlation between within-population and between-population genetic differentiation measures across loci, while null alleles produce a strong positive correlation between those same measures.6Journal of Heredity. Revisiting FIS, FST, Wahlund Effects, and Null Alleles That difference can help you figure out which problem is inflating your homozygote counts and adjust accordingly.
The practical lesson: if your HWE test flags a significant departure, do not immediately assume selection or genotyping error. Consider whether your sample might be mixing distinct groups.
Small Samples and Rare Alleles
When your sample is small, allele frequency estimates become noisy. An allele at 5% frequency in the true population might not appear at all in a sample of 20 people, or it might show up at 10% by chance. This is especially problematic for rare alleles, which are precisely the ones that tend to matter most in clinical genetics and forensic identification.
One approach to dealing with small samples is to borrow strength from related populations. An empirical Bayes method has been developed that adaptively incorporates genotype data from populations that are genetically similar to your target. Populations that are more similar get more weight in the estimate, while distant ones have less influence. This approach consistently produces more accurate estimates than either analyzing the small sample alone or naively pooling it with unrelated samples. The bias it introduces is small, while the reduction in estimation error can be substantial.7PubMed Central. IMPROVING POPULATION-SPECIFIC ALLELE FREQUENCY ESTIMATES BY ADAPTING SUPPLEMENTAL DATA: AN EMPIRICAL BAYES APPROACH
Allele Frequencies from Sequencing Data
Modern genomics rarely involves directly observing genotypes under a microscope or on a gel. Instead, DNA is sequenced, and genotypes are inferred from the resulting reads. When sequencing coverage is high, this works well. But for large population studies, sequencing every individual deeply is expensive, so researchers often work with low or medium coverage, where any given site in any given person might only be represented by a few reads.
The problem is that calling a definitive genotype from two or three reads at a site introduces errors. If you see two reads both carrying the A allele, the person might be AA, or they might be Aa and you just happened to sample the A copy twice. Methods that first call genotypes and then count alleles propagate these errors into the frequency estimates. A better approach is to integrate over the genotype uncertainty, essentially asking: given the reads I see, what are the probabilities of each possible genotype, and what allele frequency best explains the pattern across all individuals? Maximum likelihood methods built on this principle produce more accurate allele frequency estimates from low-coverage data than the two-step approach of calling genotypes first.8PubMed Central. Estimation of allele frequency and association mapping using next-generation sequencing data
Related methods extend this framework further. Rather than treating each site independently, some approaches estimate the overall distribution of allele frequencies across all sites in the genome simultaneously, then use that distribution as prior information when estimating the frequency at any single site. This two-step strategy improves accuracy for genotype calling and for identifying which sites genuinely vary in the population.9PubMed Central. SNP Calling, Genotype Calling, and Sample Allele Frequency Estimation from New-Generation Sequencing Data
Pooled Sequencing
An even more cost-effective strategy is pool-seq: rather than sequencing each individual separately, you extract DNA from many individuals, mix it into a single pool, and sequence the pool. The proportion of reads carrying each allele in the pool approximates the allele frequency in the group. The obvious downside is that you lose individual genotype information entirely, but for studies that only need population-level frequencies, it works surprisingly well. Research using fruit fly populations has shown that accurate allele frequency estimates can be recovered even at very shallow sequencing depths (under 5× coverage per individual) when the analysis leverages information about known founder haplotypes.10PubMed Central. Accurate Allele Frequencies from Ultra-low Coverage Pool-Seq Samples in Evolve-and-Resequence Experiments
Mapping Bias in Ancient DNA
Ancient DNA presents a particularly tricky case. Degraded samples yield short, damaged fragments, and those fragments can map more readily to the reference genome when they carry the reference allele than when they carry the alternative. This “reference bias” inflates the apparent frequency of reference alleles. Correcting for it involves modifying each read to carry the opposite allele, remapping it, and comparing how often the two versions map successfully. The ratio between them quantifies the bias at each site, which can then be factored into the frequency estimation.11G3 Genes|Genomes|Genetics. Estimating allele frequencies, ancestry proportions and genotype likelihoods in the presence of mapping bias
Polyploid Organisms
Everything described so far assumes diploid organisms with two copies of each gene. Many plants and some animals are polyploid, carrying four, six, or even eight copies. This makes allele frequency calculation harder in two ways. First, the number of possible genotype classes at a single locus explodes. A diploid with two alleles has three possible genotypes; a tetraploid has five, and a hexaploid has seven. Second, distinguishing between these genotype classes from sequencing data is much harder, because a tetraploid individual with genotype AAAa looks very similar to one with genotype AAaa when you only have moderate read depth.
Researchers have developed hierarchical Bayesian models for this situation that estimate allele frequencies directly from raw read counts, summing over the uncertainty in each individual’s dosage (how many copies of each allele they carry). Simulations of tetraploid, hexaploid, and octoploid populations have been used to evaluate these methods and guide decisions about how much sequencing is needed.12PubMed Central. The Site Frequency/Dosage Spectrum of Autopolyploid Populations The general approach mirrors the logic used for low-coverage diploid data: do not commit to a hard genotype call when you are uncertain, and instead let the statistical model carry forward the full range of possibilities.
Haplotype Frequencies
Sometimes you care about combinations of alleles across multiple linked sites, not just the frequency at a single locus. These combinations are haplotypes. The complication is that standard genotyping tells you which alleles a person has but not which alleles sit together on the same chromosome (the “phase” information). If someone is heterozygous at two nearby sites, you cannot tell from genotype data alone which allele at site one pairs with which allele at site two on the same chromosome.
EM algorithms are the workhorse solution here as well. They start with an initial guess at haplotype frequencies, use those to assign probabilistic phases to each ambiguous individual, then re-estimate the haplotype frequencies from the phased data, repeating until convergence.13PubMed Central. Accuracy of haplotype frequency estimation for biallelic loci, via the expectation-maximization algorithm for unphased diploid genotype data This approach is used extensively in human genetics, particularly for the HLA genes of the immune system, where haplotype frequencies matter for organ transplant matching and disease association studies.14PubMed. HLA haplotype frequency estimation for heterogeneous populations using a graph-based imputation algorithm
Forensic Applications
One of the highest-stakes uses of allele frequency data is in forensic genetics. When a crime-scene DNA profile matches a suspect, the strength of that evidence depends entirely on how common the matching profile is in the relevant population. If every allele in the profile is frequent, the match is less impressive; if the profile contains rare alleles, the match carries enormous weight.
Forensic frequency databases are population-specific reference collections that record how common each allele is at a set of standard marker loci. These databases provide the statistical backbone for calculating match probabilities. Without accurate frequency data for the relevant population, the weight of DNA evidence cannot be properly assessed.15PubMed Central. Forensic biobank; towards comprehensive forensic genetic frequency database for the Kenyan population Building these databases is an ongoing global effort, with new reference datasets being developed for underrepresented populations.16Forensic Genomics. A Novel DNA Dataset of 20 Forensic Autosomal STRs for the Hawrami Population in Iraq
A recurring concern in forensic genetics is what happens when the suspect belongs to a different subpopulation than the one represented in the reference database. Standard practice uses a correction factor to account for population structure. Using this correction, forensic calculations generally produce results that are more favorable to the defense than alternative approaches in the vast majority of comparisons.17PubMed Central. Choice of population database for forensic DNA profile analysis This is a deliberate conservative choice: it is better to slightly understate the evidence against a suspect than to overstate it.
Minor Allele Frequency Filtering in Large Studies
In genome-wide association studies and population genomics, researchers routinely filter out variants below a certain minor allele frequency (MAF) threshold before running their analyses. The usual justification is that very rare variants are more likely to be genotyping artifacts. But this filtering does not come free. It also removes genuinely rare alleles that may be young, geographically restricted, or recently introduced through admixture. A study examining the downstream consequences of MAF filtering found that it can strongly bias estimates of genetic uniqueness both within and across species, potentially warping conclusions about population divergence and diversity.18PubMed Central. Minor Allele Frequency Filtering Can Strongly Bias Uniqueness Estimates Within and Across Species The implication is that MAF thresholds should be chosen carefully and with awareness of what biological signal might be discarded along with the noise.
Tracking Frequency Changes Over Time
Allele frequencies are not static. They shift across generations due to natural selection, genetic drift, migration, and mutation. Measuring these shifts has historically been indirect: researchers would look at patterns of genetic variation in living populations and try to infer what happened in the past. Ancient DNA has changed the game by providing direct snapshots of allele frequencies at different time points, sometimes spanning thousands of years.
With time-series data in hand, researchers can decompose observed frequency changes into contributions from different evolutionary forces. A study using ancient human genomes spanning five thousand years showed how genome-wide variance in allele frequency change between two time points can be partitioned into the effects of gene flow, genetic drift, and natural selection acting on linked sites.19PubMed Central. The contribution of gene flow, selection, and genetic drift to five thousand years of human allele frequency change Likelihood-based methods can jointly estimate the strength of selection and the age of an allele from such time-series data, providing estimates that would be impossible from a single modern snapshot.20PubMed Central. Estimation of Natural Selection and Allele Age from Time Series Allele Frequency Data Using a Novel Likelihood-Based Approach
Bayesian approaches offer another angle. By treating the strength of selection as a quantity to be estimated with a probability distribution rather than a single point estimate, these methods can incorporate prior knowledge and provide a fuller picture of the uncertainty around selection estimates. Direct observation of ancient allele frequency dynamics is expected to be considerably more powerful for detecting selection than inferring it indirectly from patterns in modern genomes alone.21PubMed Central. Bayesian Inference of Natural Selection from Allele Frequency Time Series
Variant Allele Frequency in Cancer Genomics
The concept of allele frequency has been adapted in clinical oncology under the name variant allele frequency, or VAF. In tumor sequencing, VAF measures the proportion of sequencing reads at a given genomic position that carry a particular mutation. A VAF of 50% in a tumor biopsy roughly suggests the mutation is present in most tumor cells (heterozygous in a diploid tumor), while a VAF of 5% suggests the mutation is confined to a small subclone.
VAF gives oncologists insight into tumor clonality: which mutations are widespread “trunk” mutations present in nearly all cancer cells, and which are “branch” mutations in small subpopulations. This has a direct therapeutic rationale, as targeting mutations with high VAF means targeting the dominant cancer cell population rather than a minor subclone that may not be driving tumor growth.22PubMed. Variant allele frequency: a decision-making tool in precision oncology? The calculation is conceptually identical to population allele frequency estimation, but the “population” is the collection of cells in a tumor, and the sampling is done by sequencing reads rather than by counting individuals.
Environmental DNA
Perhaps the most surprising recent extension of allele frequency estimation involves environmental DNA, or eDNA. Organisms shed DNA into their surroundings through skin cells, mucus, feces, and other biological material. Researchers have shown that by collecting water samples and sequencing nuclear genetic markers from the DNA floating in it, they can estimate allele frequencies for a species living in that water body without catching or even seeing a single individual. In studies of round goby populations, allele frequencies estimated from eDNA in water samples were highly correlated with frequencies measured by genotyping tissue from captured fish.23PubMed Central. Nuclear eDNA estimates population allele frequencies and abundance in experimental mesocosms and field samples The approach can even estimate how many genetically distinct individuals contributed DNA to the sample, providing a noninvasive measure of population size alongside genetic diversity. For endangered or elusive species, this kind of method could eventually replace the need to physically sample animals at all.