gneiss.util.rename_internal_nodes

gneiss.util.rename_internal_nodes(tree, names=None, inplace=False)[source]

Names the internal according to level ordering.

The tree will be traversed in level order (i.e. top-down, left to right). If names is not specified, the node with the smallest label (y0) will be located at the root of the tree, and the node with the largest label will be located at bottom right corner of the tree.

Parameters:
  • tree (skbio.TreeNode) – Tree object where the leafs correspond to the features.
  • names (list, optional) – List of labels to rename the tip names. It is assumed that the names are listed in level ordering, and the length of the list is at least as long as the number of internal nodes.
  • inplace (bool, optional) – Specifies if the operation should be done on the original tree or not.
Returns:

Tree with renamed internal nodes.

Return type:

skbio.TreeNode

Raises:

ValueError: – Raised if tree and name have incompatible sizes.