X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=makecontigscommand.cpp;h=ed2f05d5559584101fc77c55c09b2af3d078729d;hb=957d67f7d8bbadfd2930de061e89fd9b149270fd;hp=523edd5e8ba1fd00f1bf5050a380b43e1549ee4f;hpb=01f6af90c907264686304a5c684c702e94ff40ae;p=mothur.git diff --git a/makecontigscommand.cpp b/makecontigscommand.cpp index 523edd5..ed2f05d 100644 --- a/makecontigscommand.cpp +++ b/makecontigscommand.cpp @@ -56,7 +56,28 @@ string MakeContigsCommand::getHelpString(){ exit(1); } } - +//********************************************************************************************************************** +string MakeContigsCommand::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 = "contigs.fasta"; } + else if (type == "qfile") { outputFileName = "contigs.qual"; } + else if (type == "mismatch") { outputFileName = "contigs.mismatch"; } + 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, "MakeContigsCommand", "getOutputFileNameTag"); + exit(1); + } +} //********************************************************************************************************************** MakeContigsCommand::MakeContigsCommand(){ try { @@ -189,9 +210,9 @@ int MakeContigsCommand::execute(){ if (m->control_pressed) { return 0; } - string outFastaFile = outputDir + m->getRootName(m->getSimpleName(ffastqfile)) + "contigs.fasta"; - string outQualFile = outputDir + m->getRootName(m->getSimpleName(ffastqfile)) + "contigs.qual"; - string outMisMatchFile = outputDir + m->getRootName(m->getSimpleName(ffastqfile)) + "contigs.mismatches"; + string outFastaFile = outputDir + m->getRootName(m->getSimpleName(ffastqfile)) + getOutputFileNameTag("fasta"); + string outQualFile = outputDir + m->getRootName(m->getSimpleName(ffastqfile)) + getOutputFileNameTag("qfile"); + string outMisMatchFile = outputDir + m->getRootName(m->getSimpleName(ffastqfile)) + getOutputFileNameTag("mismatches"); outputNames.push_back(outFastaFile); outputTypes["fasta"].push_back(outFastaFile); outputNames.push_back(outQualFile); outputTypes["qfile"].push_back(outQualFile); outputNames.push_back(outMisMatchFile); outputTypes["mismatch"].push_back(outMisMatchFile);