]> git.donarmstrong.com Git - mothur.git/blobdiff - seqsummarycommand.cpp
changes while testing
[mothur.git] / seqsummarycommand.cpp
index 8f27b8c7beaf797775f680bdef5c34bcf7f980c8..27bb8d95190fb66ea03510cf266d2d53824d988c 100644 (file)
@@ -203,7 +203,7 @@ int SeqSummaryCommand::execute(){
                if (namefile != "") { nameMap = m->readNames(namefile); }
         else if (countfile != "") {
             CountTable ct;
-            ct.readTable(countfile);
+            ct.readTable(countfile, false);
             nameMap = ct.getNameMap();
         }
                
@@ -415,6 +415,13 @@ int SeqSummaryCommand::execute(){
                        }
                #endif
 
+        //set fasta file as new current fastafile
+               string current = "";
+               itTypes = outputTypes.find("summary");
+               if (itTypes != outputTypes.end()) {
+                       if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setSummaryFile(current); }
+               }
+        
                return 0;
        }
        catch(exception& e) {
@@ -445,11 +452,15 @@ int SeqSummaryCommand::driverCreateSummary(vector<int>& startPosition, vector<in
                while (!done) {
                                
                        if (m->control_pressed) { in.close(); outSummary.close(); return 1; }
-                                       
+            
+            if (m->debug) { m->mothurOut("[DEBUG]: count = " + toString(count) + "\n");  }
+            
                        Sequence current(in); m->gobble(in);
            
                        if (current.getName() != "") {
                                
+                if (m->debug) { m->mothurOut("[DEBUG]: " + current.getName() + '\t' + toString(current.getNumBases()) + "\n");  }
+                
                                int num = 1;
                                if ((namefile != "") || (countfile != "")) {
                                        //make sure this sequence is in the namefile, else error 
@@ -473,6 +484,8 @@ int SeqSummaryCommand::driverCreateSummary(vector<int>& startPosition, vector<in
                                outSummary << current.getStartPos() << '\t' << current.getEndPos() << '\t';
                                outSummary << current.getNumBases() << '\t' << current.getAmbigBases() << '\t';
                                outSummary << current.getLongHomoPolymer() << '\t' << num << endl;
+                
+                if (m->debug) { m->mothurOut("[DEBUG]: " + current.getName() + '\t' + toString(current.getNumBases()) + "\n");  }
                        }
                        
                        #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
@@ -481,13 +494,8 @@ int SeqSummaryCommand::driverCreateSummary(vector<int>& startPosition, vector<in
                        #else
                                if (in.eof()) { break; }
                        #endif
-                       
-                       //report progress
-                       //if((count) % 100 == 0){       m->mothurOut(toString(count)); m->mothurOutEndLine();           }
                }
-               //report progress
-               //if((count) % 100 != 0){       m->mothurOut(toString(count)); m->mothurOutEndLine();           }
-               
+                               
                in.close();
                
                return count;
@@ -675,6 +683,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]);       }