X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=pairwiseseqscommand.cpp;fp=pairwiseseqscommand.cpp;h=1fa96e3e9d4c6cf8ce9a4e99af30d01c5562a009;hb=49d2b7459c5027557564b21e9487dadafbbbdc96;hp=a4ccbf8f33b34b5dd8eccebf91242249cc465f28;hpb=ee8403d4eb5760187d62b42a9cf4272de8fc0ec4;p=mothur.git diff --git a/pairwiseseqscommand.cpp b/pairwiseseqscommand.cpp index a4ccbf8..1fa96e3 100644 --- a/pairwiseseqscommand.cpp +++ b/pairwiseseqscommand.cpp @@ -64,7 +64,27 @@ string PairwiseSeqsCommand::getHelpString(){ exit(1); } } - +//********************************************************************************************************************** +string PairwiseSeqsCommand::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 == "phylip") { outputFileName = "dist"; } + else if (type == "column") { outputFileName = "dist"; } + 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, "PairwiseSeqsCommand", "getOutputFileNameTag"); + exit(1); + } +} //********************************************************************************************************************** PairwiseSeqsCommand::PairwiseSeqsCommand(){ try { @@ -272,14 +292,14 @@ int PairwiseSeqsCommand::execute(){ string outputFile = ""; if (output == "lt") { //does the user want lower triangle phylip formatted file - outputFile = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + "phylip.dist"; + outputFile = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + "phylip." + getOutputFileNameTag("phylip"); m->mothurRemove(outputFile); outputTypes["phylip"].push_back(outputFile); }else if (output == "column") { //user wants column format - outputFile = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + "dist"; + outputFile = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + getOutputFileNameTag("column"); outputTypes["column"].push_back(outputFile); m->mothurRemove(outputFile); }else { //assume square - outputFile = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + "square.dist"; + outputFile = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + "square." + getOutputFileNameTag("phylip"); m->mothurRemove(outputFile); outputTypes["phylip"].push_back(outputFile); }