4 * Copyright (c) 2007 Des Higgins, Julie Thompson and Toby Gibson.
8 * Mark 10-5-2007: Bug fix # 42. Added getWeightsForQtLowScore function.
12 #ifndef TREEINTERFACE_H
13 #define TREEINTERFACE_H
18 #include "AlignmentSteps.h"
19 #include "../alignment/Alignment.h"
20 #include "../general/clustalw.h"
27 class RootedGuideTree;
33 * This function will be used to generate the phylogenetic tree from the distMat using
34 * either UPGMA or NJ. It will then calculate the seqWeights and the steps.
36 * will be in similarity form after this. It will no longer be distances!!!!!
38 auto_ptr<AlignmentSteps> getWeightsAndStepsFromDistMat(vector<int>* seqWeights,
42 string* phylipName, bool* success);
44 * This will be called by sequencesAlignToProfile and QTcalcWeightsForLowScoreSeg
46 void getWeightsFromDistMat(vector<int>* seqWeights, DistMatrix* distMat,
47 Alignment *alignPtr, int seq1, int nSeqs,
48 string* phylipName, bool* success);
50 void getWeightsForQtLowScore(vector<int>* seqWeights, DistMatrix* distMat,
51 Alignment *alignPtr, int seq1, int nSeqs,
52 string* phylipName, bool* success);
55 * This function will be called from doAlignUseOldTree
57 auto_ptr<AlignmentSteps> getWeightsAndStepsFromTree(Alignment* alignPtr,
58 DistMatrix* distMat, string* treeName,
59 vector<int>* seqWeights, int fSeq,
60 int numSeqs, bool* success);
63 * This function will be called from sequencesAlignToProfile, it doesnt calc the
66 int getWeightsFromGuideTree(Alignment* alignPtr, DistMatrix* distMat,
67 string* treeName, vector<int>* seqWeights, int fSeq,
68 int nSeqs, bool* success);
70 * This function is used to generate 2 guide trees for the profile align part.
71 * IT must be done on its own. It calls calcPairwiseForProfileAlign in MSA.
72 * It is called by profileAlign and removeFirstIterate.
74 void getWeightsForProfileAlign(Alignment* alignPtr, DistMatrix* distMat,
75 string* p1TreeName, vector<int>* p1Weights, string* p2TreeName,
76 vector<int>* p2Weights, int numSeqs, int profile1NumSeqs, bool useTree1,
77 bool useTree2, bool* success);
79 * This function is used to generate the guide tree from the distance matrix.
81 * any seqWeights or AlignmentSteps. It will be used by doGuideTreeOnly
83 void generateTreeFromDistMat(DistMatrix* distMat, Alignment *alignPtr,
85 string* phylipName, bool* success);
88 * This function is to simply to call either the UPGMA or NJ version of
89 * this function, and print out all the trees. It will be called
90 * from phylogeneticTree in the clustal class.
92 void treeFromAlignment(TreeNames* treeNames, Alignment *alignPtr);
95 * This function will be used to bootstrap the tree and output the results.
97 * UPGMA or NJ for the bootstrapping, depending on what is selected.
99 void bootstrapTree(TreeNames* treeNames, Alignment *alignPtr);
102 auto_ptr<AlignmentSteps> getWeightsAndStepsFromDistMatNJ(vector<int>* seqWeights,
106 string* phylipName, bool* success);
108 auto_ptr<AlignmentSteps> getWeightsAndStepsUseOldGuideTreeNJ(DistMatrix* distMat,
109 Alignment *alignPtr, string* treeName,
110 vector<int>* seqWeights,
111 int fSeq, int nSeqs, bool* success);
113 int readTreeAndCalcWeightsNJ(Tree* groupTree, Alignment* alignPtr,
114 DistMatrix* distMat, string* treeName, vector<int>* seqWeights,
115 int fSeq, int nSeqs);
117 int getWeightsFromGuideTreeNJ(Alignment* alignPtr, DistMatrix* distMat,
118 string* treeName, vector<int>* seqWeights, int fSeq,
119 int nSeqs, bool* success);
121 void getWeightsFromDistMatNJ(vector<int>* seqWeights, DistMatrix* distMat,
122 Alignment *alignPtr, int seq1, int nSeqs,
123 string* phylipName, bool* success);
125 void getWeightsForProfileAlignNJ(Alignment* alignPtr, DistMatrix* distMat,
126 string* p1TreeName, vector<int>* p1Weights, string* p2TreeName,
127 vector<int>* p2Weights, int numSeqs, int profile1NumSeqs, bool useTree1,
128 bool useTree2, bool* success);
130 void generateTreeFromDistMatNJ(DistMatrix* distMat, Alignment *alignPtr,
131 int seq1, int nSeqs, string* phylipName, bool* success);
133 auto_ptr<AlignmentSteps> getWeightsAndStepsFromTreeNJ(Alignment* alignPtr,
134 DistMatrix* distMat, string* treeName,
135 vector<int>* seqWeights, int fSeq, int numSeqs, bool* success);
137 /** UPGMA functions */
138 auto_ptr<AlignmentSteps> getWeightsAndStepsFromDistMatUPGMA(vector<int>* seqWeights,
139 DistMatrix* distMat, Alignment *alignPtr,
140 int seq1, int nSeqs, string* phylipName, bool* success);
142 auto_ptr<AlignmentSteps> generateTreeFromDistMatUPGMA(RootedGuideTree* guideTree,
143 DistMatrix* distMat, Alignment *alignPtr, int seq1, int nSeqs,
144 string* phylipName, bool* success);
146 void getWeightsFromDistMatUPGMA(vector<int>* seqWeights, DistMatrix* distMat,
147 Alignment *alignPtr, int seq1, int nSeqs,
148 string* phylipName, bool* success);
150 void getWeightsForProfileAlignUPGMA(Alignment* alignPtr, DistMatrix* distMat,
151 string* p1TreeName, vector<int>* p1Weights, string* p2TreeName,
152 vector<int>* p2Weights, int numSeqs, int profile1NumSeqs, bool useTree1,
153 bool useTree2, bool* success);