skbio.tree.bme#
- skbio.tree.bme(dm, allow_edge_estimation=True)[source]#
Perform balanced minimum evolution (BME) for phylogenetic reconstruction.
- Parameters:
- dmskbio.DistanceMatrix
Input distance matrix containing distances between taxa.
- allow_edge_estimationbool, optional
Whether to perform an OLS-based estimation of branch lengths (
True
, default) or return a tree without branch lengths assigned (False
).
- Returns:
- TreeNode
Reconstructed phylogenetic Tree with estimated edge values (if
allow_edge_estimation
isTrue
).
Notes
Balanced Minimum Evolution (BME) is a refinement of the distance-based minimum evolution problem where average distances between subtrees ignores the size of the subtrees. The BME algorithm implemented here uses the same OLS based edge estimation used with Greedy Minimum Evolution (GME).
References
[1]Desper R, Gascuel O. Fast and accurate phylogeny reconstruction algorithms based on the minimum-evolution principle. J Comput Biol. 2002;9(5):687-705. doi: 10.1089/106652702761034136. PMID: 12487758.
Examples
Define a new distance matrix object describing the distances between five taxa: human, monkey, pig, rat, and chicken.
>>> from skbio import DistanceMatrix >>> from skbio.tree import bme
>>> dm = DistanceMatrix([[0, 0.02, 0.18, 0.34, 0.55], ... [0.02, 0, 0.19, 0.35, 0.55], ... [0.18, 0.19, 0, 0.34, 0.54], ... [0.34, 0.35, 0.34, 0, 0.62], ... [0.55, 0.55, 0.54, 0.62, 0]], ... ['human','monkey','pig','rat','chicken'])
Perform Balanced Minimum Evoltuion (BME) and construct the minimum evolution tree representing the relationship between those taxa. This is returned as a TreeNode object.
>>> tree = bme(dm) >>> print(tree.ascii_art()) /-monkey -human--- /--------| | /-pig \--------| | /-chicken \--------| \-rat
Notice that, unlike neighbor joining, the tree is rooted at a taxa/leaf node. This will allow it to have nearest neighbor interchange performed on it without needing to re-root the tree.