X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;ds=sidebyside;f=countseqscommand.cpp;h=8a18fc755e66a04d6013ecbf7dd088821088501a;hb=49d2b7459c5027557564b21e9487dadafbbbdc96;hp=e83c6035731aa5509655dcd25a7a45995c1a0004;hpb=ee8403d4eb5760187d62b42a9cf4272de8fc0ec4;p=mothur.git diff --git a/countseqscommand.cpp b/countseqscommand.cpp index e83c603..8a18fc7 100644 --- a/countseqscommand.cpp +++ b/countseqscommand.cpp @@ -46,7 +46,26 @@ string CountSeqsCommand::getHelpString(){ exit(1); } } - +//********************************************************************************************************************** +string CountSeqsCommand::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 = "seq.count"; } + 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, "CountSeqsCommand", "getOutputFileNameTag"); + exit(1); + } +} //********************************************************************************************************************** CountSeqsCommand::CountSeqsCommand(){ try { @@ -147,7 +166,7 @@ int CountSeqsCommand::execute(){ if (abort == true) { if (calledHelp) { return 0; } return 2; } ofstream out; - string outputFileName = outputDir + m->getRootName(m->getSimpleName(namefile)) + "seq.count"; + string outputFileName = outputDir + m->getRootName(m->getSimpleName(namefile)) + getOutputFileNameTag("summary"); m->openOutputFile(outputFileName, out); outputTypes["summary"].push_back(outputFileName); out << "Representative_Sequence\ttotal\t";