From 62c36830aae6dd6151898ec6e07df59c8aed79fe Mon Sep 17 00:00:00 2001 From: westcott Date: Wed, 18 May 2011 15:15:43 +0000 Subject: [PATCH] added name option to trim.seqs --- trimseqscommand.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/trimseqscommand.cpp b/trimseqscommand.cpp index dad8b98..ed84cc0 100644 --- a/trimseqscommand.cpp +++ b/trimseqscommand.cpp @@ -369,7 +369,7 @@ int TrimSeqsCommand::execute(){ #endif if (m->control_pressed) { return 0; } - + if(allFiles){ map uniqueFastaNames;// so we don't add the same groupfile multiple times map::iterator it; @@ -680,6 +680,11 @@ int TrimSeqsCommand::driverCreateTrim(string filename, string qFileName, string } } else{ + if(nameFile != ""){ //needs to be before the currSeq name is changed + map::iterator itName = nameMap.find(currSeq.getName()); + if (itName != nameMap.end()) { scrapNameFile << itName->first << '\t' << itName->second << endl; } + else { m->mothurOut("[ERROR]: " + currSeq.getName() + " is not in your namefile, please correct."); m->mothurOutEndLine(); } + } currSeq.setName(currSeq.getName() + '|' + trashCode); currSeq.setUnaligned(origSeq); currSeq.setAligned(origSeq); @@ -687,11 +692,6 @@ int TrimSeqsCommand::driverCreateTrim(string filename, string qFileName, string if(qFileName != ""){ currQual.printQScores(scrapQualFile); } - if(nameFile != ""){ - map::iterator itName = nameMap.find(currSeq.getName()); - if (itName != nameMap.end()) { scrapNameFile << itName->first << '\t' << itName->second << endl; } - else { m->mothurOut("[ERROR]: " + currSeq.getName() + " is not in your namefile, please correct."); m->mothurOutEndLine(); } - } } count++; } @@ -1143,7 +1143,7 @@ void TrimSeqsCommand::getOligos(vector >& fastaFileNames, vector< if(qFileName != ""){ qualFileName = outputDir + m->getRootName(m->getSimpleName(qFileName)) + comboGroupName + ".qual"; - if (uniqueNames.count(fastaFileName) == 0) { + if (uniqueNames.count(qualFileName) == 0) { outputNames.push_back(qualFileName); outputTypes["qfile"].push_back(qualFileName); } @@ -1154,7 +1154,7 @@ void TrimSeqsCommand::getOligos(vector >& fastaFileNames, vector< if(nameFile != ""){ nameFileName = outputDir + m->getRootName(m->getSimpleName(nameFile)) + comboGroupName + ".names"; - if (uniqueNames.count(fastaFileName) == 0) { + if (uniqueNames.count(nameFileName) == 0) { outputNames.push_back(nameFileName); outputTypes["name"].push_back(nameFileName); } -- 2.39.2