rooted_tree Class Reference

class rooted_tree

Rooted phylogenetic tree.

This class is used to represent the phylogenetic tree of a single locus. It is possible to print the tree in Newick format, to get the subtree spanned by some of the leaves, and to look at the tree nodes and edges.

__str__() <==> str(x)
__repr__() <==> repr(x)
external_branch_length()

Measure the length of the external branches.

Returns:
  • length: the sum of the lengths of the external branches.
total_branch_length()

Measure the length of the branches.

Returns:
  • length: the sum of the lengths of all branches.
calc_weight_distribution(subtree_root)

Recalculate the weight of some internal nodes.

Parameters:
  • subtree_root: the tree_key of the node whose hanging subtree is recalculated
Returns:
  • error code: zero if successful
ancestors_at_age(age, subtree)

Find nodes in subtree younger than a certain age

Parameters:
  • age: critical age to check
  • subtree: subtree to look for nodes in
Returns:
  • ancestors: the ancestors at that age
create_subtree_from_keys(leaves)

Create a subtree from a list of leaves.

Parameters:
  • leaves: the leaves used to contruct the subtree
Returns:
  • subtree: the subtree spanned by those leaves.

Note

leaves can be a Python list or a numpy array of tree_key, or a vector_tree_key.

print_newick()

Print the tree in Newick format.

Returns:
  • tree: string of the tree in Newick format.

Note

You can pipe the output of this function to a cStingIO.StringIO for further manipulations.

subtree_newick(subtree_root)

Print a subtree in Newick format.

Parameters:
  • subtree_root: tree_key of the root of the subtree to print
Returns:
  • subtree: string of the subtree in Newick format.

Note

You can pipe the output of this function to a cStingIO.StringIO for further manipulations.

to_Biopython_tree()

Convert the tree into Biopython format

Returns:
  • tree: Biopython.Phylo phylogenetic tree representation of self
edges

Nodes of the tree

nodes

Nodes of the tree

leafs

Leaves of the tree

Previous topic

polymorphism Class Reference

Next topic

stat Class Reference

This Page