biopython v1.71.0 Bio.Phylo.TreeConstruction.ParsimonyTreeConstructor

Parsimony tree constructor.

:Parameters:

searcher : TreeSearcher
    tree searcher to search the best parsimony tree.
starting_tree : Tree
    starting tree provided to the searcher.

Example


 >>> from Bio import AlignIO
 >>> from TreeConstruction import *
 >>> aln = AlignIO.read(open('Tests/TreeConstruction/msa.phy'), 'phylip')
 >>> print aln
 SingleLetterAlphabet() alignment with 5 rows and 13 columns
 AACGTGGCCACAT Alpha
 AAGGTCGCCACAC Beta
 GAGATTTCCGCCT Delta
 GAGATCTCCGCCC Epsilon
 CAGTTCGCCACAA Gamma
 >>> starting_tree = Phylo.read('Tests/TreeConstruction/nj.tre', 'newick')
 >>> print tree
 Tree(weight=1.0, rooted=False)
     Clade(branch_length=0.0, name='Inner3')
         Clade(branch_length=0.01421, name='Inner2')
             Clade(branch_length=0.23927, name='Inner1')
                 Clade(branch_length=0.08531, name='Epsilon')
                 Clade(branch_length=0.13691, name='Delta')
             Clade(branch_length=0.29231, name='Alpha')
         Clade(branch_length=0.07477, name='Beta')
         Clade(branch_length=0.17523, name='Gamma')
 >>> from TreeConstruction import *
 >>> scorer = ParsimonyScorer()
 >>> searcher = NNITreeSearcher(scorer)
 >>> constructor = ParsimonyTreeConstructor(searcher, starting_tree)
 >>> pars_tree = constructor.build_tree(aln)
 >>> print pars_tree
 Tree(weight=1.0, rooted=True)
     Clade(branch_length=0.0)
         Clade(branch_length=0.197335, name='Inner1')
             Clade(branch_length=0.13691, name='Delta')
             Clade(branch_length=0.08531, name='Epsilon')
         Clade(branch_length=0.041935, name='Inner2')
             Clade(branch_length=0.01421, name='Inner3')
                 Clade(branch_length=0.17523, name='Gamma')
                 Clade(branch_length=0.07477, name='Beta')
             Clade(branch_length=0.29231, name='Alpha')

Link to this section Summary

Functions

Initialize the class

Build the tree

Link to this section Functions

Initialize the class.

Build the tree.

:Parameters:

alignment : MultipleSeqAlignment
    multiple sequence alignment to calculate parsimony tree.