X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=makecontigscommand.cpp;h=691d706ab00efa8823412753b72f08e5198873b1;hb=f687723a8357916e86a05116978e6869b039ce36;hp=523edd5e8ba1fd00f1bf5050a380b43e1549ee4f;hpb=01f6af90c907264686304a5c684c702e94ff40ae;p=mothur.git diff --git a/makecontigscommand.cpp b/makecontigscommand.cpp index 523edd5..691d706 100644 --- a/makecontigscommand.cpp +++ b/makecontigscommand.cpp @@ -38,8 +38,8 @@ string MakeContigsCommand::getHelpString(){ string helpString = ""; helpString += "The make.contigs command reads a forward fastq file and a reverse fastq file and outputs new fasta and quality files.\n"; helpString += "The make.contigs command parameters are ffastq, rfastq, align, match, mismatch, gapopen, gapextend and processors.\n"; - helpString += "The ffastq and rfastq parameter is required.\n"; - helpString += "The align parameter allows you to specify the alignment method to use. Your options are: gotoh, needleman, blast and noalign. The default is needleman.\n"; + helpString += "The ffastq and rfastq parameters are required.\n"; + helpString += "The align parameter allows you to specify the alignment method to use. Your options are: gotoh and needleman. The default is needleman.\n"; helpString += "The match parameter allows you to specify the bonus for having the same base. The default is 1.0.\n"; helpString += "The mistmatch parameter allows you to specify the penalty for having different bases. The default is -1.0.\n"; helpString += "The gapopen parameter allows you to specify the penalty for opening a gap in an alignment. The default is -2.0.\n"; @@ -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("mismatch"); 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);