skbio.tree.TreeNode.append#

TreeNode.append(node, uncache=True)[source]#

Add a node to self’s children.

Parameters:
nodeTreeNode

Node to add as a child.

uncachebool, optional

Whether to clear caches of the tree if present (default: True). See details.

Added in version 0.6.3.

See also

extend

Notes

This method will add the node to the end of self’s children. If the incoming node is within another tree, it will be disconnected from its original parent, if any, but its children will be preserved. Therefore, this method is able to move an entire clade.

The uncache parameter applies to both donor and recipient trees.

Examples

>>> from skbio import TreeNode
>>> root = TreeNode(name="root")
>>> child1 = TreeNode(name="child1")
>>> child2 = TreeNode(name="child2")
>>> root.append(child1)
>>> root.append(child2)
>>> print(root)
(child1,child2)root;