4 * Copyright (c) 2007 Des Higgins, Julie Thompson and Toby Gibson.
7 * This is the interface class for the clustering part of the code. The 3 public functions
8 * are the 3 things that can be done. 1) Generate a tree from alignment (treeFromAlignment),
9 * 2) Generate a tree from a distance matrix (treeFromDistMatrix), or
10 * 3) Bootstrap a tree (bootstrapTree).
12 #ifndef CLUSTALTREEBASE_H
13 #define CLUSTALTREEBASE_H
20 #include "../alignment/Alignment.h"
22 #include "ClusterTreeOutput.h"
23 #include "../general/OutputFile.h"
24 #include "ClusterTreeAlgorithm.h"
38 protected: // This is because we will have a derived class that needs these.
40 void overspillMessage(int overspill,int total_dists);
41 void treeGapDelete(clustalw::Alignment *alignPtr);
42 int dnaDistanceMatrix(ofstream* treeFile, clustalw::Alignment *alignPtr);
43 int protDistanceMatrix(ofstream* treeFile, clustalw::Alignment *alignPtr);
44 bool isAmbiguity(int c);
45 void calcPercIdentity(ofstream* pfile, clustalw::Alignment *alignPtr);
46 void compareTree(clustalw::PhyloTree* tree1, clustalw::PhyloTree* tree2, vector<int>* hits, int n);
47 //string getOutputFileName(const string prompt, string path,
48 // const string fileExtension);
49 bool transition(int base1, int base2);
50 void distanceMatrixOutput(ofstream* outFile, clustalw::DistMatrix* matToPrint,
51 clustalw::Alignment *alignPtr);
52 bool openFilesForBootstrap(clustalw::OutputFile* clustalFile, clustalw::OutputFile* phylipFile,
53 clustalw::OutputFile* nexusFile, clustalw::TreeNames* treeNames, string* path);
54 bool openFilesForTreeFromAlignment(clustalw::OutputFile* clustalFile, clustalw::OutputFile* phylipFile,
55 clustalw::OutputFile* distFile, clustalw::OutputFile* nexusFile, clustalw::OutputFile* pimFile,
56 clustalw::TreeNames* treeNames, string* path);
57 int calcQuickDistMatForAll(ofstream* clustalFile, ofstream* phylipFile,
58 ofstream* nexusFile, ofstream* pimFile,
59 ofstream* distFile, clustalw::Alignment* alignPtr);
61 int calcQuickDistMatForSubSet(ofstream* clustalFile, ofstream* phylipFile,
62 ofstream* nexusFile, clustalw::Alignment* alignPtr,
63 bool inBootLoop = false);
64 void printBootstrapHeaderToClustalFile(ofstream* clustalFile);
65 void promptForBoolSeedAndNumTrials();
66 void printErrorMessageForBootstrap(int totalOverspill, int totalDists, int nfails);
67 bool checkIfConditionsMet(int numSeqs, int min);
69 ClusterTreeAlgorithm* clusAlgorithm;
70 auto_ptr<clustalw::DistMatrix> quickDistMat;
72 vector<int> bootTotals;
73 vector<int> bootPositions;
79 string bootstrapPrompt;
80 string bootstrapFileTypeMsg;