]> git.donarmstrong.com Git - mothur.git/blobdiff - getrabundcommand.cpp
added code to check path for uchime and catchall executables
[mothur.git] / getrabundcommand.cpp
index 65eedaa39f1c2efaccc97ac4b2f44f325ddf6a9f..5a33253ff1ec2b67a9e995b940f09349241494f5 100644 (file)
@@ -69,6 +69,7 @@ GetRAbundCommand::GetRAbundCommand(string option)  {
                
                //allow user to run help
                if(option == "help") { help(); abort = true; calledHelp = true; }
+               else if(option == "citation") { citation(); abort = true; calledHelp = true;}
                
                else {
                        vector<string> myArray = setParameters();
@@ -115,12 +116,12 @@ GetRAbundCommand::GetRAbundCommand(string option)  {
                        listfile = validParameter.validFile(parameters, "list", true);
                        if (listfile == "not open") { listfile = ""; abort = true; }
                        else if (listfile == "not found") { listfile = ""; }
-                       else {  format = "list"; inputfile = listfile; }
+                       else {  format = "list"; inputfile = listfile; m->setListFile(listfile); }
                        
                        sabundfile = validParameter.validFile(parameters, "sabund", true);
                        if (sabundfile == "not open") { sabundfile = ""; abort = true; }        
                        else if (sabundfile == "not found") { sabundfile = ""; }
-                       else {  format = "sabund"; inputfile = sabundfile; }
+                       else {  format = "sabund"; inputfile = sabundfile; m->setSabundFile(sabundfile); }
                        
                        
                        //check for optional parameter and set defaults
@@ -183,19 +184,17 @@ int GetRAbundCommand::execute(){
                set<string> processedLabels;
                set<string> userLabels = labels;
                
-               if (m->control_pressed) {  outputTypes.clear();  out.close(); remove(filename.c_str()); delete rabund; delete input; return 0; }
+               if (m->control_pressed) {  outputTypes.clear();  out.close(); m->mothurRemove(filename); delete rabund; delete input; return 0; }
                
                while((rabund != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
                        
                        if(allLines == 1 || labels.count(rabund->getLabel()) == 1){
                                        m->mothurOut(rabund->getLabel()); m->mothurOutEndLine();
                                        
-                                       if (m->control_pressed) {   outputTypes.clear(); out.close(); remove(filename.c_str());  delete input; delete rabund;  return 0;  }
+                                       if (m->control_pressed) {   outputTypes.clear(); out.close(); m->mothurRemove(filename);  delete input; delete rabund;  return 0;  }
                                        
                                        if(sorted)      {   rabund->print(out);                         }
                                        else            {       rabund->nonSortedPrint(out);    }
-                                       
-                                       delete rabund;
                                                                                                                        
                                        processedLabels.insert(rabund->getLabel());
                                        userLabels.erase(rabund->getLabel());
@@ -209,13 +208,11 @@ int GetRAbundCommand::execute(){
                                        
                                        m->mothurOut(rabund->getLabel()); m->mothurOutEndLine();
                                        
-                                       if (m->control_pressed) {   outputTypes.clear(); out.close(); remove(filename.c_str());  delete input; delete rabund;  return 0;  }
+                                       if (m->control_pressed) {   outputTypes.clear(); out.close(); m->mothurRemove(filename);  delete input; delete rabund;  return 0;  }
                                        
                                        if(sorted)      {   rabund->print(out);                         }
                                        else            {       rabund->nonSortedPrint(out);    }
 
-                                       delete rabund;
-
                                        processedLabels.insert(rabund->getLabel());
                                        userLabels.erase(rabund->getLabel());
                                        
@@ -249,7 +246,7 @@ int GetRAbundCommand::execute(){
                        
                        m->mothurOut(rabund->getLabel()); m->mothurOutEndLine();
                                        
-                       if (m->control_pressed) {  outputTypes.clear(); out.close(); remove(filename.c_str());  delete input; delete rabund;  return 0; }
+                       if (m->control_pressed) {  outputTypes.clear(); out.close(); m->mothurRemove(filename);  delete input; delete rabund;  return 0; }
                        
                        if(sorted)      {   rabund->print(out);                         }
                        else            {       rabund->nonSortedPrint(out);    }