skbio.tree.TreeNode.unpack

TreeNode.unpack()[source]

Unpack an internal node in place.

State: Experimental as of 0.5.3.

Notes

This function sequentially: 1) elongates child nodes by branch length of self (omit if there is no branch length), 2) removes self from parent node, and 3) grafts child nodes to parent node.

Raises:ValueError – if input node is root or tip

Examples

>>> from skbio import TreeNode
>>> tree = TreeNode.read(['((c:2.0,d:3.0)a:1.0,(e:2.0,f:1.0)b:2.0);'])
>>> tree.find('b').unpack()
>>> print(tree)
((c:2.0,d:3.0)a:1.0,e:4.0,f:3.0);
<BLANKLINE>