skbio.tree.TreeNode.unpack#
- TreeNode.unpack(uncache=True)[source]#
Unpack an internal node in place.
- Parameters:
- uncachebool, optional
Whether to clear caches of the tree if present (default: True). See
details
.Added in version 0.6.3.
- Raises:
- ValueError
If input node is root or tip.
See also
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);