Skip to main content

Table 1 Built-in functions and tree methods

From: Bio.Phylo: A unified toolkit for processing, analyzing and visualizing phylogenetic trees in Biopython

Source

Function

Description

Bio.Phylo

read

Parse a file in the given format and return a single tree.

Bio.Phylo

parse

Iteratively parse a file and return each of the trees it contains.

Bio.Phylo

write

Write a sequence of trees to file in the given format.

Bio.Phylo

convert

Convert between two tree file formats.

Bio.Phylo

draw

Plot the given tree using matplotlib (or pylab).

Bio.Phylo

draw_ascii

Draw an ascii-art phylogram of the given tree.

Bio.Phylo

draw_graphviz

Display a tree or clade as a graph, using the graphviz engine.

Bio.Phylo

to_networkx

Convert a Tree object to a NetworkX graph object.

Bio.Phylo.BaseTree

TreeMixin

find_elements

Find all tree elements matching the given attributes.

TreeMixin

find_clades

Find each clade containing a matching element.

TreeMixin

find_any

Return the first matching element found by find_elements, if any.

TreeMixin

get_path

List the clades directly between the current node and the target.

TreeMixin

get_nonterminals

List of all of the tree or clade’s internal nodes.

TreeMixin

get_terminals

List of all of the tree or clade’s “leaf” nodes.

TreeMixin

trace

List of all clade object between two targets in the tree/clade.

TreeMixin

common_ancestor

Most recent common ancestor (clade) of all the given targets.

TreeMixin

count_terminals

Count the number of terminal nodes within the tree.

TreeMixin

depths

Create a mapping of tree clades to depths (by branch length).

TreeMixin

distance

Calculate the sum of the branch lengths between two targets.

TreeMixin

is_bifurcating

Return True if tree downstream of node is strictly bifurcating.

TreeMixin

is_monophyletic

If the given terminals comprise a complete subclade, return the MRCA.

TreeMixin

is_parent_of

True if target is a descendent of the tree.

TreeMixin

is_preterminal

True if all direct descendents are terminal.

TreeMixin

total_branch_length

Calculate the sum of all the branch lengths in the tree.

TreeMixin

collapse

Deletes target from the tree, relinking its children to its parent.

TreeMixin

collapse_all

Collapse all the descendents of the tree, leaving only terminals.

TreeMixin

ladderize

Sort clades in-place according to the number of terminal nodes.

TreeMixin

prune

Prunes a terminal clade from the tree.

TreeMixin

split

Generate n (default 2) new descendants.

Tree, Clade

is_terminal

True if the node has no descendents.

Tree

root_with_outgroup

Reroot the tree with the specified outgroup clade.

Tree

root_at_midpoint

Reroot the tree at the midpoint between the two most distant terminals.

Tree

format

Serialize the tree as a string in the specified file format.

Tree

as_phyloxml

Convert the tree to its PhyloXML subclass equivalent.

Tree

from_clade

Create a new Tree object given a clade.

Tree

randomized

Create a randomized bifurcating tree, given a list of taxa.

Bio.Phylo.PhyloXML

Phylogeny

to_alignment

Construct an alignment from the aligned sequences in this tree.

Bio.Phylo.PAML

chi2

cdf_chi2

χ2 cumulative distribution function, for log-likelihood ratio tests.

baseml

read

Parse a BASEML results file.

codeml

read

Parse a CODEML results file.

yn00

read

Parse a yn00 results file.

_paml.Paml

write_ctl_file

Dynamically build a program-specific control file.

_paml.Paml

read_ctl_file

Parse a control file to create a program-specific class instance.

_paml.Paml

print_options

Print all of the program options and their current settings.

_paml.Paml

set_options

Set the value of a program option.

_paml.Paml

get_option

Return the value of a program option.

_paml.Paml

get_all_options

Return the current values of all the program options.

_paml.Paml

run

Run a PAML program and parse the results.

  1. Public methods and functions provided in the Bio.Phylo module and sub-modules. An up-to-date version of this information is available at http://biopython.org/DIST/docs/api/.