# Tajima's D

Tajima's D is a statistical test created by and named after the Japanese researcher Fumio Tajima. The purpose of the test is to distinguish between a DNA sequence evolving randomly ("neutrally") versus one evolving under a non-random process, including directional selection or balancing selection, demographic expansion or contraction, genetic hitchhiking, or introgression. A randomly evolving DNA sequence contains mutations with no effect on the fitness and survival of an organism. The randomly evolving mutations are called "neutral", while mutations under selection are "non-neutral". For example, you would expect to find that a mutation which causes prenatal death or severe disease to be under selection.

According to Motoo Kimura's neutral theory of molecular evolution, the majority of mutations in the human genome are neutral, ie have no effect on fitness and survival. When looking at the human population as a whole, we say that the population frequency of a neutral mutation fluctuates randomly (ie the percentage of people in the population with the mutation changes from one generation to the next, and this percentage is equally likely to go up or down), through genetic drift.

The strength of genetic drift depends on the population size. If a population is at a constant size with constant mutation rate, the population will reach an equilibrium of gene frequencies. This equilibrium has important properties, including the number of segregating sites $S/$ , and the number of nucleotide differences between pairs sampled (these are called pairwise differences). To standardize the pairwise differences, the mean or 'average' number of pairwise differences is used. This is simply the sum of the pairwise differences divided by the number of pairs, and is signified by $\pi$ .

The purpose of Tajima's test is to identify sequences which do not fit the neutral theory model at equilibrium between mutation and genetic drift. In order to perform the test on a DNA sequence or gene, you need to sequence homologous DNA for at least 3 individuals. Tajima's test compares a standardized measure of the total number of segregating sites (these are DNA sites that are polymorphic) in the sampled DNA and the average number of mutations between pairs in the sample. If these two numbers are the same (or close enough that the difference between them is less that two standard deviations from the average), then the null hypothesis of neutrality cannot be rejected. Otherwise, the null hypothesis of neutrality is rejected.

## Hypothetical example

Each chromosome in the human genome can be represented as a long DNA sequence. Genes represent 2% of this sequence, while much of the other 98% is "junk DNA" not coding a functional protein. Genes are under selection, while the junk evolves randomly.

Lets say that you are a genetic researcher who finds two mutations, a mutation in a gene which causes pre-natal death and a mutation in junk DNA which has no effect on human health or survival. You publish your findings in a scientific journal, identifying the first mutation as "under negative selection" and the second as "neutral". The neutral mutation gets passed on from one generation to the next, while the mutation under negative selection disappears, since anyone with the mutation cannot reproduce and pass it on to the next generation.

In order to back your discovery with more scientific evidence, you gather DNA samples from 100 people and determine the exact DNA sequence for the gene in each of these 100. Using all 100 DNA samples as input, you determine Tajima's D on both the gene and the junk DNA. If your hypothesis was correct, then Tajima's Test will output "neutral" for the junk DNA and "non-neutral" for the gene.

## Scientific explanation

Under the neutral theory model, for a population at constant size at equilibrium: $E[\pi ]=\theta =E[{\frac {S}{\sum _{i=1}^{n-1}{\frac {1}{i}}}}]=4N\mu$ for diploid DNA, and $E[\pi ]=\theta =E[{\frac {S}{\sum _{i=1}^{n-1}{\frac {1}{i}}}}]=2N\mu$ for haploid. But, selection, demographic fluctuations and other violations of the neutral model (including rate heterogeneity and introgression) will change the expected values of $S$ and $\pi$ , so that they are no longer expected to be equal. The difference in the expectations for these two variables (which can be positive or negative) is the crux of Tajima's D test statistic.

$D\,$ is calculated by taking the difference between the two estimates of the population genetics parameter $\theta \,$ . This difference is called $d\,$ , and D is calculated by dividing $d\,$ by the square root its variance ${\sqrt {{\hat {V}}(d)}}$ (its standard deviation, by definition).

$D={\frac {d}{\sqrt {{\hat {V}}(d)}}}$ Fumio Tajima demonstrated by computer simulation that the $D\,$ statistic described above could be modeled using a beta distribution. If the $D\,$ value for a sample of sequences is outside the confidence interval then one can reject the null hypothesis of neutral mutation for the sequence in question.

## Statistical test

When performing a statistical test such as Tajima's D, you have a 'null hypothesis', an 'alternative hypothesis', a distribution and a confidence interval. The uppercase D calculated in the example below represents "how many standard deviations from the mean your lower-case d is". In the example below the answer was 2 standard deviations. To keep matters simple, lets just say that this is "really far" from the mean. Thus the chances of "randomly" getting a D of 2 or greater is extremely rare, (lets say 1%). Thus the value of D obtained is outside of the 99% confidence interval for the "null hypothesis". Thus the conclusion of the experiment is to "reject the null hypothesis."

In Tajima's Test, the null hypothesis is neutral evolution. This means that the 4 polymorphisms in the example have no effect on evolutionary fitness, hence their frequency in the population fluctuates randomly from one generation to the next. In the example below, we reject the null hypothesis, thus there is some evolutionary pressure on the genetic sequence in the example.
In other words, our unknown genetic sequence has some (still unknown) function, which causes its population frequency to deviate from what we'd expect for a neutral sequence.

## Mathematical details

$D={\frac {d}{\sqrt {{\hat {V}}(d)}}}={\frac {{\hat {k}}-{\frac {S}{a_{1}}}}{\sqrt {[e_{1}S+e_{2}S(S-1)]}}}$ where

 $e_{1}={\frac {c_{1}}{a_{1}}}$ $e_{2}={\frac {c_{2}}{a_{1}^{2}+a_{2}}}$ $c_{1}=b_{1}-{\frac {1}{a_{1}}}$ $c_{2}=b_{2}-{\frac {n+2}{a_{1}n}}+{\frac {a_{2}}{a_{1}^{2}}}$ $b_{1}={\frac {n+1}{3(n-1)}}$ $b_{2}={\frac {2(n^{2}+n+3)}{9n(n-1)}}$ $a_{1}=\sum _{i=1}^{n-1}{\frac {1}{i}}$ $a_{2}=\sum _{i=1}^{n-1}{\frac {1}{i^{2}}}$ ${\hat {k}}\,$ and ${\frac {S}{a_{1}}}$ are two estimates of the expected number of single nucleotide polymorphisms (SNPs)between two DNA sequences under the neutral mutation model in a sample size $n\,$ from an effective population size $N\,$ The first estimate is the average number of SNPs found in (n choose 2) pairwise comparisons of sequences $(i,j)$ in the sample

${\hat {k}}={\frac {\sum \sum _{i The second estimate is derived from the expected value of $S\,$ , the total number of polymorphisms in the sample

$E(S)=a_{1}M\,$ Tajima defines $M=4N\mu \,$ , whereas Hartl & Clark use a different symbol to define the same parameter $\theta =4N\mu \,$ .

## Historical example

The genetic mutation which causes sickle-cell anemia is non-neutral because it affects survival and fitness. People homozygous for the mutation have the sickle-cell disease, while those heterozygous do not have the disease, but instead are resistant to malaria. People without the mutation (homozygous for the wild-type allele) do not have the disease, but are at higher risk for malaria disease. Thus in Africa, where there is a prevalence of the malaria mosquito, there is a selective advantage for heterozygous individuals. Meanwhile, in countries such as the USA where the risk of malaria infection is low, the population frequency of the mutation is lower.

## Example

Lets say you are a geneticist studying an unknown gene. As part of your research you get DNA samples from four random people (plus yourself). To make things simple, you label your sequence as a string of zero's, and for the other four people you put a zero when their DNA is the same as yours and a one when it is different.

Position 12345 67890 12345 67890
Person Y 00000 00000 00000 00000
Person A 00100 00000 00100 00010
Person B 00000 00000 00100 00010
Person C 00000 01000 00000 00010
Person D 00000 01000 00100 00010

The first thing you notice is the four polymorphic sites (positions where someone differs from you, positions 3, 7, 13 and 19 above). The second step is to compare each pair of sequences and get the average number of polymorphisms between two sequences.
There are "five choose two" (ten) comparisons that need to be done.
Person Y is you! You vs A
Person Y 00000 00000 00000 00000
Person A 00100 00000 00100 00010
3 polymorphisms
You vs B
Person Y 00000 00000 00000 00000
Person B 00000 00000 00100 00010
2 polymorphisms
You vs C
Person Y 00000 00000 00000 00000
Person C 00000 01000 00000 00010
2 polymorphisms
You vs D
Person Y 00000 00000 00000 00000
Person D 00000 01000 00100 00010
3 polymorphisms
A vs B
Person A 00100 00000 00100 00010
Person B 00000 00000 00100 00010
1 polymorphisms
A vs C
Person A 00100 00000 00100 00010
Person C 00000 01000 00000 00010
3 polymorphisms
A vs D
Person A 00100 00000 00100 00010
Person D 00000 01000 00100 00010
2 polymorphisms
B vs C
Person B 00000 00000 00100 00010
Person C 00000 01000 00000 00010
2 polymorphisms
B vs D
Person B 00000 00000 00100 00010
Person D 00000 01000 00100 00010
1 polymorphisms
C vs D
Person C 00000 01000 00000 00010
Person D 00000 01000 00100 00010
1 polymorphisms

Now we add up the number calculate the average (3 + 2 + 2 + 3 + 1 + 3 + 2 + 2 + 1 + 1 )/ 10 = 2
Lowercase d described above is the difference between these two numbers, the average number of polymorphisms found in pairwise comparison (2) and the total number of polymorphic sites (4). Thus d=2-4=-2

Since this is a statistical test, you need to divide lower-case d by its standard deviation to get upper-case D. Lets say that someone else already did this calculation for you, and obtained a standard deviation of 1. Thus Tajima's D for your set of sequences is -2
.