PTreeGenerator
1.0
Simple phylogenetic tree generation from multiple sequence alignment.
|
Represents a solution to the large parsimony problem (the tree toplogy is unknown as oposed to the small parsimony problem). More...
Public Member Functions | |
def | __init__ |
Initializes the members used during the computation. | |
def | tree |
A getter for the obtained consensus tree. | |
def | cost |
A getter for the parsimony score of the computed tree. | |
def | quartetPuzzling |
Iteratively applies the quartet puzzling heuristic to obtain intermediate tree topologies. | |
def | getOptimalQuartets |
Finds the optimal topologies for every four taxa. |
Static Public Member Functions | |
def | getQuartetID |
Provides a unique identification of the quartet by sorting the names of the taxa in the quartet alphabetically and then concatenating their identification strings, hence allowing quartets to be identified with their respective taxa. | |
def | getTopologyID |
Provides a string that uniquely identifies a quartet topology. | |
def | treeFromQuartet |
Constructs a tree from the provided quartet. | |
def | increaseCostOnPath |
Finds a path between two vertices and then increases the weight of all edges on that path by one. |
Private Attributes | |
_qpSteps | |
The number of quartet puzzling steps to take. | |
_alignment | |
Reference to the multiple sequence alignment instance. | |
_sequencesDict | |
Associates sequence id string with a sequence instance. | |
_optimalQuartets | |
Associates every four taxa with their optimal quartet. | |
_tree | |
Reference to the tree that was computed in LargeParsimony::quartetPuzzling(). |
Represents a solution to the large parsimony problem (the tree toplogy is unknown as oposed to the small parsimony problem).
It implements the quartet puzzling heuristic to find a set of possible tree topologies and it then builds a consensus tree employing the 50% majority rule (implemented in ptreegen::utilities::tree_utils::findConsensusTree()).
For more information on the quartet puzzling algorithm see:
Strimmer, Korbinian, and Arndt Von Haeseler. Quartet puzzling: a quartet maximum-likelihood method for reconstructing tree topologies. Molecular Biology and Evolution 13.7 (1996): 964-969.
or the appropriate chapter in:
Bockenhauer, H.; Bongartz, D. Algorithmic Aspects of Bioinformatics, 1st ed.; Springer: Berlin, 1998.
Definition at line 136 of file parsimony.py.
def ptreegen.parsimony.LargeParsimony.__init__ | ( | self, | |
alignment, | |||
steps = 1000 |
|||
) |
Initializes the members used during the computation.
It also generates the optimal quartets by first computing the parsimony cost of all possible unique quartet combinations and then selecting the quartet with minimum parsimony cost for every four taxa.
alignment | multiple sequence alignment |
steps | number of possible tree topologies that will be generated |
Definition at line 147 of file parsimony.py.
def ptreegen.parsimony.LargeParsimony.cost | ( | self | ) |
A getter for the parsimony score of the computed tree.
Definition at line 176 of file parsimony.py.
References ptreegen.neighbor_joining.NeighborJoining._alignment, ptreegen.parsimony.SmallParsimony._alignment, ptreegen.parsimony.LargeParsimony._alignment, ptreegen.neighbor_joining.NeighborJoining.tree(), ptreegen.computation.Computation.tree, and ptreegen.parsimony.LargeParsimony.tree().
def ptreegen.parsimony.LargeParsimony.getOptimalQuartets | ( | self, | |
quartets | |||
) |
Finds the optimal topologies for every four taxa.
quartets | all possible unique combinations of taxa of size four |
Definition at line 244 of file parsimony.py.
References ptreegen.neighbor_joining.NeighborJoining._alignment, ptreegen.parsimony.SmallParsimony._alignment, ptreegen.parsimony.LargeParsimony._alignment, ptreegen.parsimony.LargeParsimony.getQuartetID(), ptreegen.parsimony.LargeParsimony.getTopologyID(), and ptreegen.parsimony.LargeParsimony.treeFromQuartet().
|
static |
Provides a unique identification of the quartet by sorting the names of the taxa in the quartet alphabetically and then concatenating their identification strings, hence allowing quartets to be identified with their respective taxa.
Note that the taxa identification strings should be unique in order to eliminate collisions.
quartet | quartet to be identified |
Definition at line 287 of file parsimony.py.
Referenced by ptreegen.parsimony.LargeParsimony.getOptimalQuartets(), and ptreegen.parsimony.LargeParsimony.quartetPuzzling().
|
static |
Provides a string that uniquely identifies a quartet topology.
Quartet topology does not depend on the order of the first two and the last two elements in the quartet. This method is needed to distinguish two quartets of the same four taxa that have different topologies.
It also allows to have the first two and last two elements of the quartet in an arbitrary order.
quartet | quartet to be identified |
Definition at line 307 of file parsimony.py.
Referenced by ptreegen.parsimony.LargeParsimony.getOptimalQuartets(), and ptreegen.parsimony.LargeParsimony.quartetPuzzling().
|
static |
Finds a path between two vertices and then increases the weight of all edges on that path by one.
tree | reference to any vertex of the processed tree |
start | reference to the start node |
dest | reference to the end node |
Definition at line 341 of file parsimony.py.
Referenced by ptreegen.parsimony.LargeParsimony.quartetPuzzling().
def ptreegen.parsimony.LargeParsimony.quartetPuzzling | ( | self, | |
steps | |||
) |
Iteratively applies the quartet puzzling heuristic to obtain intermediate tree topologies.
Implemented as described in:
Bockenhauer, H.; Bongartz, D. Algorithmic Aspects of Bioinformatics, 1st ed.; Springer: Berlin, 1998.
steps | number of puzzling steps (equals the number of intermediate tree topologies) |
Definition at line 190 of file parsimony.py.
References ptreegen.parsimony.LargeParsimony._optimalQuartets, ptreegen.parsimony.LargeParsimony.getQuartetID(), ptreegen.parsimony.LargeParsimony.getTopologyID(), ptreegen.parsimony.LargeParsimony.increaseCostOnPath(), and ptreegen.parsimony.LargeParsimony.treeFromQuartet().
Referenced by ptreegen.parsimony.LargeParsimony.tree().
def ptreegen.parsimony.LargeParsimony.tree | ( | self | ) |
A getter for the obtained consensus tree.
Definition at line 162 of file parsimony.py.
References ptreegen.parsimony.LargeParsimony._qpSteps, ptreegen.parsimony.SmallParsimony._tree, ptreegen.parsimony.LargeParsimony._tree, and ptreegen.parsimony.LargeParsimony.quartetPuzzling().
Referenced by ptreegen.parsimony.LargeParsimony.cost().
|
static |
Constructs a tree from the provided quartet.
The tree is rooted so that it can be used in the Fitch's algorithm for solving the small parsimony problem.
quartet | quartet to be transformed |
Definition at line 319 of file parsimony.py.
Referenced by ptreegen.parsimony.LargeParsimony.getOptimalQuartets(), and ptreegen.parsimony.LargeParsimony.quartetPuzzling().
|
private |
Reference to the multiple sequence alignment instance.
Definition at line 149 of file parsimony.py.
Referenced by ptreegen.parsimony.LargeParsimony.cost(), and ptreegen.parsimony.LargeParsimony.getOptimalQuartets().
|
private |
Associates every four taxa with their optimal quartet.
Definition at line 154 of file parsimony.py.
Referenced by ptreegen.parsimony.LargeParsimony.quartetPuzzling().
|
private |
The number of quartet puzzling steps to take.
Definition at line 148 of file parsimony.py.
Referenced by ptreegen.parsimony.LargeParsimony.tree().
|
private |
Associates sequence id string with a sequence instance.
Definition at line 150 of file parsimony.py.
|
private |
Reference to the tree that was computed in LargeParsimony::quartetPuzzling().
Definition at line 155 of file parsimony.py.
Referenced by ptreegen.visualization.Visualization.printToStdout(), and ptreegen.parsimony.LargeParsimony.tree().