X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=mantelcommand.cpp;fp=mantelcommand.cpp;h=f3259e6096c3e0c1373e1c091078c9ceac377f82;hb=49d2b7459c5027557564b21e9487dadafbbbdc96;hp=409eae414779acb412abec7aa295b61e82cd0e16;hpb=ee8403d4eb5760187d62b42a9cf4272de8fc0ec4;p=mothur.git diff --git a/mantelcommand.cpp b/mantelcommand.cpp index 409eae4..f3259e6 100644 --- a/mantelcommand.cpp +++ b/mantelcommand.cpp @@ -50,6 +50,26 @@ string MantelCommand::getHelpString(){ } } //********************************************************************************************************************** +string MantelCommand::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 == "mantel") { outputFileName = "mantel"; } + 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, "MantelCommand", "getOutputFileNameTag"); + exit(1); + } +} +//********************************************************************************************************************** MantelCommand::MantelCommand(){ try { abort = true; calledHelp = true; @@ -206,7 +226,7 @@ int MantelCommand::execute(){ if (m->control_pressed) { return 0; } - string outputFile = outputDir + m->getRootName(m->getSimpleName(phylipfile1)) + "mantel"; + string outputFile = outputDir + m->getRootName(m->getSimpleName(phylipfile1)) + getOutputFileNameTag("mantel"); outputNames.push_back(outputFile); outputTypes["mantel"].push_back(outputFile); ofstream out;