X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=metastatscommand.cpp;fp=metastatscommand.cpp;h=b5b01e7f97166ed80143d349b9ae8c340d53e654;hb=49d2b7459c5027557564b21e9487dadafbbbdc96;hp=c5d349bc77b685b67a1e3251fa70f15602bb215d;hpb=ee8403d4eb5760187d62b42a9cf4272de8fc0ec4;p=mothur.git diff --git a/metastatscommand.cpp b/metastatscommand.cpp index c5d349b..b5b01e7 100644 --- a/metastatscommand.cpp +++ b/metastatscommand.cpp @@ -60,6 +60,27 @@ string MetaStatsCommand::getHelpString(){ exit(1); } } +//********************************************************************************************************************** +string MetaStatsCommand::getOutputFileNameTag(string type, string inputName=""){ + try { + string outputFileName = ""; + map >::iterator it; + + //is this a type this command creates + it = outputTypes.find(type); + if (it == outputTypes.end()) { m->mothurOut("[ERROR]: this command doesn't create a " + type + " output file.\n"); } + else { + if (type == "metastats") { outputFileName = "metastats"; } + else { m->mothurOut("[ERROR]: No definition for type " + type + " output file tag.\n"); m->control_pressed = true; } + } + return outputFileName; + } + catch(exception& e) { + m->errorOut(e, "MetaStatsCommand", "getOutputFileNameTag"); + exit(1); + } +} + //********************************************************************************************************************** MetaStatsCommand::MetaStatsCommand(){ try { @@ -449,7 +470,7 @@ int MetaStatsCommand::driver(int start, int num, vector& th string setB = namesOfGroupCombos[c][1]; //get filename - string outputFileName = outputDir + m->getRootName(m->getSimpleName(sharedfile)) + thisLookUp[0]->getLabel() + "." + setA + "-" + setB + ".metastats"; + string outputFileName = outputDir + m->getRootName(m->getSimpleName(sharedfile)) + thisLookUp[0]->getLabel() + "." + setA + "-" + setB + "." + getOutputFileNameTag("metastats"); outputNames.push_back(outputFileName); outputTypes["metastats"].push_back(outputFileName); //int nameLength = outputFileName.length(); //char * output = new char[nameLength];