]> git.donarmstrong.com Git - mothur.git/blobdiff - summarysharedcommand.cpp
line and label no longer persist between commands. Added phylip formated output...
[mothur.git] / summarysharedcommand.cpp
index fafc290b0cdf8dd9bce4c7cb626797c6bf1ba4af..6a09ada5d3e8e4141c56a0c0ef4943beae6ef815 100644 (file)
@@ -164,14 +164,20 @@ int SummarySharedCommand::execute(){
                        outputFileHandle.close();  remove(outputFileName.c_str());
                        if (mult == true) {  outAll.close();  remove(outAllFileName.c_str());  }
                        return 0;
+               //if you only have 2 groups you don't need a .sharedmultiple file
+               }else if ((lookup.size() == 2) && (mult == true)) { 
+                       mult = false;
+                       outAll.close();  
+                       remove(outAllFileName.c_str());
                }
                                        
                //if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
                set<string> processedLabels;
                set<string> userLabels = globaldata->labels;
+               set<int> userLines = globaldata->lines;
                
                //as long as you are not at the end of the file or done wih the lines you want
-               while((lookup[0] != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0))) {
+               while((lookup[0] != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) {
                
                        if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(lookup[0]->getLabel()) == 1){                   
                                cout << lookup[0]->getLabel() << '\t' << count << endl;
@@ -179,6 +185,7 @@ int SummarySharedCommand::execute(){
                                
                                processedLabels.insert(lookup[0]->getLabel());
                                userLabels.erase(lookup[0]->getLabel());
+                               userLines.erase(count);
                        }
                        
                        if ((anyLabelsToProcess(lookup[0]->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLookup[0]->getLabel()) != 1)) {