X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=parselistscommand.cpp;h=4e61a58d9e5cb4bc640c544797c87a363580575e;hb=e10c72304ee071c0c40e0218a06d89dc4731cbc2;hp=bb096d8646873f74c42bd8970b9eef9693a3252e;hpb=55386dddad84cc1140d736cabaf4dd0ae16f2e01;p=mothur.git diff --git a/parselistscommand.cpp b/parselistscommand.cpp index bb096d8..4e61a58 100644 --- a/parselistscommand.cpp +++ b/parselistscommand.cpp @@ -45,6 +45,27 @@ string ParseListCommand::getHelpString(){ exit(1); } } +//********************************************************************************************************************** +string ParseListCommand::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 { m->mothurOut("[ERROR]: No definition for type " + type + " output file tag.\n"); m->control_pressed = true; } + } + return outputFileName; + } + catch(exception& e) { + m->errorOut(e, "ParseListCommand", "getOutputFileNameTag"); + exit(1); + } +} + //********************************************************************************************************************** ParseListCommand::ParseListCommand(){ try { @@ -180,7 +201,7 @@ int ParseListCommand::execute(){ temp = new ofstream; filehandles[gGroups[i]] = temp; - string filename = fileroot + gGroups[i] + ".list"; + string filename = fileroot + gGroups[i] + "." + getOutputFileNameTag("list"); outputNames.push_back(filename); outputTypes["list"].push_back(filename); m->openOutputFile(filename, *temp); }