X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=clearcutcommand.cpp;h=6a0eb259379df8480341a5542a7456fc674aea74;hb=f509429e06e545bde69c97cacc0eb436775bd329;hp=d3c7fa48128246f8f4cb28ad53727329b3de856c;hpb=4e4d3cb3315fe25b40383c6f65cd6be23f58903d;p=mothur.git diff --git a/clearcutcommand.cpp b/clearcutcommand.cpp index d3c7fa4..6a0eb25 100644 --- a/clearcutcommand.cpp +++ b/clearcutcommand.cpp @@ -86,7 +86,27 @@ string ClearcutCommand::getHelpString(){ exit(1); } } - +//********************************************************************************************************************** +string ClearcutCommand::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 == "tree") { outputFileName = "tre"; } + else if (type == "matrixout") { outputFileName = ""; } + 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, "ClearcutCommand", "getOutputFileNameTag"); + exit(1); + } +} //********************************************************************************************************************** ClearcutCommand::ClearcutCommand(){ try { @@ -244,7 +264,7 @@ int ClearcutCommand::execute() { if (abort == true) { if (calledHelp) { return 0; } return 2; } //prepare filename - string outputName = outputDir + m->getRootName(m->getSimpleName(inputFile)) + "tre"; + string outputName = outputDir + m->getRootName(m->getSimpleName(inputFile)) + getOutputFileNameTag("tree"); outputNames.push_back(outputName); outputTypes["tree"].push_back(outputName); vector cPara;