]> git.donarmstrong.com Git - mothur.git/blobdiff - clustercommand.cpp
fixed catchall "clunky" names
[mothur.git] / clustercommand.cpp
index 6043d39be8d559010e156111f41a856b716cda40..391b20a9de857755854401f96869c774508bd0af 100644 (file)
@@ -24,8 +24,7 @@ vector<string> ClusterCommand::getValidParameters(){
 //**********************************************************************************************************************
 ClusterCommand::ClusterCommand(){      
        try {
-               abort = true;
-               //initialize outputTypes
+               abort = true; calledHelp = true; 
                vector<string> tempOutNames;
                outputTypes["list"] = tempOutNames;
                outputTypes["rabund"] = tempOutNames;
@@ -65,10 +64,10 @@ ClusterCommand::ClusterCommand(string option)  {
        try{
                globaldata = GlobalData::getInstance();
                
-               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
@@ -199,7 +198,7 @@ ClusterCommand::~ClusterCommand(){
 int ClusterCommand::execute(){
        try {
        
-               if (abort == true) {    return 0;       }
+               if (abort == true) { if (calledHelp) { return 0; }  return 2;   }
                
                time_t estart = time(NULL);
                //int ndist = matrix->getNNodes();
@@ -295,6 +294,25 @@ int ClusterCommand::execute(){
                        m->mothurOut("changed cutoff to " + toString(cutoff)); m->mothurOutEndLine(); 
                }
                
+               //set list file as new current listfile
+               string current = "";
+               itTypes = outputTypes.find("list");
+               if (itTypes != outputTypes.end()) {
+                       if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setListFile(current); }
+               }
+               
+               //set rabund file as new current rabundfile
+               itTypes = outputTypes.find("rabund");
+               if (itTypes != outputTypes.end()) {
+                       if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setRabundFile(current); }
+               }
+               
+               //set sabund file as new current sabundfile
+               itTypes = outputTypes.find("sabund");
+               if (itTypes != outputTypes.end()) {
+                       if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setSabundFile(current); }
+               }
+               
                m->mothurOutEndLine();
                m->mothurOut("Output File Names: "); m->mothurOutEndLine();
                for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }