]> git.donarmstrong.com Git - mothur.git/blobdiff - deconvolutecommand.cpp
fixed clearcut version bug, added group count output to get.groups and remove.groups
[mothur.git] / deconvolutecommand.cpp
index 3129ea0ad368cb8c08a5ca2e9f036c38e4b1a441..62daa612d52a04fa72b85c1c621b89b539d14ab0 100644 (file)
@@ -24,7 +24,7 @@ vector<string> DeconvoluteCommand::getValidParameters(){
 //**********************************************************************************************************************
 DeconvoluteCommand::DeconvoluteCommand(){      
        try {
-               //initialize outputTypes
+               abort = true; calledHelp = true; 
                vector<string> tempOutNames;
                outputTypes["fasta"] = tempOutNames;
                outputTypes["name"] = tempOutNames;
@@ -60,10 +60,10 @@ vector<string> DeconvoluteCommand::getRequiredFiles(){
 /**************************************************************************************/
 DeconvoluteCommand::DeconvoluteCommand(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
@@ -152,7 +152,7 @@ void DeconvoluteCommand::help(){
 int DeconvoluteCommand::execute() {    
        try {
                
-               if (abort == true) { return 0; }
+               if (abort == true) { if (calledHelp) { return 0; }  return 2;   }
 
                //prepare filenames and open files
                string outNameFile = outputDir + m->getRootName(m->getSimpleName(inFastaName)) + "names";
@@ -177,7 +177,17 @@ int DeconvoluteCommand::execute() {
                outputNames.push_back(outFastaFile);  outputNames.push_back(outNameFile); outputTypes["fasta"].push_back(outFastaFile);  outputTypes["name"].push_back(outNameFile); 
                m->mothurOutEndLine();
 
-
+               //set fasta file as new current fastafile
+               string current = "";
+               itTypes = outputTypes.find("fasta");
+               if (itTypes != outputTypes.end()) {
+                       if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); }
+               }
+               
+               itTypes = outputTypes.find("name");
+               if (itTypes != outputTypes.end()) {
+                       if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setNameFile(current); }
+               }
                
                return 0;
        }