Find total descending branch length from self or subset of self tips
Parameters: | tip_subset : Iterable, or None
|
---|---|
Returns: | float
|
Raises: | ValueError
|
Notes
This function replicates cogent’s totalDescendingBranch Length method and extends that method to allow the calculation of total descending branch length of a subset of the tips if requested. The postorder guarantees that the function will always be able to add the descending branch length if the node is not a tip.
Nodes with no length will have their length set to 0. The root length (if it exists) is ignored.
Examples
>>> from six import StringIO
>>> from skbio import TreeNode
>>> tr = TreeNode.read(StringIO("(((A:.1,B:1.2)C:.6,(D:.9,E:.6)F:.9)G"
... ":2.4,(H:.4,I:.5)J:1.3)K;"))
>>> tdbl = tr.descending_branch_length()
>>> sdbl = tr.descending_branch_length(['A','E'])
>>> print(tdbl, sdbl)
8.9 2.2