Neighbor-joining
Inference: Neighbor-Joining¶
Neighbor-joining infers a tree from a distance matrix without assuming a molecular clock.
In [ ]:
Copied!
import toytree
tree = toytree.rtree.unittree(8, seed=321)
dist = tree.distance.get_tip_distance_matrix()
nj = toytree.infer.neighbor_joining_tree(dist)
# optional: root the unrooted tree for display
nj = nj.mod.root_on_minimal_ancestor_deviation()
c, a, m = nj.draw(layout='r', tip_labels=True, scale_bar=True)
c
import toytree
tree = toytree.rtree.unittree(8, seed=321)
dist = tree.distance.get_tip_distance_matrix()
nj = toytree.infer.neighbor_joining_tree(dist)
# optional: root the unrooted tree for display
nj = nj.mod.root_on_minimal_ancestor_deviation()
c, a, m = nj.draw(layout='r', tip_labels=True, scale_bar=True)
c