X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=summarytaxcommand.cpp;fp=summarytaxcommand.cpp;h=3e16e74005c5f0b7cfc62d32df7c172be805e511;hb=49d2b7459c5027557564b21e9487dadafbbbdc96;hp=ffa304102b95570669e4e977a9f4859b18c24c71;hpb=ee8403d4eb5760187d62b42a9cf4272de8fc0ec4;p=mothur.git diff --git a/summarytaxcommand.cpp b/summarytaxcommand.cpp index ffa3041..3e16e74 100644 --- a/summarytaxcommand.cpp +++ b/summarytaxcommand.cpp @@ -48,7 +48,26 @@ string SummaryTaxCommand::getHelpString(){ exit(1); } } - +//********************************************************************************************************************** +string SummaryTaxCommand::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 == "summary") { outputFileName = "tax.summary"; } + 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, "SummaryTaxCommand", "getOutputFileNameTag"); + exit(1); + } +} //********************************************************************************************************************** SummaryTaxCommand::SummaryTaxCommand(){ try { @@ -225,7 +244,7 @@ int SummaryTaxCommand::execute(){ //print summary file ofstream outTaxTree; - string summaryFile = outputDir + m->getRootName(m->getSimpleName(taxfile)) + "tax.summary"; + string summaryFile = outputDir + m->getRootName(m->getSimpleName(taxfile)) + getOutputFileNameTag("summary"); m->openOutputFile(summaryFile, outTaxTree); taxaSum->print(outTaxTree); outTaxTree.close();