]> git.donarmstrong.com Git - mothur.git/blobdiff - chimerabellerophoncommand.cpp
added set.current and get.current commands and modified existing commands to update...
[mothur.git] / chimerabellerophoncommand.cpp
index 5d7d6d452b2c741ad764623557f0a0d31895ba0e..140a94993df3634fec862bd371f7658390b928e6 100644 (file)
@@ -48,12 +48,10 @@ vector<string> ChimeraBellerophonCommand::getRequiredFiles(){
 //**********************************************************************************************************************
 ChimeraBellerophonCommand::ChimeraBellerophonCommand(){        
        try {
-               abort = true;
-               //initialize outputTypes
+               abort = true; calledHelp = true; 
                vector<string> tempOutNames;
                outputTypes["chimera"] = tempOutNames;
                outputTypes["accnos"] = tempOutNames;
-               outputTypes["fasta"] = tempOutNames;
        }
        catch(exception& e) {
                m->errorOut(e, "ChimeraBellerophonCommand", "ChimeraBellerophonCommand");
@@ -63,10 +61,10 @@ ChimeraBellerophonCommand::ChimeraBellerophonCommand(){
 //***************************************************************************************************************
 ChimeraBellerophonCommand::ChimeraBellerophonCommand(string option)  {
        try {
-               abort = false;
+               abort = false; calledHelp = false;   
                
                //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
@@ -88,7 +86,6 @@ ChimeraBellerophonCommand::ChimeraBellerophonCommand(string option)  {
                        vector<string> tempOutNames;
                        outputTypes["chimera"] = tempOutNames;
                        outputTypes["accnos"] = tempOutNames;
-                       outputTypes["fasta"] = tempOutNames;
                
                        //if the user changes the input directory command factory will send this info to us in the output parameter 
                        string inputDir = validParameter.validFile(parameters, "inputdir", false);              
@@ -210,7 +207,7 @@ ChimeraBellerophonCommand::~ChimeraBellerophonCommand(){    /*      do nothing      */      }
 int ChimeraBellerophonCommand::execute(){
        try{
                
-               if (abort == true) { return 0; }
+               if (abort == true) { if (calledHelp) { return 0; }  return 2;   }
                
                for (int i = 0; i < fastaFileNames.size(); i++) {
                        
@@ -272,6 +269,13 @@ int ChimeraBellerophonCommand::execute(){
                        delete chimera;
                }
                
+               //set accnos file as new current accnosfile
+               string current = "";
+               itTypes = outputTypes.find("accnos");
+               if (itTypes != outputTypes.end()) {
+                       if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setAccnosFile(current); }
+               }
+               
                m->mothurOutEndLine();
                m->mothurOut("Output File Names: "); m->mothurOutEndLine();
                for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }