Allele frequency

Allele frequency, or gene frequency, is the relative frequency of an allele (variant of a gene) at a particular locus in a population, expressed as a fraction or percentage. Specifically, it is the fraction of all chromosomes in the population that carry that allele. Microevolution is the change in allele frequencies that occurs over time within a population.
Given the following:
then the allele frequency is the fraction of all the occurrences "i" of that allele and the total number of chromosome copies across the population, "i"/("nN").
The allele frequency is distinct from the genotype frequency, although they are related, and allele frequencies can be calculated from genotype frequencies.
In population genetics, allele frequencies are used to describe the amount of variation at a particular locus or across multiple loci. When considering the ensemble of allele frequencies for many distinct loci, their distribution is called the allele frequency spectrum.
Calculation of allele frequencies from genotype frequencies.
The actual frequency calculations depend on the ploidy of the species for autosomal genes.
Monoploids.
The frequency ("p") of an allele A is the fraction of the number of copies ("i") of the A allele and the population or sample size ("N"), so
Diploids.
If formula_2, formula_3, and formula_4 are the frequencies of the three genotypes at a locus with two alleles, then the frequency "p" of the A-allele and the frequency "q" of the B-allele in the population are obtained by counting alleles.
Because "p" and "q" are the frequencies of the only two alleles present at that locus, they must sum to 1. To check this:
If there are more than two different allelic forms, the frequency for each allele is simply the frequency of its homozygote plus half the sum of the frequencies for all the heterozygotes in which it appears.
(For 3 alleles see ) 
Allele frequency can always be calculated from genotype frequency, whereas the reverse requires that the Hardy–Weinberg conditions of random mating apply.
Example.
Consider a locus that carries two alleles, A and B. In a diploid population there are three possible genotypes, two homozygous genotypes (AA and BB), and one heterozygous genotype (AB). If we sample 10 individuals from the population, and we observe the genotype frequencies
then there are formula_10 observed copies of the A allele and formula_11 of the B allele, out of 20 total chromosome copies. The frequency "p" of the A allele is "p" = 15/20 = 0.75, and the frequency "q" of the B allele is "q" = 5/20 = 0.25.
Dynamics.
Population genetics describes the genetic composition of a population, including allele frequencies, and how allele frequencies are expected to change over time. The Hardy–Weinberg law describes the expected equilibrium genotype frequencies in a diploid population after random mating. Random mating alone does not change allele frequencies, and the Hardy–Weinberg equilibrium assumes an infinite population size and a selectively neutral locus.
In natural populations natural selection (adaptation mechanism), gene flow, and mutation combine to change allele frequencies across generations. Genetic drift causes changes in allele frequency from random sampling due to offspring number variance in a finite population size, with small populations experiencing larger per generation fluctuations in frequency than large populations. There is also a theory that second adaptation mechanism exists – niche construction According to extended evolutionary synthesis adaptation occur due to natural selection, environmental induction, non-genetic inheritance, learning and cultural transmission. An allele at a particular locus may also confer some fitness effect for an individual carrying that allele, on which natural selection acts. Beneficial alleles tend to increase in frequency, while deleterious alleles tend to decrease in frequency. Even when an allele is selectively neutral, selection acting on nearby genes may also change its allele frequency through hitchhiking or background selection.
While heterozygosity at a given locus decreases over time as alleles become fixed or lost in the population, variation is maintained in the population through new mutations and gene flow due to migration between populations. For details, see population genetics.