X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=degapseqscommand.cpp;fp=degapseqscommand.cpp;h=318a05ec0bee7765f835cce4301d2b7a97d16978;hb=49d2b7459c5027557564b21e9487dadafbbbdc96;hp=1d83f3bef00d08574a66d7e5ecf21efa148452a4;hpb=ee8403d4eb5760187d62b42a9cf4272de8fc0ec4;p=mothur.git diff --git a/degapseqscommand.cpp b/degapseqscommand.cpp index 1d83f3b..318a05e 100644 --- a/degapseqscommand.cpp +++ b/degapseqscommand.cpp @@ -46,6 +46,26 @@ string DegapSeqsCommand::getHelpString(){ } } //********************************************************************************************************************** +string DegapSeqsCommand::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 == "fasta") { outputFileName = "ng.fasta"; } + 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, "DegapSeqsCommand", "getOutputFileNameTag"); + exit(1); + } +} +//********************************************************************************************************************** DegapSeqsCommand::DegapSeqsCommand(){ try { abort = true; calledHelp = true; @@ -193,7 +213,7 @@ int DegapSeqsCommand::execute(){ ofstream outFASTA; string tempOutputDir = outputDir; if (outputDir == "") { tempOutputDir = m->hasPath(fastaFileNames[s]); } - string degapFile = tempOutputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + "ng.fasta"; + string degapFile = tempOutputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + getOutputFileNameTag("fasta"); m->openOutputFile(degapFile, outFASTA); while(!inFASTA.eof()){