]> git.donarmstrong.com Git - mothur.git/blobdiff - getsabundcommand.cpp
working on pca
[mothur.git] / getsabundcommand.cpp
index 8ad8b4b710f0c2bba003d12f355be1dff3d5f636..0533af3604bd6361dadae6294efeb11f6c6c8fd2 100644 (file)
@@ -24,7 +24,7 @@ vector<string> GetSAbundCommand::getValidParameters(){
 //**********************************************************************************************************************
 GetSAbundCommand::GetSAbundCommand(){  
        try {
-               //initialize outputTypes
+               abort = true; calledHelp = true; 
                vector<string> tempOutNames;
                outputTypes["sabund"] = tempOutNames;
        }
@@ -60,12 +60,12 @@ vector<string> GetSAbundCommand::getRequiredFiles(){
 GetSAbundCommand::GetSAbundCommand(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
@@ -151,7 +151,7 @@ GetSAbundCommand::~GetSAbundCommand(){
 int GetSAbundCommand::execute(){
        try {
                
-               if (abort == true) { return 0; }
+               if (abort == true) { if (calledHelp) { return 0; }  return 2;   }
        
                //using order vector so you don't have to distinguish between the list and rabund files
                read = new ReadOTUFile(globaldata->inputFileName);      
@@ -248,6 +248,13 @@ int GetSAbundCommand::execute(){
                m->mothurOut(filename); m->mothurOutEndLine();  outputNames.push_back(filename); outputTypes["sabund"].push_back(filename);
                m->mothurOutEndLine();
                
+               //set sabund file as new current sabundfile
+               string current = "";
+               itTypes = outputTypes.find("sabund");
+               if (itTypes != outputTypes.end()) {
+                       if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setSabundFile(current); }
+               }
+               
                return 0;               
        }