]> git.donarmstrong.com Git - mothur.git/blobdiff - trimseqscommand.cpp
fixed clearcut version bug, added group count output to get.groups and remove.groups
[mothur.git] / trimseqscommand.cpp
index abfe15a17a18d9e203be7bc4bfaac0fd0e6b4a0f..0e0ed587343e1a02288f7a49b9af18c8dcf846c5 100644 (file)
@@ -352,7 +352,6 @@ int TrimSeqsCommand::execute(){
                if (m->control_pressed) {  return 0; }                  
                        
                if(allFiles){
-                       //clear out all old group files
                        map<string, string> uniqueFastaNames;// so we don't add the same groupfile multiple times
                        map<string, string>::iterator it;
                        set<string> namesToRemove;
@@ -406,14 +405,31 @@ int TrimSeqsCommand::execute(){
 
                //output group counts
                m->mothurOutEndLine();
-               int total = 0;
-               for (int i = 0; i < barcodeNameVector.size(); i++) {
-                       if ((barcodeNameVector[i] != "") && (groupCounts[i] != 0)) { total += groupCounts[i]; m->mothurOut("Group " + barcodeNameVector[i] + " contains " + toString(groupCounts[i]) + " sequences."); m->mothurOutEndLine(); }
-               }
-               if (total != 0) { m->mothurOut("Total of all groups is " + toString(total)); m->mothurOutEndLine(); }
+               //int total = 0;
+//             for (int i = 0; i < barcodeNameVector.size(); i++) {
+//                     if ((barcodeNameVector[i] != "") && (groupCounts[i] != 0)) { total += groupCounts[i]; m->mothurOut("Group " + barcodeNameVector[i] + " contains " + toString(groupCounts[i]) + " sequences."); m->mothurOutEndLine(); }
+//             }
+//             if (total != 0) { m->mothurOut("Total of all groups is " + toString(total)); m->mothurOutEndLine(); }
                
                        if (m->control_pressed) {       for (int i = 0; i < outputNames.size(); i++) {  remove(outputNames[i].c_str()); } return 0;     }
 
+               //set fasta file as new current fastafile
+               string current = "";
+               itTypes = outputTypes.find("fasta");
+               if (itTypes != outputTypes.end()) {
+                       if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); }
+               }
+               
+               itTypes = outputTypes.find("qfile");
+               if (itTypes != outputTypes.end()) {
+                       if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setQualFile(current); }
+               }
+               
+               itTypes = outputTypes.find("group");
+               if (itTypes != outputTypes.end()) {
+                       if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setGroupFile(current); }
+               }
+
                m->mothurOutEndLine();
                m->mothurOut("Output File Names: "); m->mothurOutEndLine();
                for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }