File: TreeInterface.h

package info (click to toggle)
clustalx 2.1%2Blgpl-9
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 3,324 kB
  • sloc: cpp: 40,050; sh: 163; xml: 102; makefile: 16
file content (156 lines) | stat: -rw-r--r-- 8,206 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
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 <vector>
#include <string>
#include <memory>
#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<AlignmentSteps> getWeightsAndStepsFromDistMat(vector<int>* seqWeights, 
                                                          DistMatrix* distMat, 
                                                          Alignment *alignPtr, 
                                                          int seq1, int nSeqs, 
                                                          string* phylipName, bool* success);
        /**
         * This will be called by sequencesAlignToProfile and QTcalcWeightsForLowScoreSeg
         */        
        void getWeightsFromDistMat(vector<int>* seqWeights, DistMatrix* distMat, 
                                   Alignment *alignPtr, int seq1, int nSeqs, 
                                   string* phylipName, bool* success);
                                   
        void getWeightsForQtLowScore(vector<int>* seqWeights, DistMatrix* distMat, 
                                   Alignment *alignPtr, int seq1, int nSeqs, 
                                   string* phylipName, bool* success);
                                   
        /**
         * This function will be called from doAlignUseOldTree
         */                                                  
        auto_ptr<AlignmentSteps> getWeightsAndStepsFromTree(Alignment* alignPtr, 
                                                DistMatrix* distMat, string* treeName,
                                                vector<int>* 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<int>* 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<int>* p1Weights, string* p2TreeName, 
                    vector<int>* 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<AlignmentSteps> getWeightsAndStepsFromDistMatNJ(vector<int>* seqWeights, 
                                                          DistMatrix* distMat, 
                                                          Alignment *alignPtr, 
                                                          int seq1, int nSeqs, 
                                                          string* phylipName, bool* success);
        
        auto_ptr<AlignmentSteps> getWeightsAndStepsUseOldGuideTreeNJ(DistMatrix* distMat, 
                                                   Alignment *alignPtr,  string* treeName,
                                                   vector<int>* seqWeights, 
                                                   int fSeq, int nSeqs, bool* success);
                                                             
        int readTreeAndCalcWeightsNJ(Tree* groupTree, Alignment* alignPtr, 
                            DistMatrix* distMat, string* treeName, vector<int>* seqWeights,
                            int fSeq, int nSeqs);
        
        int getWeightsFromGuideTreeNJ(Alignment* alignPtr, DistMatrix* distMat,
                                      string* treeName, vector<int>* seqWeights, int fSeq,
                                      int nSeqs, bool* success);
        
        void getWeightsFromDistMatNJ(vector<int>* seqWeights, DistMatrix* distMat, 
                                   Alignment *alignPtr, int seq1, int nSeqs, 
                                   string* phylipName, bool* success); 
        
        void getWeightsForProfileAlignNJ(Alignment* alignPtr, DistMatrix* distMat, 
                             string* p1TreeName, vector<int>* p1Weights, string* p2TreeName, 
                    vector<int>* 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<AlignmentSteps> getWeightsAndStepsFromTreeNJ(Alignment* alignPtr, 
                               DistMatrix* distMat, string* treeName,
                               vector<int>* seqWeights, int fSeq, int numSeqs, bool* success);
        
        /** UPGMA functions */
        auto_ptr<AlignmentSteps> getWeightsAndStepsFromDistMatUPGMA(vector<int>* seqWeights, 
                                 DistMatrix* distMat, Alignment *alignPtr, 
                                 int seq1, int nSeqs, string* phylipName, bool* success);
                                 
        auto_ptr<AlignmentSteps> generateTreeFromDistMatUPGMA(RootedGuideTree* guideTree,
                             DistMatrix* distMat, Alignment *alignPtr, int seq1, int nSeqs, 
                                            string* phylipName, bool* success);
                                 
        void getWeightsFromDistMatUPGMA(vector<int>* seqWeights, DistMatrix* distMat, 
                                   Alignment *alignPtr, int seq1, int nSeqs, 
                                   string* phylipName, bool* success); 
                                   
        void getWeightsForProfileAlignUPGMA(Alignment* alignPtr, DistMatrix* distMat, 
                             string* p1TreeName, vector<int>* p1Weights, string* p2TreeName, 
                    vector<int>* p2Weights, int numSeqs, int profile1NumSeqs, bool useTree1, 
                    bool useTree2, bool* success);                                
};
}
#endif