In my population genetics book (see reference at bottom) they define them as:
- Nucleotide polymorphism (θ): proportion of nucleotide sites that are expected to be polymorphic in any sample of size 5 from this region. Of the genome. $\hat{θ}$ equals the proportion of nucleotide polymorphism observes in the sample (S) divided by $a_1 = \sum_{i=1}^{n-1} \frac{1}{I}$. If n= 5, $a_1 = \frac{1}{1}+ \frac{1}{2}+ \frac{1}{3}+ \frac{1}{4}+ \frac{1}{5}=2.083$
Nucleotide diversity is the average proportion of nucleotide differences between all possible pairs of sequences in the sample. In R, I came up with that code which is in accordance with what is in the book.
data # Only polymorphisms total.snp # This is the total number of sites that were looked (e.g. 16 might be polymorphic over the 500 sites that we've looked at. So 484 sites are monomorphic) n = nrow(data) # Number of samples pwcomp = n*(n-1)/2 # Number of pairwise comparisons for(i in 1:n.col){ # Compute the number of differences in the samples that are polymorphic t.v = as.vector(table(data[,i])) z = outer(t.v,t.v,'*') temp= c(temp,sum(z[lower.tri(z)])) } pi.hat = sum(temp)/(pwcomp*total.snp) # Nb of different pairwise comparison/(nb all pairwise comparison * total nb of loci (polymorphic or not))
In the book, they say
On the other hand, there is a theoretical relation between θ and π that is expected under simplifying assumption that the alleles are invisible to natural selection.
In summary θ = π with this assumption and large sample sizes.
- So what is the difference in the
- Why are we calculating both (what could they tell us)?
Hartl, D. L., & Clark, A. G. (1997). Principles of Population Genetics (3rd ed.). Sinauer Associates Incorporated.