X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=website%2Farchive%2Fbinaries%2Fmac%2Fsrc%2Fclustalw%2Fsrc%2Ftree%2FTreeInterface.h;fp=website%2Farchive%2Fbinaries%2Fmac%2Fsrc%2Fclustalw%2Fsrc%2Ftree%2FTreeInterface.h;h=d4c64a2fded2a07a5eb92a6c4244fdfd07d3c03f;hb=dbde3fb6f00b9bb770343631a517c0e599db8528;hp=0000000000000000000000000000000000000000;hpb=85f830bbd51a7277994bd4233141016304e210c9;p=jabaws.git diff --git a/website/archive/binaries/mac/src/clustalw/src/tree/TreeInterface.h b/website/archive/binaries/mac/src/clustalw/src/tree/TreeInterface.h new file mode 100644 index 0000000..d4c64a2 --- /dev/null +++ b/website/archive/binaries/mac/src/clustalw/src/tree/TreeInterface.h @@ -0,0 +1,156 @@ +/** + * Author: Mark Larkin + * + * Copyright (c) 2007 Des Higgins, Julie Thompson and Toby Gibson. + */ +/** + * Changes: + * Mark 10-5-2007: Bug fix # 42. Added getWeightsForQtLowScore function. + * + * + */ +#ifndef TREEINTERFACE_H +#define TREEINTERFACE_H + +#include +#include +#include +#include "AlignmentSteps.h" +#include "../alignment/Alignment.h" +#include "../general/clustalw.h" + +namespace clustalw +{ + +using namespace std; +class Tree; +class RootedGuideTree; + +class TreeInterface +{ + public: + /** + * This function will be used to generate the phylogenetic tree from the distMat using + * either UPGMA or NJ. It will then calculate the seqWeights and the steps. + * Note the Distmat + * will be in similarity form after this. It will no longer be distances!!!!! + */ + auto_ptr getWeightsAndStepsFromDistMat(vector* seqWeights, + DistMatrix* distMat, + Alignment *alignPtr, + int seq1, int nSeqs, + string* phylipName, bool* success); + /** + * This will be called by sequencesAlignToProfile and QTcalcWeightsForLowScoreSeg + */ + void getWeightsFromDistMat(vector* seqWeights, DistMatrix* distMat, + Alignment *alignPtr, int seq1, int nSeqs, + string* phylipName, bool* success); + + void getWeightsForQtLowScore(vector* seqWeights, DistMatrix* distMat, + Alignment *alignPtr, int seq1, int nSeqs, + string* phylipName, bool* success); + + /** + * This function will be called from doAlignUseOldTree + */ + auto_ptr getWeightsAndStepsFromTree(Alignment* alignPtr, + DistMatrix* distMat, string* treeName, + vector* seqWeights, int fSeq, + int numSeqs, bool* success); + + /** + * This function will be called from sequencesAlignToProfile, it doesnt calc the + * steps. + */ + int getWeightsFromGuideTree(Alignment* alignPtr, DistMatrix* distMat, + string* treeName, vector* seqWeights, int fSeq, + int nSeqs, bool* success); + /** + * This function is used to generate 2 guide trees for the profile align part. + * IT must be done on its own. It calls calcPairwiseForProfileAlign in MSA. + * It is called by profileAlign and removeFirstIterate. + */ + void getWeightsForProfileAlign(Alignment* alignPtr, DistMatrix* distMat, + string* p1TreeName, vector* p1Weights, string* p2TreeName, + vector* p2Weights, int numSeqs, int profile1NumSeqs, bool useTree1, + bool useTree2, bool* success); + /** + * This function is used to generate the guide tree from the distance matrix. + * It doesnt return + * any seqWeights or AlignmentSteps. It will be used by doGuideTreeOnly + */ + void generateTreeFromDistMat(DistMatrix* distMat, Alignment *alignPtr, + int seq1, int nSeqs, + string* phylipName, bool* success); + + /** + * This function is to simply to call either the UPGMA or NJ version of + * this function, and print out all the trees. It will be called + * from phylogeneticTree in the clustal class. + */ + void treeFromAlignment(TreeNames* treeNames, Alignment *alignPtr); + + /** + * This function will be used to bootstrap the tree and output the results. + * It will use either + * UPGMA or NJ for the bootstrapping, depending on what is selected. + */ + void bootstrapTree(TreeNames* treeNames, Alignment *alignPtr); + + private: + auto_ptr getWeightsAndStepsFromDistMatNJ(vector* seqWeights, + DistMatrix* distMat, + Alignment *alignPtr, + int seq1, int nSeqs, + string* phylipName, bool* success); + + auto_ptr getWeightsAndStepsUseOldGuideTreeNJ(DistMatrix* distMat, + Alignment *alignPtr, string* treeName, + vector* seqWeights, + int fSeq, int nSeqs, bool* success); + + int readTreeAndCalcWeightsNJ(Tree* groupTree, Alignment* alignPtr, + DistMatrix* distMat, string* treeName, vector* seqWeights, + int fSeq, int nSeqs); + + int getWeightsFromGuideTreeNJ(Alignment* alignPtr, DistMatrix* distMat, + string* treeName, vector* seqWeights, int fSeq, + int nSeqs, bool* success); + + void getWeightsFromDistMatNJ(vector* seqWeights, DistMatrix* distMat, + Alignment *alignPtr, int seq1, int nSeqs, + string* phylipName, bool* success); + + void getWeightsForProfileAlignNJ(Alignment* alignPtr, DistMatrix* distMat, + string* p1TreeName, vector* p1Weights, string* p2TreeName, + vector* p2Weights, int numSeqs, int profile1NumSeqs, bool useTree1, + bool useTree2, bool* success); + + void generateTreeFromDistMatNJ(DistMatrix* distMat, Alignment *alignPtr, + int seq1, int nSeqs, string* phylipName, bool* success); + + auto_ptr getWeightsAndStepsFromTreeNJ(Alignment* alignPtr, + DistMatrix* distMat, string* treeName, + vector* seqWeights, int fSeq, int numSeqs, bool* success); + + /** UPGMA functions */ + auto_ptr getWeightsAndStepsFromDistMatUPGMA(vector* seqWeights, + DistMatrix* distMat, Alignment *alignPtr, + int seq1, int nSeqs, string* phylipName, bool* success); + + auto_ptr generateTreeFromDistMatUPGMA(RootedGuideTree* guideTree, + DistMatrix* distMat, Alignment *alignPtr, int seq1, int nSeqs, + string* phylipName, bool* success); + + void getWeightsFromDistMatUPGMA(vector* seqWeights, DistMatrix* distMat, + Alignment *alignPtr, int seq1, int nSeqs, + string* phylipName, bool* success); + + void getWeightsForProfileAlignUPGMA(Alignment* alignPtr, DistMatrix* distMat, + string* p1TreeName, vector* p1Weights, string* p2TreeName, + vector* p2Weights, int numSeqs, int profile1NumSeqs, bool useTree1, + bool useTree2, bool* success); +}; +} +#endif