]> git.donarmstrong.com Git - mothur.git/blobdiff - splitgroupscommand.cpp
fixed clearcut version bug, added group count output to get.groups and remove.groups
[mothur.git] / splitgroupscommand.cpp
index 3fa7d047b372a1c4335b9446c1b34d2aac9b702a..16d90a48372f7c97d46f7fd4d0b640fde6b533fb 100644 (file)
@@ -48,8 +48,7 @@ vector<string> SplitGroupCommand::getRequiredFiles(){
 //**********************************************************************************************************************
 SplitGroupCommand::SplitGroupCommand(){        
        try {
-               abort = true;
-               //initialize outputTypes
+               abort = true; calledHelp = true; 
                vector<string> tempOutNames;
                outputTypes["fasta"] = tempOutNames;
                outputTypes["name"] = tempOutNames;
@@ -62,10 +61,10 @@ SplitGroupCommand::SplitGroupCommand(){
 //**********************************************************************************************************************
 SplitGroupCommand::SplitGroupCommand(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
@@ -171,7 +170,7 @@ SplitGroupCommand::~SplitGroupCommand(){ }
 int SplitGroupCommand::execute(){
        try {
        
-               if (abort == true) {    return 0;       }
+               if (abort == true) { if (calledHelp) { return 0; }  return 2;   }
                
                groupMap = new GroupMap(groupfile);
                groupMap->readMap();
@@ -185,6 +184,17 @@ int SplitGroupCommand::execute(){
                
                if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) {        remove(outputNames[i].c_str()); } return 0; }
                
+               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); }
+               }
+               
                m->mothurOutEndLine();
                m->mothurOut("Output File Names: "); m->mothurOutEndLine();
                for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }