-
Notifications
You must be signed in to change notification settings - Fork 0
Tree Calibration
Tree reconstruction algorithms estimate the evolutionary relationships between taxa from genetic distances. The resulting branch lengths represent relative evolutionary change, typically measured as substitutions per site, rather than absolute geological time.
Tree calibration converts these relative branch lengths into approximate divergence times by using one or more external estimates of when particular evolutionary events occurred.
The Molecular Clock project implements a simple educational calibration algorithm using a single calibration point.
Reconstruction algorithms such as UPGMA and Neighbor Joining can estimate the shape of an evolutionary tree from sequence data, but they cannot determine when each divergence occurred.
For example, a reconstructed branch length of:
0.05 substitutions per site
indicates that approximately five substitutions have occurred for every hundred nucleotide positions, but it does not indicate whether those substitutions accumulated over:
- 500 thousand years
- 5 million years
- 50 million years
To estimate geological time, the tree must be calibrated using independent evidence.
A calibration point associates one node in the reconstructed tree with a known or estimated age.
In this project, the calibration point is defined by:
- Two taxa
- Their most recent common ancestor (MRCA)
- An estimated divergence time expressed in millions of years
For example:
| Taxa | MRCA age |
|---|---|
| Taxon A, Taxon B | 20 million years |
The calibration algorithm locates the MRCA of the specified taxa and determines its reconstructed depth within the tree.
Suppose the reconstructed tree estimates that the calibration node lies:
0.08 substitutions per site
from the descendant taxa.
If that ancestor is known to have existed:
20 million years ago
then one unit of evolutionary distance corresponds to:
20 / 0.08 = 250 million years
This value is the global scaling factor.
Every branch length in the reconstructed tree is multiplied by this factor.
For example:
| Original branch length | Calibrated branch length |
|---|---|
| 0.02 | 5 million years |
| 0.04 | 10 million years |
| 0.08 | 20 million years |
The tree is therefore converted from relative evolutionary distance into estimated geological time.
The calibration procedure is straightforward:
- Parse the reconstructed Newick tree.
- Locate the MRCA of the selected taxa.
- Calculate the reconstructed depth of that node.
- Calculate the scaling factor
scale factor = calibration age / reconstructed node depth
- Multiply every branch length by the scaling factor.
- Export the calibrated tree together with calibration metadata.
The topology of the tree is unchanged.
Only the branch length units are modified.
Suppose a reconstructed tree contains:
((A:0.04,B:0.04):0.06,C:0.10);
If the MRCA of A and B is known to be 20 million years old, the reconstructed depth is:
0.04 + 0.04 = 0.08 substitutions per site
The scaling factor becomes:
20 / 0.08 = 250
The calibrated tree is therefore:
((A:10.0,B:10.0):15.0,C:25.0);
The branch lengths now represent estimated millions of years rather than substitutions per site.
Calibration relies on the molecular clock principle that genetic differences accumulate approximately in proportion to elapsed evolutionary time.
The calibration process estimates the conversion between:
- Substitutions per site
- Millions of years.
In this implementation a single global rate is assumed across the entire tree.
This is consistent with the assumptions made by UPGMA and provides a simple educational demonstration of molecular dating.
This implementation is intentionally simplified.
It assumes:
- A single calibration point
- A single global evolutionary rate
- An exact calibration age
- No uncertainty in branch lengths
Real molecular dating methods are considerably more sophisticated. Modern software such as BEAST simultaneously estimates evolutionary rates and divergence times using multiple calibration constraints, statistical models and Bayesian inference.
Those methods are beyond the scope of this project.
The objective of this implementation is not to produce publication-quality divergence dates.
Instead, it illustrates the final step in the molecular clock workflow:
Together with the simulation, distance estimation and reconstruction tools, calibration completes the educational pipeline from DNA sequence evolution to an approximately dated phylogenetic tree.