File: ClusterTree.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 (84 lines) | stat: -rw-r--r-- 3,537 bytes parent folder | download | duplicates (11)
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
/**
 * Author: Mark Larkin
 * 
 * Copyright (c) 2007 Des Higgins, Julie Thompson and Toby Gibson.  
 */
/**
 * This is the interface class for the clustering part of the code. The 3 public functions
 * are the 3 things that can be done. 1) Generate a tree from alignment (treeFromAlignment), 
 * 2) Generate a tree from a distance matrix (treeFromDistMatrix), or
 * 3) Bootstrap a tree (bootstrapTree).
 **/
#ifndef CLUSTALTREEBASE_H
#define CLUSTALTREEBASE_H

#include <fstream>
#include <memory>
#include <iostream>
#include <vector>
#include <exception>
#include "../alignment/Alignment.h"
#include "NJTree.h"
#include "ClusterTreeOutput.h"
#include "../general/OutputFile.h"
#include "ClusterTreeAlgorithm.h"
#include <string>

namespace clustalw
{
class OutputFile;

class ClusterTree
{
    public:
        /* Functions */
        ClusterTree(); 
        /* Attributes */

    protected: // This is because we will have a derived class that needs these. 
        /* Functions */
        void overspillMessage(int overspill,int total_dists);
        void treeGapDelete(clustalw::Alignment *alignPtr);   
        int dnaDistanceMatrix(ofstream* treeFile, clustalw::Alignment *alignPtr);
        int protDistanceMatrix(ofstream* treeFile, clustalw::Alignment *alignPtr);
        bool isAmbiguity(int c);
        void calcPercIdentity(ofstream* pfile, clustalw::Alignment *alignPtr);
        void compareTree(clustalw::PhyloTree* tree1, clustalw::PhyloTree* tree2, vector<int>* hits, int n);
        //string getOutputFileName(const string prompt, string path, 
        //                              const string fileExtension);
        bool transition(int base1, int base2);
        void distanceMatrixOutput(ofstream* outFile, clustalw::DistMatrix* matToPrint,
                                  clustalw::Alignment *alignPtr);
        bool openFilesForBootstrap(clustalw::OutputFile* clustalFile, clustalw::OutputFile* phylipFile,
                         clustalw::OutputFile* nexusFile, clustalw::TreeNames* treeNames, string* path);
        bool openFilesForTreeFromAlignment(clustalw::OutputFile* clustalFile, clustalw::OutputFile* phylipFile,
                            clustalw::OutputFile* distFile, clustalw::OutputFile* nexusFile, clustalw::OutputFile* pimFile, 
                            clustalw::TreeNames* treeNames, string* path);
        int calcQuickDistMatForAll(ofstream* clustalFile, ofstream* phylipFile, 
                                   ofstream* nexusFile, ofstream* pimFile, 
                                   ofstream* distFile, clustalw::Alignment* alignPtr);
                                   
        int calcQuickDistMatForSubSet(ofstream* clustalFile, ofstream* phylipFile, 
                                      ofstream* nexusFile, clustalw::Alignment* alignPtr, 
                                      bool inBootLoop = false);
        void printBootstrapHeaderToClustalFile(ofstream* clustalFile);
        void promptForBoolSeedAndNumTrials();
        void printErrorMessageForBootstrap(int totalOverspill, int totalDists, int nfails);
        bool checkIfConditionsMet(int numSeqs, int min);
        /* Attributes */
        ClusterTreeAlgorithm* clusAlgorithm;
        auto_ptr<clustalw::DistMatrix> quickDistMat;
        
        vector<int> bootTotals; 
        vector<int> bootPositions;
        bool verbose;
        vector<int> treeGaps; 
        int numSeqs;
        int firstSeq;
        int lastSeq;
        string bootstrapPrompt;
        string bootstrapFileTypeMsg;
};

}
#endif