]> git.donarmstrong.com Git - mothur.git/blobdiff - getrabundcommand.cpp
added set.current and get.current commands and modified existing commands to update...
[mothur.git] / getrabundcommand.cpp
index a38aeb30dea60a2fe67984fa05dc83b6fb9130e1..3b03f3694967d6d480ba0dc00153454c7e8b074f 100644 (file)
@@ -24,7 +24,7 @@ vector<string> GetRAbundCommand::getValidParameters(){
 //**********************************************************************************************************************
 GetRAbundCommand::GetRAbundCommand(){  
        try {
-               //initialize outputTypes
+               abort = true; calledHelp = true; 
                vector<string> tempOutNames;
                outputTypes["rabund"] = tempOutNames;
        }
@@ -61,12 +61,12 @@ vector<string> GetRAbundCommand::getRequiredFiles(){
 GetRAbundCommand::GetRAbundCommand(string option)  {
        try {
                globaldata = GlobalData::getInstance();
-               abort = false;
+               abort = false; calledHelp = false;   
                allLines = 1;
                labels.clear();
                
                //allow user to run help
-               if(option == "help") { help(); abort = true; }
+               if(option == "help") { help(); abort = true; calledHelp = true; }
                
                else {
                        //valid paramters for this command
@@ -157,7 +157,7 @@ GetRAbundCommand::~GetRAbundCommand(){}
 int GetRAbundCommand::execute(){
        try {
        
-               if (abort == true) { return 0; }
+               if (abort == true) { if (calledHelp) { return 0; }  return 2;   }
                
                //read first line
                read = new ReadOTUFile(globaldata->inputFileName);      
@@ -262,6 +262,13 @@ int GetRAbundCommand::execute(){
                
                globaldata->gListVector = NULL;
                
+               //set rabund file as new current rabundfile
+               string current = "";
+               itTypes = outputTypes.find("rabund");
+               if (itTypes != outputTypes.end()) {
+                       if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setRabundFile(current); }
+               }
+               
                return 0;               
        }