scikit-bio is back in active development! Check out our announcement of revitalization.

skbio.tree.TreeNode.compare_subsets#

TreeNode.compare_subsets(other, exclude_absent_taxa=False)[source]#

Return fraction of overlapping subsets where self and other differ.

Names present in only one of the two trees will count as mismatches, if you don’t want this behavior, strip out the non-matching tips first.

Parameters:
otherTreeNode

The tree to compare

exclude_absent_taxabool

Strip out names that don’t occur in both trees

Returns:
float

The fraction of overlapping subsets that differ between the trees

Examples

>>> from skbio import TreeNode
>>> tree1 = TreeNode.read(["((a,b),(c,d));"])
>>> tree2 = TreeNode.read(["(((a,b),c),d);"])
>>> tree1.compare_subsets(tree2)
0.5