1 /** 2 * Author: Mark Larkin 3 * 4 * Copyright (c) 2007 Des Higgins, Julie Thompson and Toby Gibson. 5 */ 6 /** 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). 11 **/ 12 #ifndef CLUSTALTREEBASE_H 13 #define CLUSTALTREEBASE_H 14 15 #include <fstream> 16 #include <memory> 17 #include <iostream> 18 #include <vector> 19 #include <exception> 20 #include "../alignment/Alignment.h" 21 #include "NJTree.h" 22 #include "ClusterTreeOutput.h" 23 #include "../general/OutputFile.h" 24 #include "ClusterTreeAlgorithm.h" 25 #include <string> 26 27 namespace clustalw 28 { 29 class OutputFile; 30 31 class ClusterTree 32 { 33 public: 34 /* Functions */ 35 ClusterTree(); 36 /* Attributes */ 37 38 protected: // This is because we will have a derived class that needs these. 39 /* Functions */ 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); 60 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); 68 /* Attributes */ 69 ClusterTreeAlgorithm* clusAlgorithm; 70 auto_ptr<clustalw::DistMatrix> quickDistMat; 71 72 vector<int> bootTotals; 73 vector<int> bootPositions; 74 bool verbose; 75 vector<int> treeGaps; 76 int numSeqs; 77 int firstSeq; 78 int lastSeq; 79 string bootstrapPrompt; 80 string bootstrapFileTypeMsg; 81 }; 82 83 } 84 #endif 85