Last Week(7.15-7.21)

  • Rewrote and tested the ParsimonyScorer class with the combination of Fitch algorithm and Sankoff algorithm;
  • Implemented the NNITreeSearcher class for searching the best parsimony tree;
  • Restructured all parsimony classes and finished the ParsimonyTreeConstructor class.

This Week(7.22-7.28)

  • Write more tests for finished algorithms.
  • Write a binary class that will be used for clade storing and counting in the consensus tree searching algorithms.

Sample Usage for Parsimony Tree

    from Bio import AlignIO
    from Bio import Phylo
    from Bio.Phylo.TreeConstruction import Matrix
    from Bio.Phylo.TreeConstruction import ParsimonyScorer
    from Bio.Phylo.TreeConstruction import NNITreeSearcher
    from Bio.Phylo.TreeConstruction import ParsimonyTreeConstructor

    # alignment
    aln ='TreeConstruction/msa.phy'), 'phylip')
    # start tree
    tree ='./TreeConstruction/upgma.tre', 'newick')

    #create parsimony scorer from a penalty matrix
    alphabet = ['A', 'T', 'C', 'G']
    penalty_matrix = [[0],
                      [2.5,  0],
                      [2.5,   1,   0],
                      [  1, 2.5,  2.5, 0]]
    matrix = Matrix(alphabet, step_matrix)
    scorer = ParsimonyScorer(matrix)
    # create tree searcher of Nearest Neighbor Interchange
    searcher = NNITreeSearcher(scorer)
    # create parsimony tree constructor
    constructor = ParsimonyTreeConstructor(aln, searcher, tree)
    # build the best parsimony tree
    best_tree = constructor.build_tree()