skbio.tree.TreeNode.accumulate_to_ancestor¶

TreeNode.accumulate_to_ancestor(ancestor)[source]

Return the sum of the distance between self and ancestor

State: Experimental as of 0.4.0.

Parameters

ancestor (TreeNode) – The node of the ancestor to accumulate distance too

Returns

The sum of lengths between self and ancestor

Return type

float

Raises
• NoParentError – A NoParentError is raised if the ancestor is not an ancestor of self

• NoLengthError – A NoLengthError is raised if one of the nodes between self and ancestor (including self) lacks a length attribute

Examples

>>> from skbio import TreeNode