]> git.donarmstrong.com Git - mothur.git/commitdiff
added checks to make sure windows processes completed their tasks.
authorSarah Westcott <mothur.westcott@gmail.com>
Mon, 28 Jan 2013 16:09:35 +0000 (11:09 -0500)
committerSarah Westcott <mothur.westcott@gmail.com>
Mon, 28 Jan 2013 16:09:35 +0000 (11:09 -0500)
42 files changed:
aligncommand.cpp
aligncommand.h
chimeraperseuscommand.cpp
chimeraslayercommand.cpp
chimeraslayercommand.h
chimerauchimecommand.h
chopseqscommand.cpp
chopseqscommand.h
classifyseqscommand.cpp
classifyseqscommand.h
distancecommand.cpp
distancecommand.h
filterseqscommand.cpp
filterseqscommand.h
makecontigscommand.cpp
makecontigscommand.h
matrixoutputcommand.cpp
matrixoutputcommand.h
metastatscommand.cpp
metastatscommand.h
mothurout.cpp
pairwiseseqscommand.cpp
pairwiseseqscommand.h
pcrseqscommand.h
prcseqscommand.cpp
preclustercommand.cpp
preclustercommand.h
primerdesigncommand.cpp
screenseqscommand.cpp
screenseqscommand.h
seqsummarycommand.cpp
seqsummarycommand.h
shhhseqscommand.cpp
shhhseqscommand.h
summaryqualcommand.cpp
summaryqualcommand.h
summarysharedcommand.cpp
summarysharedcommand.h
treegroupscommand.cpp
treegroupscommand.h
trimseqscommand.cpp
trimseqscommand.h

index a871244f4538881c8d285c2a1202597be319498d..fc98c10924138a3aa168dabbc609f64bfb89f3e4 100644 (file)
@@ -965,6 +965,9 @@ int AlignCommand::createProcesses(string alignFileName, string reportFileName, s
                
                //Close all thread handles and free memory allocations.
                for(int i=0; i < pDataArray.size(); i++){
+            if (pDataArray[i]->count != pDataArray[i]->end) {
+                m->mothurOut("[ERROR]: process " + toString(i) + " only processed " + toString(pDataArray[i]->count) + " of " + toString(pDataArray[i]->end) + " sequences assigned to it, quitting. \n"); m->control_pressed = true; 
+            }
                        num += pDataArray[i]->count;
                        CloseHandle(hThreadArray[i]);
                        delete pDataArray[i];
index cfded3819156764fc86e49e9cb1977af9bb2ef48..e5e9601781fdff5e35125b49de6ba452e180f9a2 100644 (file)
@@ -144,8 +144,6 @@ static DWORD WINAPI MyAlignThreadFunction(LPVOID lpParam){
                        inFASTA.seekg(pDataArray->start-1); pDataArray->m->gobble(inFASTA); 
                }
                
-               pDataArray->count = pDataArray->end;
-               
                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
@@ -161,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; }
@@ -242,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->mothurOut(toString(pDataArray->count)); pDataArray->m->mothurOutEndLine();               }
                        
                }
                //report progress
-               if((count) % 100 != 0){ pDataArray->m->mothurOut(toString(count)); pDataArray->m->mothurOutEndLine();           }
+               if((pDataArray->count) % 100 != 0){     pDataArray->m->mothurOut(toString(pDataArray->count)); pDataArray->m->mothurOutEndLine();               }
                
                delete alignment;
                delete templateDB;
index b4e478caea6bab2c3cf3a7d13a756f95a29f2223..66889f145af3340d5a7fe38db4e8aa34997c2219 100644 (file)
@@ -1076,6 +1076,9 @@ int ChimeraPerseusCommand::createProcessesGroups(string outputFName, string accn
                        
                //Close all thread handles and free memory allocations.
                for(int i=0; i < pDataArray.size(); i++){
+            if (pDataArray[i]->count != pDataArray[i]->end) {
+                m->mothurOut("[ERROR]: process " + toString(i) + " only processed " + toString(pDataArray[i]->count) + " of " + toString(pDataArray[i]->end) + " sequences assigned to it, quitting. \n"); m->control_pressed = true; 
+            }
                        num += pDataArray[i]->count;
                        CloseHandle(hThreadArray[i]);
                        delete pDataArray[i];
index 576fee94250f780685bbc57cd20bf0478241f74e..a1be2359c1516aa26395a2ba00c6101fb3a996f3 100644 (file)
@@ -1497,6 +1497,9 @@ int ChimeraSlayerCommand::createProcessesGroups(string outputFName, string accno
                
                //Close all thread handles and free memory allocations.
                for(int i=0; i < pDataArray.size(); i++){
+            if (pDataArray[i]->count != pDataArray[i]->end) {
+                m->mothurOut("[ERROR]: process " + toString(i) + " only processed " + toString(pDataArray[i]->count) + " of " + toString(pDataArray[i]->end) + " sequences assigned to it, quitting. \n"); m->control_pressed = true; 
+            }
                        num += pDataArray[i]->count;
                        CloseHandle(hThreadArray[i]);
                        delete pDataArray[i];
index 0c6ebe2de76c957f2a3f9c072b9127efb002e5fb..ee43bcbf72a2ca00af3e2270768f34ac1357bb71 100644 (file)
@@ -213,8 +213,6 @@ static DWORD WINAPI MySlayerThreadFunction(LPVOID lpParam){
                        inFASTA.seekg(pDataArray->start-1); pDataArray->m->gobble(inFASTA); 
                }
                
-               pDataArray->count = pDataArray->end;
-               
                if (pDataArray->m->control_pressed) { out.close(); out2.close(); if (pDataArray->trim) { out3.close(); } inFASTA.close(); delete chimera;  return 0;    }
                
                if (chimera->getUnaligned()) { 
@@ -227,7 +225,7 @@ static DWORD WINAPI MySlayerThreadFunction(LPVOID lpParam){
                
                if (pDataArray->start == 0) { chimera->printHeader(out); }
                
-               int count = 0;
+               pDataArray->count = 0;
                for(int i = 0; i < pDataArray->end; i++){
                        
                        if (pDataArray->m->control_pressed) {   out.close(); out2.close(); if (pDataArray->trim) { out3.close(); } inFASTA.close(); delete chimera; return 1;   }
@@ -318,18 +316,18 @@ static DWORD WINAPI MySlayerThreadFunction(LPVOID lpParam){
                                        
                                        
                                }
-                               count++;
+                               pDataArray->count++;
                        }
                        
                        delete candidateSeq;
                        //report progress
-                       if((count) % 100 == 0){ pDataArray->m->mothurOut("Processing sequence: " + toString(count)); pDataArray->m->mothurOutEndLine();         }
+                       if((pDataArray->count) % 100 == 0){     pDataArray->m->mothurOut("Processing sequence: " + toString(pDataArray->count)); pDataArray->m->mothurOutEndLine();             }
                }
                //report progress
-               if((count) % 100 != 0){ pDataArray->m->mothurOut("Processing sequence: " + toString(count)); pDataArray->m->mothurOutEndLine();         }
+               if((pDataArray->count) % 100 != 0){     pDataArray->m->mothurOut("Processing sequence: " + toString(pDataArray->count)); pDataArray->m->mothurOutEndLine();             }
                
                pDataArray->numNoParents = chimera->getNumNoParents();
-               if (pDataArray->numNoParents == count) {        pDataArray->m->mothurOut("[WARNING]: megablast returned 0 potential parents for all your sequences. This could be due to formatdb.exe not being setup properly, please check formatdb.log for errors.\n"); }
+               if (pDataArray->numNoParents == pDataArray->count) {    pDataArray->m->mothurOut("[WARNING]: megablast returned 0 potential parents for all your sequences. This could be due to formatdb.exe not being setup properly, please check formatdb.log for errors.\n"); }
 
                out.close();
                out2.close();
index 8861e19ffc4f2cca99fd50f38efd3d1f9798e2af..6d9d001a142aaa6357cc81614c5f50af23f2bf76 100644 (file)
@@ -546,12 +546,13 @@ static DWORD WINAPI MyUchimeSeqsThreadFunction(LPVOID lpParam){
         ofstream out23;
         pDataArray->m->openOutputFile(outputFileName, out23);
         
+        int fcount = 0;
         while (!in23.eof()) {
             if (pDataArray->m->control_pressed) { break;  }
             
             Sequence seq(in23); pDataArray->m->gobble(in23);
             
-            if (seq.getName() != "") { seq.printSequence(out23); }
+            if (seq.getName() != "") { seq.printSequence(out23); fcount++; }
         }
         in23.close();
         out23.close();
@@ -821,12 +822,15 @@ static DWORD WINAPI MyUchimeSeqsThreadFunction(LPVOID lpParam){
                in.close();
                out.close();
                
+        if (fcount != totalSeqs) { pDataArray->m->mothurOut("[ERROR]: process " + toString(pDataArray->threadID) + " only processed " + toString(pDataArray->count) + " of " + toString(pDataArray->end) + " sequences assigned to it, quitting. \n"); pDataArray->m->control_pressed = true; }
+        
                if (pDataArray->m->control_pressed) { return 0; }
                
                pDataArray->m->mothurOutEndLine(); pDataArray->m->mothurOut("It took " + toString(time(NULL) - start) + " secs to check " + toString(totalSeqs) + " sequences.");       pDataArray->m->mothurOutEndLine();                                      
        
                pDataArray->count = totalSeqs;
                pDataArray->numChimeras = numChimeras;
+        
                return totalSeqs;
                
        }
index 0cce69f23efa4869ae5b4b8955c6192d25a69f52..80dd8561ef286fb862c01e99089eaea534f92884 100644 (file)
@@ -331,6 +331,10 @@ bool ChopSeqsCommand::createProcesses(vector<linePair> lines, string filename, s
                for(int i=0; i < pDataArray.size(); i++){
             if (pDataArray[i]->wroteAccnos) { wroteAccnos = pDataArray[i]->wroteAccnos; nonBlankAccnosFiles.push_back(outAccnos + toString(processIDS[i]) + ".temp");  }
                        else { m->mothurRemove((outAccnos + toString(processIDS[i]) + ".temp"));  }
+            //check to make sure the process finished
+            if (pDataArray[i]->count != pDataArray[i]->end) {
+                m->mothurOut("[ERROR]: process " + toString(i) + " only processed " + toString(pDataArray[i]->count) + " of " + toString(pDataArray[i]->end) + " sequences assigned to it, quitting. \n"); m->control_pressed = true; 
+            }
                        CloseHandle(hThreadArray[i]);
                        delete pDataArray[i];
                }
index cd2b2fe9640eb7e359cdc068d98552611f5b2d13..c9a4962c96fe9e548b50db1e4c0d6f63d1cdfff4 100644 (file)
@@ -60,7 +60,7 @@ struct chopData {
        string outFasta, outAccnos, keep; 
        unsigned long long start;
        unsigned long long end;
-       int numbases;
+       int numbases, count;
     bool countGaps, Short, wroteAccnos;
        MothurOut* m;
        string namefile;
@@ -108,7 +108,7 @@ static DWORD WINAPI MyChopThreadFunction(LPVOID lpParam){
 
                bool done = false;
         bool wroteAccnos = false;
-               int count = 0;
+               pDataArray->count = 0;
 
                for(int i = 0; i < pDataArray->end; i++){ //end is the number of sequences to process
                                                
@@ -238,14 +238,14 @@ static DWORD WINAPI MyChopThreadFunction(LPVOID lpParam){
                                        outAcc << seq.getName() << endl;
                                        pDataArray->wroteAccnos = true;
                                }
-                count++;
+                pDataArray->count++;
                        }
             //report progress
-                       if((count) % 1000 == 0){        pDataArray->m->mothurOut(toString(count)); pDataArray->m->mothurOutEndLine();           }
+                       if((pDataArray->count) % 1000 == 0){    pDataArray->m->mothurOut(toString(pDataArray->count)); pDataArray->m->mothurOutEndLine();               }
                        
                }
                //report progress
-               if((count) % 1000 != 0){        pDataArray->m->mothurOut(toString(count)); pDataArray->m->mothurOutEndLine();           }
+               if((pDataArray->count) % 1000 != 0){    pDataArray->m->mothurOut(toString(pDataArray->count)); pDataArray->m->mothurOutEndLine();               }
         
                
                in.close();
index 114036b2e89ea47a6a3aed1c9e08b514835ccd24..147b3830dded524050b2b8cf96cfbbabde09e3c0 100644 (file)
@@ -1044,6 +1044,9 @@ int ClassifySeqsCommand::createProcesses(string taxFileName, string tempTaxFile,
                //Close all thread handles and free memory allocations.
                for(int i=0; i < pDataArray.size(); i++){
                        num += pDataArray[i]->count;
+            if (pDataArray[i]->count != pDataArray[i]->end) {
+                m->mothurOut("[ERROR]: process " + toString(i) + " only processed " + toString(pDataArray[i]->count) + " of " + toString(pDataArray[i]->end) + " sequences assigned to it, quitting. \n"); m->control_pressed = true; 
+            }
                        CloseHandle(hThreadArray[i]);
                        delete pDataArray[i];
                }
index a3328d8dcea09eebe63c641e04e1b816fc92fee1..f8a820dcf6347aa39432d461c78f6f8613ae6acf 100644 (file)
@@ -163,8 +163,6 @@ static DWORD WINAPI MyClassThreadFunction(LPVOID lpParam){
                        inFASTA.seekg(pDataArray->start-1); pDataArray->m->gobble(inFASTA); 
                }
                
-               pDataArray->count = pDataArray->end;
-               
                //make classify
                Classify* myclassify;
         string outputMethodTag = pDataArray->method + ".";
@@ -183,7 +181,7 @@ static DWORD WINAPI MyClassThreadFunction(LPVOID lpParam){
                
                if (pDataArray->m->control_pressed) { delete myclassify; return 0; }
                
-               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) { delete myclassify; return 0; }
@@ -209,15 +207,15 @@ static DWORD WINAPI MyClassThreadFunction(LPVOID lpParam){
                                        
                                if (myclassify->getFlipped()) { outAcc << candidateSeq->getName() << endl; }
                                
-                               count++;
+                               pDataArray->count++;
                        }
                        delete candidateSeq;
                        //report progress
-                       if((count) % 100 == 0){ pDataArray->m->mothurOut("Processing sequence: " + toString(count)); pDataArray->m->mothurOutEndLine();         }
+                       if((pDataArray->count) % 100 == 0){     pDataArray->m->mothurOut("Processing sequence: " + toString(pDataArray->count)); pDataArray->m->mothurOutEndLine();             }
                        
                }
                //report progress
-               if((count) % 100 != 0){ pDataArray->m->mothurOut("Processing sequence: " + toString(count)); pDataArray->m->mothurOutEndLine();         }
+               if((pDataArray->count) % 100 != 0){     pDataArray->m->mothurOut("Processing sequence: " + toString(pDataArray->count)); pDataArray->m->mothurOutEndLine();             }
                
                delete myclassify;
                inFASTA.close();
index 16fcbf56247bb73bc979f50d4b06ee4ec20e1e7c..19094e9e76ee76981b9d5bd501df3876d401b387 100644 (file)
@@ -594,6 +594,9 @@ void DistanceCommand::createProcesses(string filename) {
                
                //Close all thread handles and free memory allocations.
                for(int i=0; i < pDataArray.size(); i++){
+            if (pDataArray[i]->count != (pDataArray[i]->endLine-pDataArray[i]->startLine)) {
+                m->mothurOut("[ERROR]: process " + toString(i) + " only processed " + toString(pDataArray[i]->count) + " of " + toString(pDataArray[i]->endLine-pDataArray[i]->startLine) + " sequences assigned to it, quitting. \n"); m->control_pressed = true; 
+            }
                        CloseHandle(hThreadArray[i]);
                        delete pDataArray[i];
                }
index ddce0449d5498d48914f95d9ff64900b12837ccf..af55406b372dbf0f56a546be4de2bc87f5072614 100644 (file)
@@ -33,7 +33,7 @@ struct distanceData {
        vector<string> Estimators;
        MothurOut* m;
        string output;
-       int numNewFasta;
+       int numNewFasta, count;
        string countends;
        
        distanceData(){}
@@ -86,7 +86,7 @@ static DWORD WINAPI MyDistThreadFunction(LPVOID lpParam){
                ofstream outFile(pDataArray->dFileName.c_str(), ios::trunc);
                outFile.setf(ios::fixed, ios::showpoint);
                outFile << setprecision(4);
-               
+               pDataArray->count = 0;
                
                if (pDataArray->output != "square") { 
                        if((pDataArray->output == "lt") && (pDataArray->startLine == 0)){       outFile << pDataArray->alignDB.getNumSeqs() << endl;    }
@@ -121,9 +121,9 @@ static DWORD WINAPI MyDistThreadFunction(LPVOID lpParam){
                                if(i % 100 == 0){
                                        pDataArray->m->mothurOut(toString(i) + "\t" + toString(time(NULL) - startTime)); pDataArray->m->mothurOutEndLine();
                                }
-                               
+                               pDataArray->count++;
                        }
-                       pDataArray->m->mothurOut(toString(pDataArray->endLine-1) + "\t" + toString(time(NULL) - startTime)); pDataArray->m->mothurOutEndLine();
+                       pDataArray->m->mothurOut(toString(pDataArray->count) + "\t" + toString(time(NULL) - startTime)); pDataArray->m->mothurOutEndLine();
                }else{
                        if(pDataArray->startLine == 0){ outFile << pDataArray->alignDB.getNumSeqs() << endl;    }
                        
@@ -150,9 +150,9 @@ static DWORD WINAPI MyDistThreadFunction(LPVOID lpParam){
                                if(i % 100 == 0){
                                        pDataArray->m->mothurOut(toString(i) + "\t" + toString(time(NULL) - startTime)); pDataArray->m->mothurOutEndLine();
                                }
-                               
+                               pDataArray->count++;
                        }
-                       pDataArray->m->mothurOut(toString(pDataArray->endLine-1) + "\t" + toString(time(NULL) - startTime)); pDataArray->m->mothurOutEndLine();
+                       pDataArray->m->mothurOut(toString(pDataArray->count) + "\t" + toString(time(NULL) - startTime)); pDataArray->m->mothurOutEndLine();
                }
                
                outFile.close();
index f6ca47988809f623b940f2ae04703d276ad90fa8..b17d9ed6799d9c8287664cf63241b0fde01bf40e 100644 (file)
@@ -729,6 +729,9 @@ int FilterSeqsCommand::createProcessesRunFilter(string F, string filename, strin
                //Close all thread handles and free memory allocations.
                for(int i=0; i < pDataArray.size(); i++){
                        num += pDataArray[i]->count;
+            if (pDataArray[i]->count != pDataArray[i]->end) {
+                m->mothurOut("[ERROR]: process " + toString(i) + " only processed " + toString(pDataArray[i]->count) + " of " + toString(pDataArray[i]->end) + " sequences assigned to it, quitting. \n"); m->control_pressed = true; 
+            }
             CloseHandle(hThreadArray[i]);
                        delete pDataArray[i];
                }
@@ -1176,6 +1179,9 @@ int FilterSeqsCommand::createProcessesCreateFilter(Filters& F, string filename)
                //Close all thread handles and free memory allocations.
                for(int i=0; i < pDataArray.size(); i++){
                        num += pDataArray[i]->count;
+            if (pDataArray[i]->count != pDataArray[i]->end) {
+                m->mothurOut("[ERROR]: process " + toString(i) + " only processed " + toString(pDataArray[i]->count) + " of " + toString(pDataArray[i]->end) + " sequences assigned to it, quitting. \n"); m->control_pressed = true; 
+            }
             F.mergeFilter(pDataArray[i]->F.getFilter());
             
                        for (int k = 0; k < alignmentLength; k++) {      F.a[k] += pDataArray[i]->F.a[k];       }
index fc6bcb2efab1b3885af316a160faa59446600f30..90c13f8ee82722570d129d74874b519cc4ee9a60 100644 (file)
@@ -153,7 +153,7 @@ static DWORD WINAPI MyCreateFilterThreadFunction(LPVOID lpParam){
                        in.seekg(pDataArray->start-1); pDataArray->m->gobble(in); \r
                }\r
                \r
-               pDataArray->count = pDataArray->end;\r
+               pDataArray->count = 0;\r
                for(int i = 0; i < pDataArray->end; i++){ //end is the number of sequences to process\r
                        \r
                        if (pDataArray->m->control_pressed) { in.close(); pDataArray->count = 1; return 1; }\r
@@ -166,7 +166,7 @@ static DWORD WINAPI MyCreateFilterThreadFunction(LPVOID lpParam){
                 if(pDataArray->trump != '*')                   {       pDataArray->F.doTrump(current);         }\r
                 if(pDataArray->m->isTrue(pDataArray->vertical) || pDataArray->soft != 0)       {       pDataArray->F.getFreqs(current);        }\r
                        }\r
-            \r
+            pDataArray->count++;\r
             //report progress\r
                        if((i) % 100 == 0){     pDataArray->m->mothurOut(toString(i)); pDataArray->m->mothurOutEndLine();               }\r
                }\r
@@ -203,7 +203,7 @@ static DWORD WINAPI MyRunFilterThreadFunction(LPVOID lpParam){
                        in.seekg(pDataArray->start-1); pDataArray->m->gobble(in); \r
                }\r
                \r
-               pDataArray->count = pDataArray->end;\r
+               pDataArray->count = 0;\r
                for(int i = 0; i < pDataArray->end; i++){ //end is the number of sequences to process\r
                        \r
                        if (pDataArray->m->control_pressed) { in.close(); out.close(); pDataArray->count = 1; return 1; }\r
@@ -221,7 +221,7 @@ static DWORD WINAPI MyRunFilterThreadFunction(LPVOID lpParam){
                 \r
                 out << '>' << seq.getName() << endl << filterSeq << endl;\r
             }\r
-            \r
+            pDataArray->count++;\r
             //report progress\r
                        if((i) % 100 == 0){     pDataArray->m->mothurOut(toString(i)); pDataArray->m->mothurOutEndLine();               }\r
                }\r
index 42406998133eba4ef7c9a6e6cc0d049e3cdcbe19..74133bbefc4abfb2f453893aa8ff2c39db4f0320 100644 (file)
@@ -824,6 +824,9 @@ int MakeContigsCommand::createProcesses(vector< vector<string> > files, string o
                //Close all thread handles and free memory allocations.
                for(int i=0; i < pDataArray.size(); i++){
                        num += pDataArray[i]->count;
+            if (!pDataArray[i]->done) {
+                m->mothurOut("[ERROR]: process " + toString(i) + " only processed " + toString(pDataArray[i]->count) + " of sequences assigned to it, quitting. \n"); m->control_pressed = true; 
+            }
             for (map<string, int>::iterator it = pDataArray[i]->groupCounts.begin(); it != pDataArray[i]->groupCounts.end(); it++) {
                 map<string, int>::iterator it2 = groupCounts.find(it->first);
                 if (it2 == groupCounts.end()) {        groupCounts[it->first] = it->second; }
index 43105b8236371f6e2feb3c09140e9b71b8e721bf..b61ebda3fc505db3c6805706cafb2e337138474d 100644 (file)
@@ -109,7 +109,7 @@ struct contigsData {
        MothurOut* m;
        float match, misMatch, gapOpen, gapExtend;
        int count, threshold, threadID, pdiffs, bdiffs, tdiffs;
-    bool allFiles, createGroup;
+    bool allFiles, createGroup, done;
     map<string, int> groupCounts; 
     map<string, string> groupMap;
     vector<string> primerNameVector;   
@@ -145,6 +145,7 @@ struct contigsData {
         allFiles = all;
         createGroup = cg;
                threadID = tid;
+        done=false;
        }
 };
 
@@ -161,7 +162,7 @@ static DWORD WINAPI MyContigsThreadFunction(LPVOID lpParam){
         if(pDataArray->align == "gotoh")                       {       alignment = new GotohOverlap(pDataArray->gapOpen, pDataArray->gapExtend, pDataArray->match, pDataArray->misMatch, longestBase);                 }
                else if(pDataArray->align == "needleman")       {       alignment = new NeedlemanOverlap(pDataArray->gapOpen, pDataArray->match, pDataArray->misMatch, longestBase);                            }
         
-        int num = 0;
+        pDataArray->count = 0;
         string thisffastafile = pDataArray->files[0];
         string thisfqualfile = pDataArray->files[1];
         string thisrfastafile = pDataArray->files[2];
@@ -396,14 +397,14 @@ static DWORD WINAPI MyContigsThreadFunction(LPVOID lpParam){
                     outScrapQual << endl;
                 }
             }
-            num++;
+            pDataArray->count++;
             
                        //report progress
-                       if((num) % 1000 == 0){  pDataArray->m->mothurOut(toString(num)); pDataArray->m->mothurOutEndLine();             }
+                       if((pDataArray->count) % 1000 == 0){    pDataArray->m->mothurOut(toString(pDataArray->count)); pDataArray->m->mothurOutEndLine();               }
                }
         
                //report progress
-               if((num) % 1000 != 0){  pDataArray->m->mothurOut(toString(num)); pDataArray->m->mothurOutEndLine();             }
+               if((pDataArray->count) % 1000 != 0){    pDataArray->m->mothurOut(toString(pDataArray->count)); pDataArray->m->mothurOutEndLine();               }
         
         inFFasta.close();
         inRFasta.close();
@@ -418,6 +419,7 @@ static DWORD WINAPI MyContigsThreadFunction(LPVOID lpParam){
         }
         delete alignment;
         
+        pDataArray->done = true;
         if (pDataArray->m->control_pressed) {  pDataArray->m->mothurRemove(pDataArray->outputFasta);  pDataArray->m->mothurRemove(pDataArray->outputMisMatches);  pDataArray->m->mothurRemove(pDataArray->outputScrapFasta);  if (thisfqualfile != "") { pDataArray->m->mothurRemove(pDataArray->outputQual); pDataArray->m->mothurRemove(pDataArray->outputScrapQual); } }
         
         return 0;
index 3844e18c1e687ef47fae1dda09d10e61973ab798..95b881190d085135539601c17836ce7d123592da 100644 (file)
@@ -629,6 +629,9 @@ int MatrixOutputCommand::process(vector<SharedRAbundVector*> thisLookup){
                 
                 //Close all thread handles and free memory allocations.
                 for(int i=0; i < pDataArray.size(); i++){
+                    if (pDataArray[i]->count != (pDataArray[i]->end-pDataArray[i]->start)) {
+                        m->mothurOut("[ERROR]: process " + toString(i) + " only processed " + toString(pDataArray[i]->count) + " of " + toString(pDataArray[i]->end-pDataArray[i]->start) + " groups assigned to it, quitting. \n"); m->control_pressed = true; 
+                    }
                     for (int j = 0; j < pDataArray[i]->thisLookup.size(); j++) {  delete pDataArray[i]->thisLookup[j];  } 
                     
                     for (int k = 0; k < calcDists.size(); k++) {
index 8a04c96a32ed6fa769a4e14474dfb624451751d1..90f120602e70dc04600b3048bab41bde21b21edc 100644 (file)
@@ -121,6 +121,7 @@ struct distSharedData {
        unsigned long long start;
        unsigned long long end;
        MothurOut* m;
+    int count;
        
        distSharedData(){}
        distSharedData(MothurOut* mout, unsigned long long st, unsigned long long en, vector<string> est, vector<SharedRAbundVector*> lu) {
@@ -129,6 +130,7 @@ struct distSharedData {
                end = en;
         Estimators = est;
         thisLookup = lu;
+        count = 0;
        }
 };
 /**************************************************************************************************/
@@ -230,7 +232,7 @@ static DWORD WINAPI MyDistSharedThreadFunction(LPVOID lpParam){
                        
                vector<SharedRAbundVector*> subset;
                for (int k = pDataArray->start; k < pDataArray->end; k++) { // pass cdd each set of groups to compare
-                       
+                       pDataArray->count++;
                        for (int l = 0; l < k; l++) {
                                
                                if (k != l) { //we dont need to similiarity of a groups to itself
index 8e61b37ee0e5639c76d3adf3f23ae0b4eefd234f..9dff3543f49efa25037ce7fb3dd9eeeebbe8c787 100644 (file)
@@ -431,6 +431,9 @@ int MetaStatsCommand::process(vector<SharedRAbundVector*>& thisLookUp){
                     
                     //Close all thread handles and free memory allocations.
                     for(int i=0; i < pDataArray.size(); i++){
+                        if (pDataArray[i]->count != (pDataArray[i]->num)) {
+                            m->mothurOut("[ERROR]: process " + toString(i) + " only processed " + toString(pDataArray[i]->count) + " of " + toString(pDataArray[i]->num) + " groups assigned to it, quitting. \n"); m->control_pressed = true; 
+                        }
                         for (int j = 0; j < pDataArray[i]->thisLookUp.size(); j++) {  delete pDataArray[i]->thisLookUp[j];  } 
                         for (int j = 0; j < pDataArray[i]->outputNames.size(); j++) {  
                             outputNames.push_back(pDataArray[i]->outputNames[j]);
index 7884130ad55dda3fff3fb7880a4c80e6fe15ed9b..12e0aebbe2d6a61409f5f749aba4a23db2841b31 100644 (file)
@@ -68,7 +68,7 @@ struct metastatsData {
     vector<string> designMapGroups;
     vector<string> outputNames;
        int start;
-       int num, iters;
+       int num, iters, count;
        float threshold;
        MothurOut* m;
        string sharedfile;
@@ -86,6 +86,7 @@ struct metastatsData {
         designMapGroups = dg;
         iters = i;
         threshold = thr;
+        count=0;
        }
 };
 /**************************************************************************************************/
@@ -99,7 +100,7 @@ static DWORD WINAPI MyMetastatsThreadFunction(LPVOID lpParam){
                
         //for each combo
                for (int c = pDataArray->start; c < (pDataArray->start+pDataArray->num); c++) {
-                       
+                       pDataArray->count++;
                        //get set names
                        string setA = pDataArray->namesOfGroupCombos[c][0]; 
                        string setB = pDataArray->namesOfGroupCombos[c][1];
index 54cdd33bbe72cfecb241ed0d24d537bf4654af06..1b72137a66d6cd8038446dbc823033bb3293869d 100644 (file)
@@ -440,10 +440,22 @@ void MothurOut::errorOut(exception& e, string object, string function) {
        //double vm, rss;
        //mem_usage(vm, rss);
        
-       mothurOut("[ERROR]: ");
-       mothurOut(toString(e.what()));
-       mothurOut(" has occurred in the " + object + " class function " + function + ". Please contact Pat Schloss at mothur.bugs@gmail.com, and be sure to include the mothur.logFile with your inquiry.");
-       mothurOutEndLine();
+    string errorType = toString(e.what());
+    
+    int pos = errorType.find("bad_alloc");
+    mothurOut("[ERROR]: ");
+    mothurOut(errorType);
+    
+    if (pos == string::npos) { //not bad_alloc
+        mothurOut(" has occurred in the " + object + " class function " + function + ". Please contact Pat Schloss at mothur.bugs@gmail.com, and be sure to include the mothur.logFile with your inquiry.");
+        mothurOutEndLine();
+    }else { //bad alloc
+        if (object == "cluster"){
+            mothurOut(" has occurred in the " + object + " class function " + function + ". This error indicates your computer is running out of memory.  There are two common causes for this, file size and format.\n\nFile Size:\nThe cluster command loads your distance matrix into RAM, and your distance file is most likely too large to fit in RAM. There are two options to help with this. The first is to use a cutoff. By using a cutoff mothur will only load distances that are below the cutoff. If that is still not enough, there is a command called cluster.split, http://www.mothur.org/wiki/cluster.split which divides the distance matrix, and clusters the smaller pieces separately. You may also be able to reduce the size of the original distance matrix by using the commands outlined in the Schloss SOP, http://www.mothur.org/wiki/Schloss_SOP. \n\nWrong Format:\nThis error can be caused by trying to read a column formatted distance matrix using the phylip parameter. By default, the dist.seqs command generates a column formatted distance matrix. To make a phylip formatted matrix set the dist.seqs command parameter output to lt.  \n\nIf you are uable to resolve the issue, please contact Pat Schloss at mothur.bugs@gmail.com, and be sure to include the mothur.logFile with your inquiry.");
+        }else {
+            mothurOut(" has occurred in the " + object + " class function " + function + ". This error indicates your computer is running out of memory.  This is most commonly caused by trying to process a dataset too large, or a file format issue. If you are running our 32bit version, your memory usage is limited to 4G.  If you have more than 4G of RAM and are running a 64bit OS, using our 64bit version may resolve your issue.  Also, you may be able to reduce the size of your dataset by using the commands outlined in the Schloss SOP, http://www.mothur.org/wiki/Schloss_SOP. If you are uable to resolve the issue, please contact Pat Schloss at mothur.bugs@gmail.com, and be sure to include the mothur.logFile with your inquiry.");
+        }
+    }
 }
 /*********************************************************************************************/
 //The following was originally from http://stackoverflow.com/questions/669438/how-to-get-memory-usage-at-run-time-in-c 
index 0f8602871561c20804b49bdc948da6194b25adbe..767fdb52702bd1a3652d6bf2c1e2b244958e48ca 100644 (file)
@@ -581,6 +581,9 @@ void PairwiseSeqsCommand::createProcesses(string filename) {
                
                //Close all thread handles and free memory allocations.
                for(int i=0; i < pDataArray.size(); i++){
+            if (pDataArray[i]->count != (pDataArray[i]->end-pDataArray[i]->start)) {
+                m->mothurOut("[ERROR]: process " + toString(i) + " only processed " + toString(pDataArray[i]->count) + " of " + toString(pDataArray[i]->end-pDataArray[i]->start) + " sequences assigned to it, quitting. \n"); m->control_pressed = true; 
+            }
                        CloseHandle(hThreadArray[i]);
                        delete pDataArray[i];
                }
index 33fcfca0b6d0207ed1f282a36061893805745203..06dbad975bc6f6b3035024f1260108e65470db64 100644 (file)
@@ -128,7 +128,7 @@ static DWORD WINAPI MyPairwiseSquareThreadFunction(LPVOID lpParam){
                outFile.setf(ios::fixed, ios::showpoint);
                outFile << setprecision(4);
                
-               pDataArray->count = pDataArray->end;
+               pDataArray->count = 0;
         
         int startTime = time(NULL);
         
@@ -162,6 +162,7 @@ static DWORD WINAPI MyPairwiseSquareThreadFunction(LPVOID lpParam){
         if(pDataArray->start == 0){    outFile << pDataArray->alignDB.getNumSeqs() << endl;    }
                
                for(int i=pDataArray->start;i<pDataArray->end;i++){
+            pDataArray->count++;
             
                        string name = pDataArray->alignDB.get(i).getName();
                        //pad with spaces to make compatible
@@ -201,7 +202,7 @@ static DWORD WINAPI MyPairwiseSquareThreadFunction(LPVOID lpParam){
                        }
                        
                }
-               pDataArray->m->mothurOut(toString(pDataArray->end-1) + "\t" + toString(time(NULL) - startTime)); pDataArray->m->mothurOutEndLine();
+               pDataArray->m->mothurOut(toString(pDataArray->count) + "\t" + toString(time(NULL) - startTime)); pDataArray->m->mothurOutEndLine();
                
                outFile.close();
         delete alignment;
index 9fc40419411ff2535f01eb150699b30227225a3b..c6f7ff9c7f6670073a7080496f80eac1cdfb2a72 100644 (file)
@@ -132,9 +132,9 @@ static DWORD WINAPI MyPcrThreadFunction(LPVOID lpParam){
                }
         
         set<int> lengths;
-               pDataArray->count = pDataArray->fend;
+               
                for(int i = 0; i < pDataArray->fend; i++){ //end is the number of sequences to process
-            
+            pDataArray->count++;
                        if (pDataArray->m->control_pressed) {  break; }
                        
                        Sequence currSeq(inFASTA); pDataArray->m->gobble(inFASTA);
index 5fc9f988be038bb02a724e38cc11b2d9ddf1fa3e..4d5b6d963a026433c5851de6d444edc524cd6d1a 100644 (file)
@@ -516,6 +516,9 @@ int PcrSeqsCommand::createProcesses(string filename, string goodFileName, string
                //Close all thread handles and free memory allocations.
                for(int i=0; i < pDataArray.size(); i++){
                        num += pDataArray[i]->count;
+            if (pDataArray[i]->count != pDataArray[i]->fend) {
+                m->mothurOut("[ERROR]: process " + toString(i) + " only processed " + toString(pDataArray[i]->count) + " of " + toString(pDataArray[i]->fend) + " sequences assigned to it, quitting. \n"); m->control_pressed = true; 
+            }
             for (set<string>::iterator it = pDataArray[i]->badSeqNames.begin(); it != pDataArray[i]->badSeqNames.end(); it++) {        badSeqNames.insert(*it);       }
                        CloseHandle(hThreadArray[i]);
                        delete pDataArray[i];
index 19616d8b0e4ce5d46e6753bbc58b776d1b5dd656..a1d5f48bdd77c81bb12d0095628922202a4bcacd 100644 (file)
@@ -464,6 +464,9 @@ int PreClusterCommand::createProcessesGroups(string newFName, string newNName, s
                
                //Close all thread handles and free memory allocations.
                for(int i=0; i < pDataArray.size(); i++){
+            if (pDataArray[i]->count != (pDataArray[i]->end-pDataArray[i]->start)) {
+                m->mothurOut("[ERROR]: process " + toString(i) + " only processed " + toString(pDataArray[i]->count) + " of " + toString(pDataArray[i]->end-pDataArray[i]->start) + " groups assigned to it, quitting. \n"); m->control_pressed = true; 
+            }
                        for (int j = 0; j < pDataArray[i]->mapFileNames.size(); j++) {
                                outputNames.push_back(pDataArray[i]->mapFileNames[j]); outputTypes["map"].push_back(pDataArray[i]->mapFileNames[j]); 
                        }
index e9568860e30bdc7fbf77b946838c99447e0eec5f..e0767826ecde2fcf8056bbdebfb8d1bd8ce435c4 100644 (file)
@@ -111,7 +111,7 @@ struct preClusterData {
        string newFName, newNName, newMName;
        MothurOut* m;
        int start;
-       int end;
+       int end, count;
        int diffs, threadID;
        vector<string> groups;
        vector<string> mapFileNames;
@@ -133,6 +133,7 @@ struct preClusterData {
                groups = gr;
         countfile = c;
         topdown = td;
+        count=0;
        }
 };
 
@@ -164,6 +165,8 @@ static DWORD WINAPI MyPreclusterThreadFunction(LPVOID lpParam){
                //precluster each group
                for (int k = pDataArray->start; k < pDataArray->end; k++) {
                        
+            pDataArray->count++;
+            
                        int start = time(NULL);
                        
                        if (pDataArray->m->control_pressed) {  delete parser; return 0; }
index f6ec7b591c5926070eb33e12022920347ace8107..48bb00f5cc7b8f7bc9cacdce2bdb6e32aeec656b 100644 (file)
@@ -889,7 +889,9 @@ vector<Sequence> PrimerDesignCommand::createProcessesConSeqs(map<string, int>& n
         
         
 #else
-               counts = driverGetCounts(nameMap, fastaCount, otuCounts, 0, 1000);      
+        unsigned long long start = 0;
+        unsigned long long end = 1000;
+               counts = driverGetCounts(nameMap, fastaCount, otuCounts, start, end);   
 #endif         
         
         //you will have a nameMap error if there is a namefile or countfile, but if those aren't given we want to make sure the fasta and list file match.
index 2524e652667bcacf8c76e89635e3c4e3f89ccc51..1e6b5a36786a58ce9ca44de8703a620554d89732 100644 (file)
@@ -934,6 +934,9 @@ int ScreenSeqsCommand::createProcessesCreateSummary(vector<int>& startPosition,
                //Close all thread handles and free memory allocations.
                for(int i=0; i < pDataArray.size(); i++){
                        num += pDataArray[i]->count;
+            if (pDataArray[i]->count != pDataArray[i]->end) {
+                m->mothurOut("[ERROR]: process " + toString(i) + " only processed " + toString(pDataArray[i]->count) + " of " + toString(pDataArray[i]->end) + " sequences assigned to it, quitting. \n"); m->control_pressed = true; 
+            }
             for (int k = 0; k < pDataArray[i]->startPosition.size(); k++) {    startPosition.push_back(pDataArray[i]->startPosition[k]);       }
                        for (int k = 0; k < pDataArray[i]->endPosition.size(); k++) {   endPosition.push_back(pDataArray[i]->endPosition[k]);       }
             for (int k = 0; k < pDataArray[i]->seqLength.size(); k++) {        seqLength.push_back(pDataArray[i]->seqLength[k]);       }
@@ -1518,6 +1521,9 @@ int ScreenSeqsCommand::createProcesses(string goodFileName, string badAccnos, st
                //Close all thread handles and free memory allocations.
                for(int i=0; i < pDataArray.size(); i++){
                        num += pDataArray[i]->count;
+            if (pDataArray[i]->count != pDataArray[i]->end) {
+                m->mothurOut("[ERROR]: process " + toString(i) + " only processed " + toString(pDataArray[i]->count) + " of " + toString(pDataArray[i]->end) + " sequences assigned to it, quitting. \n"); m->control_pressed = true; 
+            }
             for (set<string>::iterator it = pDataArray[i]->badSeqNames.begin(); it != pDataArray[i]->badSeqNames.end(); it++) {        badSeqNames.insert(*it);       }
                        CloseHandle(hThreadArray[i]);
                        delete pDataArray[i];
index 284c9a5ac1a0bd5c90dca6b4854b725d6b428023..6f4e8aca688cd3342c13400aff588f4f3eaec24a 100644 (file)
@@ -149,9 +149,11 @@ static DWORD WINAPI MySumThreadFunction(LPVOID lpParam){
                        in.seekg(pDataArray->start-1); pDataArray->m->gobble(in); 
                }
                
-               pDataArray->count = pDataArray->end;
+               
                for(int i = 0; i < pDataArray->end; i++){ //end is the number of sequences to process
                        
+            pDataArray->count++;
+            
                        if (pDataArray->m->control_pressed) { in.close();  pDataArray->count = 1; return 1; }
                        
                        Sequence current(in); pDataArray->m->gobble(in); 
@@ -213,9 +215,10 @@ static DWORD WINAPI MySumScreenThreadFunction(LPVOID lpParam){
                        in.seekg(pDataArray->start-1); pDataArray->m->gobble(in); 
                }
                
-               pDataArray->count = pDataArray->end;
                for(int i = 0; i < pDataArray->end; i++){ //end is the number of sequences to process
                        
+            pDataArray->count++;
+            
                        if (pDataArray->m->control_pressed) { in.close(); badAccnosFile.close(); goodFile.close(); pDataArray->count = 1; return 1; }
                        
                        Sequence currSeq(in); pDataArray->m->gobble(in); 
index 8f27b8c7beaf797775f680bdef5c34bcf7f980c8..fdf95ee6fc5f87ed7629de936f4b0543dc89906a 100644 (file)
@@ -675,6 +675,9 @@ int SeqSummaryCommand::createProcessesCreateSummary(vector<int>& startPosition,
                //Close all thread handles and free memory allocations.
                for(int i=0; i < pDataArray.size(); i++){
                        num += pDataArray[i]->count;
+            if (pDataArray[i]->count != pDataArray[i]->end) {
+                m->mothurOut("[ERROR]: process " + toString(i) + " only processed " + toString(pDataArray[i]->count) + " of " + toString(pDataArray[i]->end) + " sequences assigned to it, quitting. \n"); m->control_pressed = true; 
+            }
             for (int k = 0; k < pDataArray[i]->startPosition.size(); k++) {    startPosition.push_back(pDataArray[i]->startPosition[k]);       }
                        for (int k = 0; k < pDataArray[i]->endPosition.size(); k++) {   endPosition.push_back(pDataArray[i]->endPosition[k]);       }
             for (int k = 0; k < pDataArray[i]->seqLength.size(); k++) {        seqLength.push_back(pDataArray[i]->seqLength[k]);       }
index c4e6131524d9c64b4496df7f9d5d34a315e6b34e..552f4a08bee284bf914e6a50cd51176864b8b1d8 100644 (file)
@@ -114,9 +114,10 @@ static DWORD WINAPI MySeqSumThreadFunction(LPVOID lpParam){
                        in.seekg(pDataArray->start-1); pDataArray->m->gobble(in); 
                }
                
-               pDataArray->count = pDataArray->end;
                for(int i = 0; i < pDataArray->end; i++){ //end is the number of sequences to process
                        
+            pDataArray->count++;
+            
                        if (pDataArray->m->control_pressed) { in.close(); outSummary.close(); pDataArray->count = 1; return 1; }
                        
                        Sequence current(in); pDataArray->m->gobble(in); 
index 3e3e5863c59abc69e4175eba7cb5b7d6f0e173c8..82d956189a6f025fd57dc7e901e585456f59f8ab 100644 (file)
@@ -474,6 +474,9 @@ vector<string> ShhhSeqsCommand::createProcessesGroups(SequenceParser& parser, st
                
                //Close all thread handles and free memory allocations.
                for(int i=0; i < pDataArray.size(); i++){
+            if (pDataArray[i]->count != (pDataArray[i]->end-pDataArray[i]->start)) {
+                m->mothurOut("[ERROR]: process " + toString(i) + " only processed " + toString(pDataArray[i]->count) + " of " + toString(pDataArray[i]->end-pDataArray[i]->start) + " groups assigned to it, quitting. \n"); m->control_pressed = true; 
+            }
                        for (int j = 0; j < pDataArray[i]->mapfileNames.size(); j++) {
                                mapfileNames.push_back(pDataArray[i]->mapfileNames[j]);
                        }
index 4da1a840c7d3c591f589ad6ea0103da4d9fbf1ce..ffd72b9ebdc161291f9705333f018cb56c09559c 100644 (file)
@@ -77,7 +77,7 @@ struct shhhseqsData {
        MothurOut* m;
        int start;
        int end;
-       int sigma, threadID;
+       int sigma, threadID, count;
        vector<string> groups;
        vector<string> mapfileNames;
        
@@ -95,6 +95,7 @@ struct shhhseqsData {
                sigma = s;
                threadID = tid;
                groups = gr;
+        count=0;
        }
 };
 
@@ -113,6 +114,8 @@ static DWORD WINAPI MyShhhSeqsThreadFunction(LPVOID lpParam){
                //precluster each group
                for (int k = pDataArray->start; k < pDataArray->end; k++) {
                        
+            pDataArray->count++;
+            
                        int start = time(NULL);
                        
                        if (pDataArray->m->control_pressed) {  return 0; }
index ae5b652a3cbfa0e43aa74e495bb28eb16775d9d3..0f6f719ef568446af70438eb08579a81c7c6f3f6 100644 (file)
@@ -441,7 +441,10 @@ int SummaryQualCommand::createProcessesCreateSummary(vector<int>& position, vect
                
                //Close all thread handles and free memory allocations.
                for(int i=0; i < pDataArray.size(); i++){
-                       numSeqs += pDataArray[i]->count;
+                       numSeqs += pDataArray[i]->numSeqs;
+            if (pDataArray[i]->count != pDataArray[i]->end) {
+                m->mothurOut("[ERROR]: process " + toString(i) + " only processed " + toString(pDataArray[i]->count) + " of " + toString(pDataArray[i]->end) + " sequences assigned to it, quitting. \n"); m->control_pressed = true; 
+            }
             int tempNum = pDataArray[i]->position.size();
             if (position.size() < tempNum) { position.resize(tempNum, 0); }
                        if (averageQ.size() < tempNum) { averageQ.resize(tempNum, 0); }
index 49583b059f5380ce049ac759dd94d8d25b1c7193..b9edc5148ca5f7a834433815204b40f9ea317db4 100644 (file)
@@ -66,7 +66,7 @@ struct seqSumQualData {
        string filename; 
        unsigned long long start;
        unsigned long long end;
-       int count;
+       int count, numSeqs;
        MothurOut* m;
     bool hasNameMap;
        map<string, int> nameMap;
@@ -101,7 +101,8 @@ static DWORD WINAPI MySeqSumQualThreadFunction(LPVOID lpParam){
                        in.seekg(pDataArray->start-1); pDataArray->m->gobble(in); 
                }
                
-               int count = 0;
+               pDataArray->count = 0;
+        pDataArray->numSeqs = 0;
                for(int i = 0; i < pDataArray->end; i++){ //end is the number of sequences to process
                                
                        if (pDataArray->m->control_pressed) { in.close(); pDataArray->count = 1; return 1; }
@@ -138,11 +139,11 @@ static DWORD WINAPI MySeqSumQualThreadFunction(LPVOID lpParam){
                                        else { pDataArray->scores.at(i)[thisScores[i]] += num; }  
                                }
                                
-                               count += num;
+                               pDataArray->numSeqs += num;
+                pDataArray->count++;
                        }
                }
                
-               pDataArray->count = count;
                in.close();
                
                return 0;
index 9893ea747a1a58799280b259c0950f47837b1af7..e82d1f6600e0b83f79154634ddfbda43d7542d91 100644 (file)
@@ -742,6 +742,9 @@ int SummarySharedCommand::process(vector<SharedRAbundVector*> thisLookup, string
                 
                 //Close all thread handles and free memory allocations.
                 for(int i=0; i < pDataArray.size(); i++){
+                    if (pDataArray[i]->count != (pDataArray[i]->end-pDataArray[i]->start)) {
+                        m->mothurOut("[ERROR]: process " + toString(i) + " only processed " + toString(pDataArray[i]->count) + " of " + toString(pDataArray[i]->end-pDataArray[i]->start) + " groups assigned to it, quitting. \n"); m->control_pressed = true; 
+                    }
                     m->appendFiles((sumFileName + toString(processIDS[i]) + ".temp"), sumFileName);
                     m->mothurRemove((sumFileName + toString(processIDS[i]) + ".temp"));
                     
index f486d520216bd8ec4858d50cd7f2d92b7fd23537..8ba9b9fcf3e40b745cf75ddbaccd2f6df8cde652 100644 (file)
@@ -112,6 +112,7 @@ struct summarySharedData {
        unsigned long long end;
        MothurOut* m;
        string sumFile;
+    int count;
        
        summarySharedData(){}
        summarySharedData(string sf, MothurOut* mout, unsigned long long st, unsigned long long en, vector<string> est, vector<SharedRAbundVector*> lu) {
@@ -121,6 +122,7 @@ struct summarySharedData {
                end = en;
         Estimators = est;
         thisLookup = lu;
+        count=0;
        }
 };
 /**************************************************************************************************/
@@ -225,7 +227,7 @@ static DWORD WINAPI MySummarySharedThreadFunction(LPVOID lpParam){
                
                vector<SharedRAbundVector*> subset;
                for (int k = pDataArray->start; k < pDataArray->end; k++) { // pass cdd each set of groups to compare
-            
+            pDataArray->count++;
                        for (int l = 0; l < k; l++) {
                                
                                outputFileHandle << pDataArray->thisLookup[0]->getLabel() << '\t';
index 7803d89497a7fface1856dff7d374cb563a6328d..0df53d5649881c924be60140338e5fff7c2bc840 100644 (file)
@@ -890,6 +890,9 @@ int TreeGroupCommand::process(vector<SharedRAbundVector*> thisLookup) {
                 
                 //Close all thread handles and free memory allocations.
                 for(int i=0; i < pDataArray.size(); i++){
+                    if (pDataArray[i]->count != (pDataArray[i]->end-pDataArray[i]->start)) {
+                        m->mothurOut("[ERROR]: process " + toString(i) + " only processed " + toString(pDataArray[i]->count) + " of " + toString(pDataArray[i]->end-pDataArray[i]->start) + " groups assigned to it, quitting. \n"); m->control_pressed = true; 
+                    }
                     for (int j = 0; j < pDataArray[i]->thisLookup.size(); j++) {  delete pDataArray[i]->thisLookup[j];  } 
                     
                     for (int k = 0; k < calcDists.size(); k++) {
index 979612f4aea3aa41187ea520483afadfa05b1782..36c852bd8ef545894b9aa00245064eb112e236c6 100644 (file)
@@ -139,6 +139,7 @@ struct treeSharedData {
        unsigned long long start;
        unsigned long long end;
        MothurOut* m;
+    int count;
        
        treeSharedData(){}
        treeSharedData(MothurOut* mout, unsigned long long st, unsigned long long en, vector<string> est, vector<SharedRAbundVector*> lu) {
@@ -147,6 +148,7 @@ struct treeSharedData {
                end = en;
         Estimators = est;
         thisLookup = lu;
+        count=0;
        }
 };
 /**************************************************************************************************/
@@ -249,6 +251,8 @@ static DWORD WINAPI MyTreeSharedThreadFunction(LPVOID lpParam){
                vector<SharedRAbundVector*> subset;
                for (int k = pDataArray->start; k < pDataArray->end; k++) { // pass cdd each set of groups to compare
                        
+            pDataArray->count++;
+            
                        for (int l = 0; l < k; l++) {
                                
                                if (k != l) { //we dont need to similiarity of a groups to itself
index 53084078f3d4c079773a4e1cb73ebb1774726b37..b208209e2a808a0f92cca9f160f4da456450e153 100644 (file)
@@ -1152,6 +1152,9 @@ int TrimSeqsCommand::createProcessesCreateTrim(string filename, string qFileName
                
                //Close all thread handles and free memory allocations.
                for(int i=0; i < pDataArray.size(); i++){
+            if (pDataArray[i]->count != pDataArray[i]->lineEnd) {
+                m->mothurOut("[ERROR]: process " + toString(i) + " only processed " + toString(pDataArray[i]->count) + " of " + toString(pDataArray[i]->lineEnd) + " sequences assigned to it, quitting. \n"); m->control_pressed = true;
+            }
                        for (map<string, int>::iterator it = pDataArray[i]->groupCounts.begin(); it != pDataArray[i]->groupCounts.end(); it++) {
                 map<string, int>::iterator it2 = groupCounts.find(it->first);
                 if (it2 == groupCounts.end()) {        groupCounts[it->first] = it->second; }
index 891b14dc463342e9403aab317fc0877fdd78e82c..2ab7de3e7fc62835429581757fda19f25abad030 100644 (file)
@@ -254,7 +254,7 @@ static DWORD WINAPI MyTrimThreadFunction(LPVOID lpParam){
                
                TrimOligos trimOligos(pDataArray->pdiffs, pDataArray->bdiffs, pDataArray->ldiffs, pDataArray->sdiffs, pDataArray->primers, pDataArray->barcodes, pDataArray->revPrimer, pDataArray->linker, pDataArray->spacer);
         
-               pDataArray->count = pDataArray->lineEnd;
+               pDataArray->count = 0;
                for(int i = 0; i < pDataArray->lineEnd; i++){ //end is the number of sequences to process
                                   
                        if (pDataArray->m->control_pressed) { 
@@ -281,6 +281,7 @@ static DWORD WINAPI MyTrimThreadFunction(LPVOID lpParam){
                        
                        string origSeq = currSeq.getUnaligned();
                        if (origSeq != "") {
+                pDataArray->count++;
                                
                                int barcodeIndex = 0;
                                int primerIndex = 0;