Taxonomy
See Also
Taxonomy functions are implemented as part of SampleCollection
. For more
information, see SampleCollection.
tree_build
- SampleCollection.tree_build()
Build a tree from the taxonomy data present in this object.
This is designed for use with ClassificationsDataFrame or SampleCollection.
Returns
skbio.tree.TreeNode, the root node of a tree that contains all the taxa in the current analysis and their parents leading back to the root node.
tree_prune_rank
- SampleCollection.tree_prune_rank(tree, rank='species')
Prune tips off a TreeNode tree not at specified rank.
Takes a TreeNode tree and prunes off any tips below the specified rank, leaving behind all nodes /at/ the specified rank and their parents.
Parameters
- treeskbio.tree.TreeNode
The root node of the tree to perform this operation on.
- rank{kingdom’, ‘phylum’, ‘class’, ‘order’, ‘family’, ‘genus’, ‘species’}, optional
Analysis will be restricted to abundances of taxa at the specified level.
Returns
skbio.tree.TreeNode, the root of the tree where all tips are at the given rank, and all tips have a path back to the root node.
Examples
tree_prune_rank(tree, ‘species’) will remove all subspecies/strain nodes and return a tree containing all genus-level nodes and higher.
tree_prune_tax_ids
- SampleCollection.tree_prune_tax_ids(tree, tax_ids)
Prune a tree back to contain only the tax_ids in the list and their parents.
Parameters
- treeskbio.tree.TreeNode
The root node of the tree to perform this operation on.
- tax_idslist
A list of taxonomic IDs to keep in the tree.
Returns
skbio.tree.TreeNode, the root of a tree containing the given taxonomic IDs and their parents, leading back to the root node.