Skip to main content

Module phylogenetic_trees

Module phylogenetic_trees 

Source
Expand description

Phylogenetic tree construction from a distance matrix: UPGMA and neighbor joining.

See the book entry Hierarchical clustering and phylogenetic trees.

Structs§

PhylogeneticTree
A weighted tree over leaves labelled leaves (ids 0..leaves) and internal nodes (ids leaves..). UPGMA trees are rooted; neighbour-joining trees are unrooted and are drawn rooted at the final join for printing.

Functions§

neighbor_joining
Neighbour joining (Saitou and Nei): repeatedly joins the pair that minimises the total tree length, using the net divergence of each taxon to correct for unequal rates. Returns an unrooted tree and recovers the true tree exactly from additive distances.
upgma
UPGMA (unweighted pair group method with arithmetic mean): repeatedly merges the two closest clusters, placing the new node at half their distance, and averages distances weighted by cluster size. Assumes a constant evolutionary rate (a molecular clock) and returns a rooted, ultrametric tree; it is exact when the input is ultrametric.