]> git.donarmstrong.com Git - mothur.git/blobdiff - consensuscommand.cpp
added pipeline commands which involved change to command factory and command class...
[mothur.git] / consensuscommand.cpp
index a65d56fb86c2a8a91ac2915def73d05c7e53b6d6..a7469902d44cb9f16b4a109f8e0bc7a0182f7f86 100644 (file)
@@ -9,6 +9,53 @@
 
 #include "consensuscommand.h"
 
+//**********************************************************************************************************************
+vector<string> ConcensusCommand::getValidParameters(){ 
+       try {
+               vector<string> myArray; 
+               return myArray;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "ConcensusCommand", "getValidParameters");
+               exit(1);
+       }
+}
+//**********************************************************************************************************************
+vector<string> ConcensusCommand::getRequiredParameters(){      
+       try {
+               vector<string> myArray; 
+               return myArray;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "ConcensusCommand", "getRequiredParameters");
+               exit(1);
+       }
+}
+//**********************************************************************************************************************
+vector<string> ConcensusCommand::getRequiredFiles(){   
+       try {
+               string AlignArray[] =  {"tree","group"};
+               vector<string> myArray (AlignArray, AlignArray+(sizeof(AlignArray)/sizeof(string)));
+               return myArray;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "ConcensusCommand", "getRequiredFiles");
+               exit(1);
+       }
+}
+//**********************************************************************************************************************
+ConcensusCommand::ConcensusCommand(){  
+       try {
+               //initialize outputTypes
+               vector<string> tempOutNames;
+               outputTypes["tree"] = tempOutNames;
+               outputTypes["nodepairs"] = tempOutNames;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "ConcensusCommand", "ConcensusCommand");
+               exit(1);
+       }
+}
 //**********************************************************************************************************************
 
 ConcensusCommand::ConcensusCommand(string fileroot)  {
@@ -16,6 +63,11 @@ ConcensusCommand::ConcensusCommand(string fileroot)  {
                globaldata = GlobalData::getInstance();
                abort = false;
                
+               //initialize outputTypes
+               vector<string> tempOutNames;
+               outputTypes["tree"] = tempOutNames;
+               outputTypes["nodepairs"] = tempOutNames;
+               
                filename = fileroot;
                
                t = globaldata->gTree;
@@ -67,7 +119,7 @@ int ConcensusCommand::execute(){
                if (m->control_pressed) { return 0; }
                
                //open file for pairing not included in the tree
-               notIncluded = filename + ".cons.pairs";
+               notIncluded = filename + ".cons.pairs"; outputNames.push_back(notIncluded);  outputTypes["nodepairs"].push_back(notIncluded);
                m->openOutputFile(notIncluded, out2);
                
                consensusTree = new Tree();
@@ -150,7 +202,7 @@ int ConcensusCommand::execute(){
                        out2 << '\t' << it2->second << endl;
                }
                
-               outputFile = filename + ".cons.tre";
+               outputFile = filename + ".cons.tre";  outputNames.push_back(outputFile); outputTypes["tree"].push_back(outputFile);
                m->openOutputFile(outputFile, out);
                
                consensusTree->printForBoot(out);