]> git.donarmstrong.com Git - mothur.git/blobdiff - splitgroupscommand.cpp
fixed bugg in shhh.seqs command
[mothur.git] / splitgroupscommand.cpp
index 4be7a0ec8a82133a9eb4def8ee78bd47e0ecbe44..d389d8907bfaffde16b8ca9eac4dad0061341831 100644 (file)
@@ -48,7 +48,7 @@ vector<string> SplitGroupCommand::getRequiredFiles(){
 //**********************************************************************************************************************
 SplitGroupCommand::SplitGroupCommand(){        
        try {
-               //initialize outputTypes
+               abort = true; calledHelp = true; 
                vector<string> tempOutNames;
                outputTypes["fasta"] = tempOutNames;
                outputTypes["name"] = tempOutNames;
@@ -61,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
@@ -170,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();
@@ -320,6 +320,15 @@ int SplitGroupCommand::splitFasta() {
                        (*(filehandles[it3->first])).close();
                        delete it3->second;
                }
+               
+               vector<string> newOutputNames;
+               //remove blank files
+               for (int i = 0; i < outputNames.size(); i++) {
+                       if (m->isBlank(outputNames[i])) {
+                               remove(outputNames[i].c_str());
+                       }else { newOutputNames.push_back(outputNames[i]); }
+               }
+               outputNames = newOutputNames;
                                
                return 0;