skbio.tree.TreeNode.unpack#

TreeNode.unpack()[source]#

Unpack an internal node in place.

Raises:
ValueError

If input node is root or tip.

Notes

This method 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.

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);