skbio.tree.TreeNode.compare_subsets

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

Returns fraction of overlapping subsets where self and other differ.

State: Experimental as of 0.4.0.

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
  • other (TreeNode) – The tree to compare

  • exclude_absent_taxa (bool) – Strip out names that don’t occur in both trees

Returns

The fraction of overlapping subsets that differ between the trees

Return type

float

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