skbio.tree.TreeNode.tips#
- TreeNode.tips(include_self=False)[source]#
Iterate over tips descended from the current node.
- Parameters:
- include_selfbool, optional
Whether to include the initial node if it is a tip (default: False).
- Yields:
- TreeNode
Visited tip.
Notes
Nodes are ordered by a postorder traversal of the tree. The order is consistent between calls.
If self is a tip, it won’t be yieled unless include_self is True.
Examples
>>> from skbio import TreeNode >>> tree = TreeNode.read(["((a,b)c,(d,e)f);"]) >>> print(tree.ascii_art()) /-a /c-------| | \-b ---------| | /-d \f-------| \-e
>>> for node in tree.tips(): ... print(node.name) a b d e