Trees | Index | Help |
---|
Package Bio :: Package Nexus :: Module Trees :: Class Tree |
|
Chain
--+
|
Tree
Method Summary | |
---|---|
Ntree(self,tree). | |
Short version of to_string(), gives plain tree | |
Move values stored in data.branchlength to data.support, and set branchlength to 0.0 | |
Return the common ancestor that connects to nodes. | |
Convert absolute support (clade-count) to rel. | |
Quick and dirty lists of all nodes. | |
Add and return the sum of the branchlengths between two nodes. | |
Return a list of all otus downwards from a node (self, node_id). | |
Return a list of all terminal nodes. | |
Return True if tree downstream of node is strictly bifurcating. | |
Compares branches with support>threshold for compatibility. | |
Compare tree and tree2 for identity. | |
Return node_id of common ancestor if taxon_list is monophyletic, -1 otherwise. | |
Return the instance of node_id. | |
Prunes a terminal taxon from the tree. | |
Generates a random tree with ntax taxa and/or taxa from taxlabels. | |
root_with_outgroup(self,
outgroup)
| |
Returns the first matching taxon in self.data.taxon. | |
Return subtree as a set of nested sets. | |
Speciation: generates n (default two) descendants of a node. | |
Adds up the branchlengths from root (default self.root) to node. | |
Return a paup compatible tree line. | |
Defines a unrooted Tree structure, using data of a rooted Tree. | |
Adds leaf or tree (in newick format) to a parent_id. | |
Extracts values (support/branchlength) from xx[:yyy], xx. | |
Parses (a,b,c...)[[[xx]:]yy] into subcomponents and travels down recursively. | |
Return all node_ids downwards from a node. | |
Inherited from Chain | |
Attaches node to another: (self, node, prev). | |
Return a list of all node ids. | |
Deletes node from chain and relinks successors to predecessor: collapse(self, id). | |
Check if grandchild is a subnode of parent: is_parent_of(self,parent,grandchild). | |
Kills a node from chain without caring to what it is connected: kill(self,id). | |
Connects son to parent: link(self,son,parent). | |
Returns a list of all node_ids between two nodes (excluding start, including end): trace(start,end). | |
Disconnects node from his predecessor: unlink(self,id). | |
Gets a new id for a node in the chain. |
Method Details |
---|
__init__(self,
tree=None,
weight=1.0,
rooted=False,
name='',
data=<class Bio.Nexus.Trees.NodeData at 0x1ef13b0>,
values_are_support=False,
max_support=1.0)
Ntree(self,tree).
|
__str__(self)
Short version of to_string(), gives plain tree
|
branchlength2support(self)Move values stored in data.branchlength to data.support, and set branchlength to 0.0 This is necessary when support has been stored as branchlength (e.g. paup), and has thus been read in as branchlength. |
common_ancestor(self, node1, node2)Return the common ancestor that connects to nodes. node_id = common_ancestor(self,node1,node2) |
convert_absolute_support(self, nrep)Convert absolute support (clade-count) to rel. frequencies. Some software (e.g. PHYLIP consense) just calculate how often clades appear, instead of calculating relative frequencies. |
display(self)Quick and dirty lists of all nodes. |
distance(self, node1, node2)Add and return the sum of the branchlengths between two nodes. dist = distance(self,node1,node2) |
get_taxa(self, node_id=None)Return a list of all otus downwards from a node (self, node_id). nodes = get_taxa(self,node_id=None) |
get_terminals(self)Return a list of all terminal nodes. |
is_bifurcating(self, node=None)Return True if tree downstream of node is strictly bifurcating. |
is_compatible(self, tree2, threshold, strict=True)Compares branches with support>threshold for compatibility. result = is_compatible(self,tree2,threshold) |
is_identical(self, tree2)Compare tree and tree2 for identity. result = is_identical(self,tree2) |
is_monophyletic(self, taxon_list)Return node_id of common ancestor if taxon_list is monophyletic, -1 otherwise. result = is_monophyletic(self,taxon_list) |
node(self, node_id)Return the instance of node_id. node = node(self,node_id) |
prune(self, taxon)Prunes a terminal taxon from the tree. id_of_previous_node = prune(self,taxon) If taxon is from a bifurcation, the connectiong node will be collapsed and its branchlength added to remaining terminal node. This might be no longer a meaningful value' |
randomize(self, ntax=None, taxon_list=None, branchlength=1.0, branchlength_sd=None, bifurcate=True)Generates a random tree with ntax taxa and/or taxa from taxlabels. new_tree = randomize(self,ntax=None,taxon_list=None,branchlength=1.0,branchlength_sd=None,bifurcate=True) Trees are bifurcating by default. (Polytomies not yet supported). |
search_taxon(self, taxon)Returns the first matching taxon in self.data.taxon. Not restricted to terminal nodes. node_id = search_taxon(self,taxon) |
set_subtree(self, node)Return subtree as a set of nested sets. sets = set_subtree(self,node) |
split(self, parent_id=None, n=2, branchlength=1.0)Speciation: generates n (default two) descendants of a node. [new ids] = split(self,parent_id=None,n=2,branchlength=1.0): |
sum_branchlength(self, root=None, node=None)Adds up the branchlengths from root (default self.root) to node. sum = sum_branchlength(self,root=None,node=None) |
to_string(self, support_as_branchlengths=False, branchlengths_only=False, plain=True, plain_newick=False)Return a paup compatible tree line. to_string(self,support_as_branchlengths=False,branchlengths_only=False,plain=True) |
unroot(self)Defines a unrooted Tree structure, using data of a rooted Tree. |
_add_subtree(self, parent_id=None, tree=None)Adds leaf or tree (in newick format) to a parent_id. (self,parent_id,tree). |
_get_values(self, text)Extracts values (support/branchlength) from xx[:yyy], xx. |
_parse(self, tree)Parses (a,b,c...)[[[xx]:]yy] into subcomponents and travels down recursively. |
_walk(self, node=None)Return all node_ids downwards from a node. |
Trees | Index | Help |
---|
Generated by Epydoc 2.1 on Mon Aug 27 16:12:12 2007 | http://epydoc.sf.net |