]> git.donarmstrong.com Git - mothur.git/blobdiff - consensuscommand.cpp
fixed clearcut version bug, added group count output to get.groups and remove.groups
[mothur.git] / consensuscommand.cpp
index a7469902d44cb9f16b4a109f8e0bc7a0182f7f86..d64dc93c6b2c9e5812a24b02d19eaac8cc7ff742 100644 (file)
@@ -46,7 +46,7 @@ vector<string> ConcensusCommand::getRequiredFiles(){
 //**********************************************************************************************************************
 ConcensusCommand::ConcensusCommand(){  
        try {
-               //initialize outputTypes
+               abort = true; calledHelp = true; 
                vector<string> tempOutNames;
                outputTypes["tree"] = tempOutNames;
                outputTypes["nodepairs"] = tempOutNames;
@@ -61,7 +61,7 @@ ConcensusCommand::ConcensusCommand(){
 ConcensusCommand::ConcensusCommand(string fileroot)  {
        try {
                globaldata = GlobalData::getInstance();
-               abort = false;
+               abort = false; calledHelp = false;   
                
                //initialize outputTypes
                vector<string> tempOutNames;
@@ -107,7 +107,7 @@ ConcensusCommand::~ConcensusCommand(){}
 int ConcensusCommand::execute(){
        try {
                
-               if (abort == true) { return 0; }
+               if (abort == true) { if (calledHelp) { return 0; }  return 2;   }
                else {  
                        numNodes = t[0]->getNumNodes();
                        numLeaves = t[0]->getNumLeaves();
@@ -205,12 +205,19 @@ int ConcensusCommand::execute(){
                outputFile = filename + ".cons.tre";  outputNames.push_back(outputFile); outputTypes["tree"].push_back(outputFile);
                m->openOutputFile(outputFile, out);
                
-               consensusTree->printForBoot(out);
+               consensusTree->print(out, "boot");
                
                out.close(); out2.close();
                
                delete consensusTree; 
                
+               //set first tree file as new current treefile
+               string currentTree = "";
+               itTypes = outputTypes.find("tree");
+               if (itTypes != outputTypes.end()) {
+                       if ((itTypes->second).size() != 0) { currentTree = (itTypes->second)[0]; m->setTreeFile(currentTree); }
+               }
+               
                return 0;
        }
        catch(exception& e) {