]> git.donarmstrong.com Git - mothur.git/blobdiff - hclustercommand.cpp
working on pca
[mothur.git] / hclustercommand.cpp
index 69dbef6d15791466813ba0ecdde87f6a68a55664..128dee379080ddf32704367789c916d3bce14f41 100644 (file)
@@ -24,8 +24,7 @@ vector<string> HClusterCommand::getValidParameters(){
 //**********************************************************************************************************************
 HClusterCommand::HClusterCommand(){    
        try {
-               abort = true;
-               //initialize outputTypes
+               abort = true; calledHelp = true; 
                vector<string> tempOutNames;
                outputTypes["list"] = tempOutNames;
                outputTypes["rabund"] = tempOutNames;
@@ -64,10 +63,10 @@ vector<string> HClusterCommand::getRequiredFiles(){
 HClusterCommand::HClusterCommand(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
@@ -237,7 +236,7 @@ HClusterCommand::~HClusterCommand(){}
 int HClusterCommand::execute(){
        try {
        
-               if (abort == true) {    return 0;       }
+               if (abort == true) { if (calledHelp) { return 0; }  return 2;   }
                
                if(namefile != ""){     
                        globaldata->nameMap = new NameAssignment(namefile);
@@ -396,7 +395,26 @@ int HClusterCommand::execute(){
                        for (int i = 0; i < outputNames.size(); i++) {  remove(outputNames[i].c_str());  } outputTypes.clear();
                        return 0;  
                }
-
+               
+               //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();