X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=aligncommand.h;h=4e1b8d39f81dc067c60575d1938a21fd1de8dee0;hp=4a5eb11bf320a500ddfca34f0504130637fda0f0;hb=cf9987b67aa49777a4c91c2d21f96e58bf17aa82;hpb=55386dddad84cc1140d736cabaf4dd0ae16f2e01 diff --git a/aligncommand.h b/aligncommand.h index 4a5eb11..4e1b8d3 100644 --- a/aligncommand.h +++ b/aligncommand.h @@ -1,6 +1,5 @@ #ifndef ALIGNCOMMAND_H #define ALIGNCOMMAND_H - /* * aligncommand.h * Mothur @@ -10,7 +9,6 @@ * */ -#include "mothur.h" #include "command.hpp" #include "database.hpp" #include "alignment.hpp" @@ -25,7 +23,7 @@ #include "nast.hpp" #include "nastreport.hpp" - +//test class AlignCommand : public Command { public: @@ -36,7 +34,9 @@ public: vector setParameters(); string getCommandName() { return "align.seqs"; } string getCommandCategory() { return "Sequence Processing"; } + string getHelpString(); + string getOutputPattern(string); string getCitation() { return "DeSantis TZ, Jr., Hugenholtz P, Keller K, Brodie EL, Larsen N, Piceno YM, Phan R, Andersen GL (2006). NAST: a multiple sequence alignment server for comparative analysis of 16S rRNA genes. Nucleic Acids Res 34: W394-9.\nSchloss PD (2009). A high-throughput DNA sequence aligner for microbial ecology studies. PLoS ONE 4: e8230.\nSchloss 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/Align.seqs http://www.mothur.org/wiki/Align.seqs"; } string getDescription() { return "align sequences"; } @@ -45,9 +45,9 @@ public: private: struct linePair { - unsigned long int start; - unsigned long int end; - linePair(unsigned long int i, unsigned long int j) : start(i), end(j) {} + unsigned long long start; + unsigned long long end; + linePair(unsigned long long i, unsigned long long j) : start(i), end(j) {} }; vector processIDS; //processid vector lines; @@ -57,11 +57,10 @@ private: int driver(linePair*, string, string, string, string); int createProcesses(string, string, string, string); - void appendAlignFiles(string, string); void appendReportFiles(string, string); #ifdef USE_MPI - int driverMPI(int, int, MPI_File&, MPI_File&, MPI_File&, MPI_File&, vector&); + int driverMPI(int, int, MPI_File&, MPI_File&, MPI_File&, MPI_File&, vector&); #endif string candidateFileName, templateFileName, distanceFileName, search, align, outputDir; @@ -78,7 +77,8 @@ private: //custom data structure for threads to use. // This is passed by void pointer so it can be any data type // that can be passed using a single void pointer (LPVOID). -typedef struct alignData { +struct alignData { + string templateFileName; string alignFName; string reportFName; string accnosFName; @@ -86,15 +86,16 @@ typedef struct alignData { string align; string search; bool flip; - unsigned long int start; - unsigned long int end; + unsigned long long start; + unsigned long long end; MothurOut* m; //AlignmentDB* templateDB; float match, misMatch, gapOpen, gapExtend, threshold; int count, kmerSize, threadID; alignData(){} - alignData(string a, string r, string ac, string f, string al, string se, int ks, MothurOut* mout, unsigned long int st, unsigned long int en, bool fl, float ma, float misMa, float gapO, float gapE, float thr, int tid) { + alignData(string te, string a, string r, string ac, string f, string al, string se, int ks, MothurOut* mout, unsigned long long st, unsigned long long en, bool fl, float ma, float misMa, float gapO, float gapE, float thr, int tid) { + templateFileName = te; alignFName = a; reportFName = r; accnosFName = ac; @@ -118,7 +119,7 @@ typedef struct alignData { }; /**************************************************************************************************/ -#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) +#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix) #else static DWORD WINAPI MyAlignThreadFunction(LPVOID lpParam){ alignData* pDataArray; @@ -143,9 +144,7 @@ static DWORD WINAPI MyAlignThreadFunction(LPVOID lpParam){ inFASTA.seekg(pDataArray->start-1); pDataArray->m->gobble(inFASTA); } - pDataArray->count = pDataArray->end; - - AlignmentDB* templateDB = new AlignmentDB("saved-silent", pDataArray->search, pDataArray->kmerSize, pDataArray->gapOpen, pDataArray->gapExtend, pDataArray->match, pDataArray->misMatch, pDataArray->threadID); + AlignmentDB* templateDB = new AlignmentDB(pDataArray->templateFileName, pDataArray->search, pDataArray->kmerSize, pDataArray->gapOpen, pDataArray->gapExtend, pDataArray->match, pDataArray->misMatch, pDataArray->threadID); //moved this into driver to avoid deep copies in windows paralellized version Alignment* alignment; @@ -160,7 +159,7 @@ static DWORD WINAPI MyAlignThreadFunction(LPVOID lpParam){ alignment = new NeedlemanOverlap(pDataArray->gapOpen, pDataArray->match, pDataArray->misMatch, longestBase); } - int count = 0; + pDataArray->count = 0; for(int i = 0; i < pDataArray->end; i++){ //end is the number of sequences to process if (pDataArray->m->control_pressed) { break; } @@ -241,16 +240,16 @@ static DWORD WINAPI MyAlignThreadFunction(LPVOID lpParam){ delete nast; if (needToDeleteCopy) { delete copy; } - count++; + pDataArray->count++; } delete candidateSeq; //report progress - if((count) % 100 == 0){ pDataArray->m->mothurOut(toString(count)); pDataArray->m->mothurOutEndLine(); } + if((pDataArray->count) % 100 == 0){ pDataArray->m->mothurOutJustToScreen(toString(pDataArray->count)+"\n"); } } //report progress - if((count) % 100 != 0){ pDataArray->m->mothurOut(toString(count)); pDataArray->m->mothurOutEndLine(); } + if((pDataArray->count) % 100 != 0){ pDataArray->m->mothurOutJustToScreen(toString(pDataArray->count)+"\n"); } delete alignment; delete templateDB;