biopython v1.71.0 Bio.Phylo.Consensus

Classes and methods for finding consensus trees.

This module contains a _BitString class to assist the consensus tree searching and some common consensus algorithms such as strict, majority rule and adam consensus.

Link to this section Summary

Functions

Generates a branch length dict for a tree, keyed by BitStrings

Create a BitString representing a clade, given ordered tree taxon names

Count distinct clades (different sets of terminal names) in the trees

Are two trees are equal in terms of topology and branch lengths

Recursive function of adam consensus algorithm

Extract a compatible subclade that only contains the given terminal names

Create a dict of a tree’s clades to corresponding BitStrings

Search Adam Consensus tree from multiple trees

Generate bootstrap replicates from a multiple sequence alignment object

Consensus tree of a series of bootstrap trees for a multiple sequence alignment

Generate bootstrap replicate trees from a multiple sequence alignment

Calculate branch support for a target tree given bootstrap replicate trees

Search majority rule consensus tree from multiple trees

Search strict consensus tree from multiple trees

Link to this section Functions

Link to this function _bitstring_topology()

Generates a branch length dict for a tree, keyed by BitStrings.

Create a dict of all clades’ BitStrings to the corresponding branch lengths (rounded to 5 decimal places).

Link to this function _clade_to_bitstr()

Create a BitString representing a clade, given ordered tree taxon names.

Link to this function _count_clades()

Count distinct clades (different sets of terminal names) in the trees.

Return a tuple first a dict of bitstring (representing clade) and a tuple of its count of occurrences and sum of branch length for that clade, second the number of trees processed.

:Parameters:

trees : iterable
    An iterable that returns the trees to count
Link to this function _equal_topology()

Are two trees are equal in terms of topology and branch lengths.

(Branch lengths checked to 5 decimal places.)

Recursive function of adam consensus algorithm

Extract a compatible subclade that only contains the given terminal names

Link to this function _tree_to_bitstrs()

Create a dict of a tree’s clades to corresponding BitStrings.

Link to this function adam_consensus()

Search Adam Consensus tree from multiple trees

:Parameters:

trees : list
    list of trees to produce consensus tree.

Generate bootstrap replicates from a multiple sequence alignment object

:Parameters:

msa : MultipleSeqAlignment
    multiple sequence alignment to generate replicates.
times : int
    number of bootstrap times.
Link to this function bootstrap_consensus()

Consensus tree of a series of bootstrap trees for a multiple sequence alignment

:Parameters:

msa : MultipleSeqAlignment
    Multiple sequence alignment to generate replicates.
times : int
    Number of bootstrap times.
tree_constructor : TreeConstructor
    Tree constructor to be used to build trees.
consensus : function
    Consensus method in this module: `strict_consensus`,
    `majority_consensus`, `adam_consensus`.
Link to this function bootstrap_trees()

Generate bootstrap replicate trees from a multiple sequence alignment.

:Parameters:

msa : MultipleSeqAlignment
    multiple sequence alignment to generate replicates.
times : int
    number of bootstrap times.
tree_constructor : TreeConstructor
    tree constructor to be used to build trees.

Calculate branch support for a target tree given bootstrap replicate trees.

:Parameters:

target_tree : Tree
    tree to calculate branch support for.
trees : iterable
    iterable of trees used to calculate branch support.
len_trees : int
    optional count of replicates in trees. len_trees must be provided
    when len(trees) is not a valid operation.
Link to this function majority_consensus()

Search majority rule consensus tree from multiple trees.

This is a extend majority rule method, which means the you can set any cutoff between 0 ~ 1 instead of 0.5. The default value of cutoff is 0 to create a relaxed binary consensus tree in any condition (as long as one of the provided trees is a binary tree). The branch length of each consensus clade in the result consensus tree is the average length of all counts for that clade.

:Parameters:

trees : iterable
    iterable of trees to produce consensus tree.
Link to this function strict_consensus()

Search strict consensus tree from multiple trees.

:Parameters:

trees : iterable
    iterable of trees to produce consensus tree.