]> git.donarmstrong.com Git - mothur.git/blobdiff - collectsharedcommand.cpp
fixed bugs with trim.seqs and bdiffs
[mothur.git] / collectsharedcommand.cpp
index 201709ea83ff099f9afe97b2e3af69bdb4fbe1ce..40b911bb8c844ad252a714383ce93109772209a0 100644 (file)
@@ -208,6 +208,7 @@ void CollectSharedCommand::help(){
                m->mothurOut("Example collect.shared(label=unique-.01-.03, freq=10, groups=B-C, calc=sharedchao-sharedace-jabund-sorensonabund-jclass-sorclass-jest-sorest-thetayc-thetan).\n");
                m->mothurOut("The default values for freq is 100 and calc are sharedsobs-sharedchao-sharedace-jabund-sorensonabund-jclass-sorclass-jest-sorest-thetayc-thetan.\n");
                m->mothurOut("The default value for groups is all the groups in your groupfile.\n");
+               m->mothurOut("The freq parameter is used indicate when to output your data, by default it is set to 100. But you can set it to a percentage of the number of sequence. For example freq=0.10, means 10%. \n");
                validCalculator->printCalc("shared", cout);
                m->mothurOut("The label parameter is used to analyze specific labels in your input.\n");
                m->mothurOut("The all parameter is used to specify if you want the estimate of all your groups together.  This estimate can only be made for sharedsobs and sharedchao calculators. The default is false.\n");
@@ -261,26 +262,22 @@ int CollectSharedCommand::execute(){
                util->updateGroupIndex(globaldata->Groups, globaldata->gGroupmap->groupIndex);
 
                while((order != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
-
-                       if(allLines == 1 || labels.count(order->getLabel()) == 1){
-                               
-                               //create collectors curve
-                               cCurve = new Collect(order, cDisplays);
-                               int error = cCurve->getSharedCurve(freq);
-                               delete cCurve;
-                               
-                               if (error == 1) {
+                       if (m->control_pressed) { 
                                        for (int i = 0; i < outputNames.size(); i++) {  remove(outputNames[i].c_str());         }  
                                        for(int i=0;i<cDisplays.size();i++){    delete cDisplays[i];    }
-                                       delete input;  globaldata->ginput = NULL;
-                                       delete read;
-                                       delete order; globaldata->gorder = NULL;
-                                       delete validCalculator;
+                                       delete order; 
                                        globaldata->Groups.clear();
                                        return 0;
-                               }
+                       }
+
+                       if(allLines == 1 || labels.count(order->getLabel()) == 1){
                        
                                m->mothurOut(order->getLabel()); m->mothurOutEndLine();
+                               //create collectors curve
+                               cCurve = new Collect(order, cDisplays);
+                               cCurve->getSharedCurve(freq);
+                               delete cCurve;
+                       
                                processedLabels.insert(order->getLabel());
                                userLabels.erase(order->getLabel());
                        }
@@ -292,24 +289,12 @@ int CollectSharedCommand::execute(){
                                delete order;
                                order = input->getSharedOrderVector(lastLabel);
                                
+                               m->mothurOut(order->getLabel()); m->mothurOutEndLine();
                                //create collectors curve
                                cCurve = new Collect(order, cDisplays);
-                               int error = cCurve->getSharedCurve(freq);
+                               cCurve->getSharedCurve(freq);
                                delete cCurve;
                                
-                               if (error == 1) {
-                                       for (int i = 0; i < outputNames.size(); i++) {  remove(outputNames[i].c_str());         }  
-                                       for(int i=0;i<cDisplays.size();i++){    delete cDisplays[i];    }
-                                       delete input;  globaldata->ginput = NULL;
-                                       delete read;
-                                       delete order; globaldata->gorder = NULL;
-                                       delete validCalculator;
-                                       globaldata->Groups.clear();
-                                       return 0;
-                               }
-
-                       
-                               m->mothurOut(order->getLabel()); m->mothurOutEndLine();
                                processedLabels.insert(order->getLabel());
                                userLabels.erase(order->getLabel());
                                
@@ -325,6 +310,13 @@ int CollectSharedCommand::execute(){
                        order = input->getSharedOrderVector();
                }
                
+               if (m->control_pressed) { 
+                                       for (int i = 0; i < outputNames.size(); i++) {  remove(outputNames[i].c_str());         }  
+                                       for(int i=0;i<cDisplays.size();i++){    delete cDisplays[i];    }
+                                       globaldata->Groups.clear();
+                                       return 0;
+               }
+               
                //output error messages about any remaining user labels
                set<string>::iterator it;
                bool needToRun = false;
@@ -342,24 +334,20 @@ int CollectSharedCommand::execute(){
                if (needToRun == true)  {
                        if (order != NULL) {  delete order;  }
                        order = input->getSharedOrderVector(lastLabel);
-
+                       
+                       m->mothurOut(order->getLabel()); m->mothurOutEndLine();
                        cCurve = new Collect(order, cDisplays);
-                       int error = cCurve->getSharedCurve(freq);
+                       cCurve->getSharedCurve(freq);
                        delete cCurve;
                        
-                       if (error == 1) {
+                       if (m->control_pressed) { 
                                for (int i = 0; i < outputNames.size(); i++) {  remove(outputNames[i].c_str());         }  
                                for(int i=0;i<cDisplays.size();i++){    delete cDisplays[i];    }
-                               delete input;  globaldata->ginput = NULL;
-                               delete read;
-                               delete order; globaldata->gorder = NULL;
-                               delete validCalculator;
+                               delete order; 
                                globaldata->Groups.clear();
                                return 0;
                        }
 
-                       
-                       m->mothurOut(order->getLabel()); m->mothurOutEndLine();
                        delete order;
                }