X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=phylotypecommand.cpp;h=38d3bdf929f4ffc110f76ab0a55b12d66ef4ad08;hb=49d2b7459c5027557564b21e9487dadafbbbdc96;hp=2d2db08a40ea5e1aa8712902dcd419ddb1ad757a;hpb=0caf3fbabaa3ece404f8ce77f4c883dc5b1bf1dc;p=mothur.git diff --git a/phylotypecommand.cpp b/phylotypecommand.cpp index 2d2db08..38d3bdf 100644 --- a/phylotypecommand.cpp +++ b/phylotypecommand.cpp @@ -53,7 +53,28 @@ string PhylotypeCommand::getHelpString(){ exit(1); } } - +//********************************************************************************************************************** +string PhylotypeCommand::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 == "list") { outputFileName = "list"; } + else if (type == "rabund") { outputFileName = "rabund"; } + else if (type == "sabund") { outputFileName = "sabund"; } + 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, "PhylotypeCommand", "getOutputFileNameTag"); + exit(1); + } +} //********************************************************************************************************************** PhylotypeCommand::PhylotypeCommand(){ try { @@ -198,13 +219,13 @@ int PhylotypeCommand::execute(){ string fileroot = outputDir + m->getRootName(m->getSimpleName(taxonomyFileName)); ofstream outList; - string outputListFile = fileroot + "tx.list"; + string outputListFile = fileroot + "tx." + getOutputFileNameTag("list"); m->openOutputFile(outputListFile, outList); ofstream outSabund; - string outputSabundFile = fileroot + "tx.sabund"; + string outputSabundFile = fileroot + "tx." + getOutputFileNameTag("sabund"); m->openOutputFile(outputSabundFile, outSabund); ofstream outRabund; - string outputRabundFile = fileroot + "tx.rabund"; + string outputRabundFile = fileroot + "tx." + getOutputFileNameTag("rabund"); m->openOutputFile(outputRabundFile, outRabund); outputNames.push_back(outputListFile); outputTypes["list"].push_back(outputListFile);