skbio.core.tree.TreeNode.find_by_id

TreeNode.find_by_id(node_id)[source]

Find a node by id.

This search method is based from the root.

Parameters:

node_id : int

The id of a node in the tree

Returns:

TreeNode

The tree node with the matcing id

Raises:

MissingNodeError

This method will raise if the id cannot be found

See also

find, find_by_func

Examples

>>> from skbio.core.tree import TreeNode
>>> tree = TreeNode.from_newick("((a,b)c,(d,e)f);")
>>> print tree.find_by_id(2).name
d