Page 15
Problem 1.4 Graph the frequencies of homozygotes and heterozygotes as a function of the allele frequency, p. At what allele frequency is the frequency of heterozygotes maximized?
Note:
According to the Hardy-Weinberg law, p2+2pg+q2=1, where 2pq is the frequency of heterozygotes. q=1-p, so to maximize 2pq is to maximize 2p(1-p), so p=0.5. When p=0.5, it has the maximum heterozygosity 0.5.
In fact, for any multi-allelic system, heterozygosity is greatest when p1 = p2 = p3 = ….pk, that is, when the allele frequencies are equal. [1]
Use python to draw the graph:
import numpy as np
from matplotlib import pyplot as plt
fig = plt.figure(figsize=(12, 6))
p = np.arange(-1, 2, 0.1)
plt.plot(p, p*(1-p), color='red')
plt.xlabel('p')
plt.ylabel('p*(1-p)')
plt.show()
Output:
