1 #ifndef DISTANCECOMMAND_H 2 #define DISTANCECOMMAND_H 3 4 /* 5 * distancecommand.h 6 * Mothur 7 * 8 * Created by Sarah Westcott on 5/7/09. 9 * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved. 10 * 11 */ 12 13 #include "mothur.h" 14 #include "command.hpp" 15 #include "validcalculator.h" 16 #include "calculator.h" 17 #include "sequencedb.h" 18 #include "ignoregaps.h" 19 #include "eachgapdist.h" 20 #include "eachgapignore.h" 21 #include "onegapdist.h" 22 #include "onegapignore.h" 23 #include "jtt.hpp" 24 #include "writer.h" 25 #include "proteindb.hpp" 26 #include "pmb.hpp" 27 #include "pam.hpp" 28 #include "kimura.hpp" 29 30 /**************************************************************************************************/ 31 struct distanceData { 32 long long startLine, endLine, numNewFasta, count; 33 float cutoff; 34 StorageDatabase* db; 35 StorageDatabase* oldFastaDB; 36 MothurOut* m; 37 OutputWriter* threadWriter; 38 string outputFileName, calc; 39 bool countends, prot; 40 Utils util; 41 distanceDatadistanceData42 distanceData(){} distanceDatadistanceData43 distanceData(OutputWriter* ofn) { 44 threadWriter = ofn; 45 m = MothurOut::getInstance(); 46 } 47 distanceDatadistanceData48 distanceData(string ofn) { 49 outputFileName = ofn; 50 m = MothurOut::getInstance(); 51 } setVariablesdistanceData52 void setVariables(int s, int e, float c, StorageDatabase*& dbsp, StorageDatabase*& oldfn, string Est, bool met, long long num, bool cnt) { 53 startLine = s; 54 endLine = e; 55 cutoff = c; 56 db = dbsp; 57 oldFastaDB = oldfn; 58 calc = Est; 59 prot = met; 60 numNewFasta = num; 61 countends = cnt; 62 count = 0; 63 } 64 }; 65 /**************************************************************************************************/ 66 class DistanceCommand : public Command { 67 68 public: 69 DistanceCommand(string); 70 DistanceCommand(StorageDatabase*&, string, double, string, int); //used by mothur's splitMatrix class to avoid rereading files ~DistanceCommand()71 ~DistanceCommand() {} 72 73 vector<string> setParameters(); getCommandName()74 string getCommandName() { return "dist.seqs"; } getCommandCategory()75 string getCommandCategory() { return "Sequence Processing"; } 76 77 string getHelpString(); 78 string getOutputPattern(string); getCitation()79 string getCitation() { return "Schloss PD (2010). The effects of alignment quality, distance calculation method, sequence filtering, and region on the analysis of 16S rRNA gene-based studies. PLoS Comput Biol 6: e1000844. \nhttp://www.mothur.org/wiki/Dist.seqs"; } getDescription()80 string getDescription() { return "calculate the pairwaise distances between aligned sequences"; } 81 82 int execute(); help()83 void help() { m->mothurOut(getHelpString()); } 84 85 86 private: 87 88 StorageDatabase* db; 89 string output, fastafile, calc, oldfastafile, column; 90 int processors; 91 long long numNewFasta, numSeqs, numDistsBelowCutoff; 92 float cutoff; 93 94 bool abort, countends, fitCalc, prot, compress; 95 vector<string> outputNames; 96 97 void createProcesses(string); 98 bool sanityCheck(); 99 }; 100 101 #endif 102 103 /**************************************************************************************************/ 104 105 106 107