# Create MK contingency table
table <- matrix(c(6,4,2,6), ncol=2)
# Apply the Fisher test
fisher.test(table)$p.value
0.1879885
Standard MKT
The standard McDonald & Kreitman test (MKT) (McDonald and Kreitman, 1991) was developed to be applied to protein coding sequences, combining both divergence (D) and polymorphism (P) sites, and categorizing mutations as synonymous (P0, D0) and non-synonymous (Pi, Di). If all mutations are either strongly deleterious or neutral, then Di/D0 is expected to roughly equal Pi/P0. In contrast, if positive selection is operating in the region, adaptive mutations rapidly reach fixation and thus contribute relative more to divergence than to polymorphism when compared to neutral mutations, and then Di/D0>Pi/P0. Assuming that adaptive mutations contribute little to polymorphism but substantially to divergence, the proportion of non-synonymous substitutions than have been fixed by positive selection can be inferred as α=1-(Pi/P0×D0/Di) ( Smith and Eyre-Walker 2012).
Figure 1. McDonald and Kreitman test example. In the left part, an hipothetic tree which represents the divergence of two species. The polimorphic changes that occur in the focal species are represented with dots, while squares represents the fixed differences between the two species (divergence). The substitutions are classified depending on their effect, synonymous if they are neutral (represented in yellow) or non-synonymous if they change the aminoacid (represented in red). In the right part, the typical MK contingeny table, containing the total n umber of polymorphic and divergent sites which are synonymous and nonsynonymous.
In the example above, the α estimation is 0.778, as α=1-(4/6×2/6). The significance of the test can be easily quantified using a simple 2×2 contingency table using a Fischer's exact test. For example, using R: