]> git.donarmstrong.com Git - mothur.git/blobdiff - treegroupscommand.cpp
changes to dist.seqs and pairwise.seqs and cluster.classic no longer resizes
[mothur.git] / treegroupscommand.cpp
index 637eccedfc77e74556de6bf3f201270b28874d96..64bcd36764e044a911295870025095016be7fcc3 100644 (file)
 #include "sharedmorisitahorn.h"
 #include "sharedbraycurtis.h"
 
-
+//**********************************************************************************************************************
+vector<string> TreeGroupCommand::getValidParameters(){ 
+       try {
+               string Array[] =  {"label","calc","groups", "phylip", "column", "name", "precision","cutoff","outputdir","inputdir"};
+               vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
+               return myArray;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "TreeGroupCommand", "getValidParameters");
+               exit(1);
+       }
+}
+//**********************************************************************************************************************
+TreeGroupCommand::TreeGroupCommand(){  
+       try {
+               abort = true;
+               globaldata = GlobalData::getInstance();
+               //initialize outputTypes
+               vector<string> tempOutNames;
+               outputTypes["tree"] = tempOutNames;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "TreeGroupCommand", "TreeGroupCommand");
+               exit(1);
+       }
+}
+//**********************************************************************************************************************
+vector<string> TreeGroupCommand::getRequiredParameters(){      
+       try {
+               vector<string> myArray;
+               return myArray;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "TreeGroupCommand", "getRequiredParameters");
+               exit(1);
+       }
+}
+//**********************************************************************************************************************
+vector<string> TreeGroupCommand::getRequiredFiles(){   
+       try {
+               string Array[] =  {"phylip","column","shared","or"};
+               vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
+               return myArray;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "TreeGroupCommand", "getRequiredFiles");
+               exit(1);
+       }
+}
 //**********************************************************************************************************************
 
 TreeGroupCommand::TreeGroupCommand(string option)  {
@@ -50,7 +98,9 @@ TreeGroupCommand::TreeGroupCommand(string option)  {
                                if (validParameter.isValidParameter(it->first, myArray, it->second) != true) {  abort = true;  }
                        }
                        
-                       globaldata->newRead();
+                       //initialize outputTypes
+                       vector<string> tempOutNames;
+                       outputTypes["tree"] = tempOutNames;
                        
                        //if the user changes the input directory command factory will send this info to us in the output parameter 
                        string inputDir = validParameter.validFile(parameters, "inputdir", false);              
@@ -88,12 +138,12 @@ TreeGroupCommand::TreeGroupCommand(string option)  {
                        phylipfile = validParameter.validFile(parameters, "phylip", true);
                        if (phylipfile == "not open") { abort = true; }
                        else if (phylipfile == "not found") { phylipfile = ""; }        
-                       else {  format = "phylip";  globaldata->setPhylipFile(phylipfile);      }
+                       else {  globaldata->newRead(); format = "phylip";  globaldata->setPhylipFile(phylipfile);       }
                        
                        columnfile = validParameter.validFile(parameters, "column", true);
                        if (columnfile == "not open") { abort = true; } 
                        else if (columnfile == "not found") { columnfile = ""; }
-                       else {  format = "column"; globaldata->setColumnFile(columnfile);       }
+                       else {  globaldata->newRead(); format = "column"; globaldata->setColumnFile(columnfile);        }
                        
                        namefile = validParameter.validFile(parameters, "name", true);
                        if (namefile == "not open") { abort = true; }   
@@ -326,7 +376,7 @@ int TreeGroupCommand::execute(){
 
                        //create a new filename
                        outputFile = outputDir + m->getRootName(m->getSimpleName(globaldata->inputFileName)) + "tre";   
-                       outputNames.push_back(outputFile);
+                       outputNames.push_back(outputFile); outputTypes["tree"].push_back(outputFile);
                                
                        createTree();
                        
@@ -597,7 +647,7 @@ int TreeGroupCommand::process(vector<SharedRAbundVector*> thisLookup) {
                
                                        //create a new filename
                                        outputFile = outputDir + m->getRootName(m->getSimpleName(globaldata->inputFileName)) + treeCalculators[i]->getName() + "." + thisLookup[0]->getLabel() + ".tre";                                
-                                       outputNames.push_back(outputFile);
+                                       outputNames.push_back(outputFile); outputTypes["tree"].push_back(outputFile); 
                                                                                                
                                        for (int k = 0; k < thisLookup.size(); k++) { 
                                                for (int l = k; l < thisLookup.size(); l++) {