X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=heatmapsimcommand.cpp;h=7ab178c528f40b6c5b9456880545c104701debf8;hb=6d12ed0ba66fb35e9e2781fe3ca361e2293f2476;hp=7e77980659681cd6aa4bbafbc6d502e4e0064bc7;hpb=a76d81690125ca57d7f602ac93abad75cf9796c2;p=mothur.git diff --git a/heatmapsimcommand.cpp b/heatmapsimcommand.cpp index 7e77980..7ab178c 100644 --- a/heatmapsimcommand.cpp +++ b/heatmapsimcommand.cpp @@ -19,7 +19,53 @@ #include "sharedmorisitahorn.h" #include "sharedbraycurtis.h" - +//********************************************************************************************************************** +vector HeatMapSimCommand::getValidParameters(){ + try { + string Array[] = {"groups","label", "calc","phylip","column","name","outputdir","inputdir"}; + vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); + return myArray; + } + catch(exception& e) { + m->errorOut(e, "HeatMapSimCommand", "getValidParameters"); + exit(1); + } +} +//********************************************************************************************************************** +HeatMapSimCommand::HeatMapSimCommand(){ + try { + abort = true; + //initialize outputTypes + vector tempOutNames; + outputTypes["svg"] = tempOutNames; + } + catch(exception& e) { + m->errorOut(e, "HeatMapSimCommand", "HeatMapSimCommand"); + exit(1); + } +} +//********************************************************************************************************************** +vector HeatMapSimCommand::getRequiredParameters(){ + try { + vector myArray; + return myArray; + } + catch(exception& e) { + m->errorOut(e, "HeatMapSimCommand", "getRequiredParameters"); + exit(1); + } +} +//********************************************************************************************************************** +vector HeatMapSimCommand::getRequiredFiles(){ + try { + vector myArray; + return myArray; + } + catch(exception& e) { + m->errorOut(e, "HeatMapSimCommand", "getRequiredFiles"); + exit(1); + } +} //********************************************************************************************************************** HeatMapSimCommand::HeatMapSimCommand(string option) { @@ -50,6 +96,10 @@ HeatMapSimCommand::HeatMapSimCommand(string option) { if (validParameter.isValidParameter(it->first, myArray, it->second) != true) { abort = true; } } + //initialize outputTypes + vector tempOutNames; + outputTypes["svg"] = tempOutNames; + format = ""; //if the user changes the output directory command factory will send this info to us in the output parameter outputDir = validParameter.validFile(parameters, "outputdir", false); if (outputDir == "not found"){ outputDir = ""; } @@ -240,7 +290,7 @@ int HeatMapSimCommand::execute(){ delete heatmap; delete validCalculator; - if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; } + if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear(); return 0; } m->mothurOutEndLine(); m->mothurOut("Output File Names: "); m->mothurOutEndLine(); @@ -286,7 +336,7 @@ int HeatMapSimCommand::runCommandShared() { m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine(); vector outfilenames = heatmap->getPic(lookup, heatCalculators); - for(int i = 0; i < outfilenames.size(); i++) { outputNames.push_back(outfilenames[i]); } + for(int i = 0; i < outfilenames.size(); i++) { outputNames.push_back(outfilenames[i]); outputTypes["svg"].push_back(outfilenames[i]); } processedLabels.insert(lookup[0]->getLabel()); userLabels.erase(lookup[0]->getLabel()); @@ -300,7 +350,7 @@ int HeatMapSimCommand::runCommandShared() { m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine(); vector outfilenames = heatmap->getPic(lookup, heatCalculators); - for(int i = 0; i < outfilenames.size(); i++) { outputNames.push_back(outfilenames[i]); } + for(int i = 0; i < outfilenames.size(); i++) { outputNames.push_back(outfilenames[i]); outputTypes["svg"].push_back(outfilenames[i]); } processedLabels.insert(lookup[0]->getLabel()); userLabels.erase(lookup[0]->getLabel()); @@ -344,7 +394,7 @@ int HeatMapSimCommand::runCommandShared() { m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine(); vector outfilenames = heatmap->getPic(lookup, heatCalculators); - for(int i = 0; i < outfilenames.size(); i++) { outputNames.push_back(outfilenames[i]); } + for(int i = 0; i < outfilenames.size(); i++) { outputNames.push_back(outfilenames[i]); outputTypes["svg"].push_back(outfilenames[i]); } for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } } @@ -482,8 +532,10 @@ int HeatMapSimCommand::runCommandDist() { delete nameMap; } - - outputNames.push_back(heatmap->getPic(matrix, names)); //vector>, vector + + string outputFileName = heatmap->getPic(matrix, names); + outputNames.push_back(outputFileName); //vector>, vector + outputTypes["svg"].push_back(outputFileName); return 0; }