-
Notifications
You must be signed in to change notification settings - Fork 29
Method `baltic.tree.treeStats`
Barney Potter edited this page Oct 14, 2024
·
1 revision
The treeStats()
method in the BALTIC tree
class provides a summary of various statistics and characteristics of the phylogenetic tree. It's useful for quickly understanding the structure and properties of a tree.
def treeStats(self)
This method doesn't take any parameters.
- Traverses the tree to ensure all attributes are up to date.
- Calculates and prints the following information:
- Tree height
- Tree length (sum of all branch lengths)
- Whether the tree is strictly bifurcating
- Whether the tree is a multitype tree
- Whether the tree is a singleton (consists of a single tip)
- Presence of annotations (traits)
- Number of objects in the tree (total, nodes, and leaves)
- Quick inspection of a newly created or imported tree.
- Verifying tree properties after manipulation operations.
- Debugging tree-related issues.
- Reporting tree characteristics in publications or analyses.
# Assuming we have a tree object
tree.treeStats()
# This will print output similar to:
# Tree height: 10.234567
# Tree length: 25.678901
# strictly bifurcating tree
# annotations present
#
# Numbers of objects in tree: 100 (49 nodes and 51 leaves)
- This method prints its output directly and doesn't return any values.
- It automatically calls
traverse_tree()
to ensure all tree attributes are up to date before calculating statistics. - The "strictly bifurcating" property means that each internal node has exactly two children.
- A "multitype" tree contains nodes with only one child, which can occur after certain tree manipulations or in some specialized analyses.
- A "singleton" tree consists of only a single tip (leaf) node.
- The presence of annotations indicates that at least some nodes or leaves have additional data stored in their
traits
dictionaries.
Wiki written with the assistance of claude.ai 3.5 "Sonnet".
- Core
baltic
classes:-
Class
tree
- Tree Construction and Manipulation methods
- Tree Analysis methods
- Tree Conversion and Output methods
- Tree Visualization
- Utility Methods
- Class
leaf
- Class
node
- Class
clade
- Class
reticulation
-
Class