From: westcott Date: Fri, 20 May 2011 10:48:01 +0000 (+0000) Subject: finished adding the names option to trim.seqs X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=commitdiff_plain;h=fc3a1319b64fd3638df074e4669a1fb0235d1b8d finished adding the names option to trim.seqs --- diff --git a/getgroupscommand.cpp b/getgroupscommand.cpp index e38ac9b..37e5d40 100644 --- a/getgroupscommand.cpp +++ b/getgroupscommand.cpp @@ -241,11 +241,9 @@ int GetGroupsCommand::execute(){ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; } m->mothurOut("Selected " + toString(names.size()) + " sequences. From the groups: "); m->mothurOutEndLine(); - for (int i = 0; i < Groups.size(); i++) { m->mothurOut(Groups[i]); m->mothurOut(" contains " + toString(groupMap->getNumSeqs(Groups[i])) + " sequences."); m->mothurOutEndLine(); } + for (int i = 0; i < Groups.size(); i++) { m->mothurOut(Groups[i]); m->mothurOut("\t" + toString(groupMap->getNumSeqs(Groups[i]))); m->mothurOutEndLine(); } m->mothurOutEndLine(); - - if (outputNames.size() != 0) { m->mothurOutEndLine(); m->mothurOut("Output File names: "); m->mothurOutEndLine(); diff --git a/removegroupscommand.cpp b/removegroupscommand.cpp index 5a70b27..7034941 100644 --- a/removegroupscommand.cpp +++ b/removegroupscommand.cpp @@ -243,7 +243,7 @@ int RemoveGroupsCommand::execute(){ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; } m->mothurOut("Removed " + toString(names.size()) + " sequences. From the groups: "); m->mothurOutEndLine(); - for (int i = 0; i < Groups.size(); i++) { m->mothurOut(Groups[i]); m->mothurOut(" contains " + toString(groupMap->getNumSeqs(Groups[i])) + " sequences."); m->mothurOutEndLine(); } + for (int i = 0; i < Groups.size(); i++) { m->mothurOut(Groups[i]); m->mothurOut("\t" + toString(groupMap->getNumSeqs(Groups[i]))); m->mothurOutEndLine(); } m->mothurOutEndLine(); if (outputNames.size() != 0) { diff --git a/seqerrorcommand.cpp b/seqerrorcommand.cpp index 2bb0e57..d06a5ad 100644 --- a/seqerrorcommand.cpp +++ b/seqerrorcommand.cpp @@ -22,6 +22,7 @@ vector SeqErrorCommand::setParameters(){ CommandParameter pname("name", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(pname); CommandParameter pignorechimeras("ignorechimeras", "Boolean", "", "T", "", "", "",false,false); parameters.push_back(pignorechimeras); CommandParameter pthreshold("threshold", "Number", "", "1.0", "", "", "",false,false); parameters.push_back(pthreshold); + CommandParameter pprocessors("processors", "Number", "", "1", "", "", "",false,false); parameters.push_back(pprocessors); CommandParameter pinputdir("inputdir", "String", "", "", "", "", "",false,false); parameters.push_back(pinputdir); CommandParameter poutputdir("outputdir", "String", "", "", "", "", "",false,false); parameters.push_back(poutputdir); @@ -200,6 +201,10 @@ SeqErrorCommand::SeqErrorCommand(string option) { temp = validParameter.validFile(parameters, "ignorechimeras", false); if (temp == "not found") { temp = "1"; } convert(temp, ignoreChimeras); + + temp = validParameter.validFile(parameters, "processors", false); if (temp == "not found"){ temp = m->getProcessors(); } + m->setProcessors(temp); + convert(temp, processors); substitutionMatrix.resize(6); for(int i=0;i<6;i++){ substitutionMatrix[i].resize(6,0); } diff --git a/seqerrorcommand.h b/seqerrorcommand.h index a47f182..7e87ec6 100644 --- a/seqerrorcommand.h +++ b/seqerrorcommand.h @@ -70,7 +70,7 @@ private: string queryFileName, referenceFileName, qualFileName, reportFileName, namesFileName, outputDir; double threshold; bool ignoreChimeras; - int numRefs; + int numRefs, processors; int maxLength; ofstream errorSummaryFile, errorSeqFile; vector outputNames; diff --git a/trimseqscommand.cpp b/trimseqscommand.cpp index ed84cc0..64522a5 100644 --- a/trimseqscommand.cpp +++ b/trimseqscommand.cpp @@ -432,8 +432,9 @@ int TrimSeqsCommand::execute(){ //output group counts m->mothurOutEndLine(); int total = 0; + if (groupCounts.size() != 0) { m->mothurOut("Group count: \n"); } for (map::iterator it = groupCounts.begin(); it != groupCounts.end(); it++) { - total += it->second; m->mothurOut("Group " + it->first + " contains " + toString(it->second) + " sequences."); m->mothurOutEndLine(); + total += it->second; m->mothurOut(it->first + "\t" + toString(it->second)); m->mothurOutEndLine(); } if (total != 0) { m->mothurOut("Total of all groups is " + toString(total)); m->mothurOutEndLine(); } @@ -650,6 +651,17 @@ int TrimSeqsCommand::driverCreateTrim(string filename, string qFileName, string outGroupsFile << currSeq.getName() << '\t' << thisGroup << endl; + if (nameFile != "") { + map::iterator itName = nameMap.find(currSeq.getName()); + if (itName != nameMap.end()) { + vector thisSeqsNames; + m->splitAtChar(itName->second, thisSeqsNames, ','); + for (int k = 1; k < thisSeqsNames.size(); k++) { //start at 1 to skip self + outGroupsFile << thisSeqsNames[k] << '\t' << thisGroup << endl; + } + }else { m->mothurOut("[ERROR]: " + currSeq.getName() + " is not in your namefile, please correct."); m->mothurOutEndLine(); } + } + map::iterator it = groupCounts.find(thisGroup); if (it == groupCounts.end()) { groupCounts[thisGroup] = 1; } else { groupCounts[it->first]++; }