Methods for Tree- and Clade-based classes.
This lets Tree and Clade support the same traversal and searching
operations without requiring Clade to inherit from Tree, so Clade isn't
required to have all of Tree's attributes -- just 'root' (a Clade
instance) and 'is_terminal()'.
|
_filter_search(self,
filter_func,
order,
follow_attrs)
Perform a BFS or DFS traversal through all elements in this tree. |
source code
|
|
|
find_any(self,
*args,
**kwargs)
Return the first element found by find_elements(), or None. |
source code
|
|
|
find_elements(self,
target=None,
terminal=None,
order=' preorder ' ,
**kwargs)
Find all tree elements matching the given attributes. |
source code
|
|
|
find_clades(self,
target=None,
terminal=None,
order=' preorder ' ,
**kwargs)
Find each clade containing a matching element. |
source code
|
|
|
get_path(self,
target=None,
**kwargs)
List the clades directly between the root and the given target. |
source code
|
|
|
get_nonterminals(self,
order=' preorder ' )
Get a list of all of this tree's nonterminal (internal) nodes. |
source code
|
|
|
get_terminals(self,
order=' preorder ' )
Get a list of all of this tree's terminal (leaf) nodes. |
source code
|
|
|
trace(self,
start,
finish)
List of all clade object between two targets in this tree. |
source code
|
|
|
|
|
count_terminals(self)
Counts the number of terminal (leaf) nodes within this tree. |
source code
|
|
|
depths(self,
unit_branch_lengths=False)
Create a mapping of tree clades to depths (by branch length). |
source code
|
|
|
distance(self,
target1,
target2=None)
Calculate the sum of the branch lengths between two targets. |
source code
|
|
|
is_bifurcating(self)
Return True if tree downstream of node is strictly bifurcating. |
source code
|
|
|
|
|
|
|
is_preterminal(self)
True if all direct descendents are terminal. |
source code
|
|
|
total_branch_length(self)
Calculate the sum of all the branch lengths in this tree. |
source code
|
|
|
collapse(self,
target=None,
**kwargs)
Deletes target from the tree, relinking its children to its parent. |
source code
|
|
|
|
|
ladderize(self,
reverse=False)
Sort clades in-place according to the number of terminal nodes. |
source code
|
|
|
prune(self,
target=None,
**kwargs)
Prunes a terminal clade from the tree. |
source code
|
|
|
split(self,
n=2,
branch_length=1.0)
Speciation: generate n (default 2) new descendants. |
source code
|
|
Inherited from object :
__delattr__ ,
__format__ ,
__getattribute__ ,
__hash__ ,
__init__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__repr__ ,
__setattr__ ,
__sizeof__ ,
__str__ ,
__subclasshook__
|