Package Bio :: Package Phylo :: Module Consensus
[hide private]
[frames] | no frames]

Module Consensus

source code

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.

Classes [hide private]
  _BitString
Assistant class of binary string data used for storing and counting compatible clades in consensus tree searching.
Functions [hide private]
 
strict_consensus(trees)
Search strict consensus tree from multiple trees.
source code
 
majority_consensus(trees, cutoff=0)
Search majority rule consensus tree from multiple trees.
source code
 
adam_consensus(trees)
Search Adam Consensus tree from multiple trees
source code
 
_part(clades)
recursive function of adam consensus algorithm
source code
 
_sub_clade(clade, term_names)
extract a compatible subclade that only contains the given terminal names...
source code
 
_count_clades(trees)
Count distinct clades (different sets of terminal names) in the trees.
source code
 
get_support(target_tree, trees)
Calculate branch support given a target tree and a list of bootstrap replicate trees
source code
 
bootstrap(msa, times)
yield a series of bootstrap replicates from a multiple sequence alignment object
source code
 
bootstrap_trees(msa, times, tree_constructor)
Yield a series of bootstrap replicate trees from a multiple sequence alignment.
source code
 
bootstrap_consensus(msa, times, tree_constructor, consensus)
get the consensus tree of a series of bootstrap trees for a multiple sequence alignment
source code
 
_clade_to_bitstr(clade, tree_term_names)
Create a BitString representing a clade, given ordered tree taxon names.
source code
 
_tree_to_bitstrs(tree)
Create a dict of a tree's clades to corresponding BitStrings.
source code
 
_bitstring_topology(tree)
Create a dict of all clades' BitStrings to the corresponding branch lengths (rounded to 5 decimal places).
source code
 
_equal_topology(tree1, tree2)
True if two trees are equal in terms of topology and branch lengths (to 5 decimal places).
source code
Variables [hide private]
  __package__ = 'Bio.Phylo'
Function Details [hide private]

strict_consensus(trees)

source code 
Search strict consensus tree from multiple trees.

:Parameters:
    trees: list
        list of trees to produce consensus tree.

majority_consensus(trees, cutoff=0)

source code 
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: list
        list of trees to produce consensus tree.

adam_consensus(trees)

source code 
Search Adam Consensus tree from multiple trees

:Parameters:
    trees: list
        list of trees to produce consensus tree.

_sub_clade(clade, term_names)

source code 
extract a compatible subclade that only contains the given terminal names
    

_count_clades(trees)

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

Return a dict of bitstring (representing clade) and a tuple of its count of
occurrences and sum of branch length for that clade.

get_support(target_tree, trees)

source code 
Calculate branch support given a target tree and a list of bootstrap
replicate trees

:Parameters:
    target_tree: Tree
    trees: list
        list of trees calculate branch support.

bootstrap(msa, times)

source code 
yield a series of bootstrap replicates from a multiple sequence
alignment object

:Parameters:
    msa: MultipleSeqAlignment
        multiple sequence alignment to generate replicates.
    times: int
        number of bootstrap times.

bootstrap_trees(msa, times, tree_constructor)

source code 
Yield a series of 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.

bootstrap_consensus(msa, times, tree_constructor, consensus)

source code 
get the 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`.