Population Genetics Practical 12: Distances, rates and calibration
Learning objectives
Count differences on a declared alignment denominator; distinguish observed differences from substitution distance; apply a simple correction for repeated substitutions; convert a per-lineage rate to pairwise time; and examine sampling and calibration uncertainty.
An alignment specifies which positions are homologous. Here it is supplied rather than inferred. Count a difference only where both sequences have an unambiguous A, C, G or T. N and gaps are excluded; report their number rather than treating them as matches.
The observed fraction \(\hat p=K/L\) is often called the p-distance. It records different present-day states. It does not count every substitution along the path: a site can change more than once or return to its initial state.
Our exclusion rule defines the analysis set. If missing sites differ systematically from retained sites, this set need not represent the whole sequence. Multiple pairwise comparisons also require attention to whether their denominators cover the same positions.
2. Correct under a specified substitution model
The Jukes–Cantor model assumes equal equilibrium base frequencies, equal instantaneous rates between distinct bases and a constant rate across sites and along the compared path. If \(d\) is expected substitutions per site along that path,
d_grid <-seq(0,3,length.out=200)plot(d_grid,jc_difference(d_grid),type="l",lwd=2,col="#1b9e77",xlab="Path distance: expected substitutions per site",ylab="Expected fraction of different bases",ylim=c(0,0.8))abline(h=0.75,lty=2)points(d_hat,p_hat,pch=19)
At large distances, differences approach 0.75 even while substitutions continue accumulating. Near that limit, small changes in observed differences imply large changes in corrected distance. At or above 0.75, this inverse has no finite nonnegative distance estimate. Our helper rejects that input; it does not silently truncate it.
Question. Does the correction establish that these short sequences evolved under Jukes–Cantor?
Suggested answer
No. The correction assumes the model. The short example illustrates its algebra and is not a model adequacy assessment. Unequal base composition, unequal substitution types or variation among sites may require other models.
3. Keep rate units and the two-lineage factor explicit
Let \(r\) be the substitution rate per site per lineage per generation. Two lineages accumulating changes at this same rate for \(t\) generations have total path distance
\[d=rt+rt=2rt,\qquad t=d/(2r).\]
A substitution rate describes evolutionary changes along a lineage. Equating it to a mutation rate requires an appropriate neutral model and assumptions; we supply a hypothetical substitution rate directly here.
Show R code
rate <-1e-8# Generation length is supplied in years per generation.generation_years <-2time_generations <- d_hat/(2*rate)time_years <- time_generations*generation_yearsdata.frame(distance=d_hat,rate_per_site_per_lineage_per_generation=rate,generations=time_generations,years=time_years)
distance rate_per_site_per_lineage_per_generation generations years
1 0.1134232 1e-08 5671161 11342323
The rate is per site, matching the distance units. The alignment length does not enter the conversion again. If a supplied rate were already a pairwise rate, another factor of two would be incorrect. For unequal lineage rates, \(d=(r_1+r_2)t\) under the corresponding constant-rate model.
This path-time calculation dates the common ancestry of the compared sequences under the model. A species split is a different event: ancestral polymorphism can make sequence common ancestry older than population separation. The simple example has no ancestral-population model, so its result is not a species-divergence estimate.
4. Calibrate and examine sensitivity
Suppose an independent comparison has a known hypothetical path-time of two million generations and corrected distance 0.04. Under the same strict two-lineage clock, it calibrates \(r=0.04/(2\times2{,}000{,}000)\).
An older calibration at the same distance implies a slower rate and an older target time. These are sensitivity scenarios, not confidence limits. Transfer of a rate between comparisons assumes the same relevant evolutionary rate; this practical does not fit a relaxed clock or a phylogenetic tree.
5. Isolate finite-site sampling uncertainty
For this exercise, assume the \(L\) retained sites are independent and share a common mismatch probability. Then \(K\) is binomial. An exact binomial interval for \(p\) can be transformed to distance and time when its endpoints remain below 0.75.
The transformed interval is conditional on independent equal-rate sites, the substitution model and the fixed rate. It does not include calibration, alignment or evolutionary-model uncertainty. If an upper endpoint reaches 0.75, a finite upper distance bound cannot be obtained by this inversion; clipping it would hide the problem.
A small seeded simulation illustrates finite-site variation at a known distance. It simulates mismatch indicators under the declared model, rather than reconstructing sequence histories.
More independent sites reduce sampling variation in this example. They do not repair an incorrect clock or substitution model. The 200 draws are a teaching illustration, not a broad performance qualification.
Exercises
Estimate time from raw p-distance instead of corrected distance. Explain the direction of the difference.
Double the per-lineage rate while keeping distance fixed.
Calculate the JC distance at mismatch fraction 0.7, and explain why estimates near 0.75 are unstable.
Describe why a sequence common-ancestor time need not equal a species split time.
The raw fraction gives a smaller time under this model because it omits repeated substitutions. Doubling rate halves time. The correction grows rapidly near saturation: its derivative is \(1/(1-4p/3)\). Lineages sampled from different species can trace back through an ancestral population before the species separation; dating that process needs additional assumptions and information.
Package connections and next steps
These base R examples expose evolutionary-distance and sampling assumptions relevant to population-genetics teaching. They do not assume a gpop molecular-dating API. gsim breeding inheritance and gsel selection-policy responsibilities do not turn them into phylogenetic dating tools.
A further extension could compare an explicit unequal-rate model or add an ancestral coalescent model. Each changes the meaning of the estimated time and should be introduced as a new model rather than another unit conversion.