X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=treegroupscommand.cpp;h=626659501a531db80f5193bef33e88793414a874;hb=d04f948b1a2a1a2984fc4a45d04403b8c121c5bc;hp=3403b9934dfb9366d066a64ed5552484b2e4275c;hpb=15bc21bb4281af0f3ea7b29d9b9363f4635ef939;p=mothur.git diff --git a/treegroupscommand.cpp b/treegroupscommand.cpp index 3403b99..6266595 100644 --- a/treegroupscommand.cpp +++ b/treegroupscommand.cpp @@ -19,7 +19,55 @@ #include "sharedmorisitahorn.h" #include "sharedbraycurtis.h" - +//********************************************************************************************************************** +vector TreeGroupCommand::getValidParameters(){ + try { + string Array[] = {"label","calc","groups", "phylip", "column", "name", "precision","cutoff","outputdir","inputdir"}; + vector 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 tempOutNames; + outputTypes["tree"] = tempOutNames; + } + catch(exception& e) { + m->errorOut(e, "TreeGroupCommand", "TreeGroupCommand"); + exit(1); + } +} +//********************************************************************************************************************** +vector TreeGroupCommand::getRequiredParameters(){ + try { + vector myArray; + return myArray; + } + catch(exception& e) { + m->errorOut(e, "TreeGroupCommand", "getRequiredParameters"); + exit(1); + } +} +//********************************************************************************************************************** +vector TreeGroupCommand::getRequiredFiles(){ + try { + string Array[] = {"phylip","column","shared","or"}; + vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); + return myArray; + } + catch(exception& e) { + m->errorOut(e, "TreeGroupCommand", "getRequiredFiles"); + exit(1); + } +} //********************************************************************************************************************** TreeGroupCommand::TreeGroupCommand(string option) { @@ -50,6 +98,10 @@ TreeGroupCommand::TreeGroupCommand(string option) { if (validParameter.isValidParameter(it->first, myArray, it->second) != true) { abort = true; } } + //initialize outputTypes + vector 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); if (inputDir == "not found"){ inputDir = ""; } @@ -324,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(); @@ -595,7 +647,7 @@ int TreeGroupCommand::process(vector 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++) { @@ -617,6 +669,21 @@ int TreeGroupCommand::process(vector thisLookup) { } } + //createdistance file from simMatrix + /*string o = outputDir + m->getRootName(m->getSimpleName(globaldata->inputFileName)) + treeCalculators[i]->getName() + "." + thisLookup[0]->getLabel() + ".dist"; + ofstream outDist; + m->openOutputFile(o, outDist); + outDist << simMatrix.size() << endl; + for (int k = 0; k < simMatrix.size(); k++) { + outDist << thisLookup[k]->getGroup() << '\t'; + for (int l = 0; l < k; l++) { + outDist << (1.0-simMatrix[k][l]) << '\t'; + } + outDist << endl; + } + outDist.close();*/ + + if (m->control_pressed) { return 1; } //creates tree from similarity matrix and write out file createTree();