X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=countseqscommand.cpp;h=75d21c2250166d202f71ed21786dca16db40a38f;hb=ea4f373c28543cd1002b0dd7dc6e55c526647d59;hp=210dd9641a1736f8b0ea509f96b210dbbe3bd2e1;hpb=d70a1c2d70c5a516e74880709e3b48cfc1ce0321;p=mothur.git diff --git a/countseqscommand.cpp b/countseqscommand.cpp index 210dd96..75d21c2 100644 --- a/countseqscommand.cpp +++ b/countseqscommand.cpp @@ -10,6 +10,7 @@ #include "countseqscommand.h" #include "groupmap.h" #include "sharedutilities.h" +#include "counttable.h" //********************************************************************************************************************** vector CountSeqsCommand::setParameters(){ @@ -175,7 +176,7 @@ int CountSeqsCommand::execute(){ int total = 0; if (!large) { total = processSmall(outputFileName); } else { total = processLarge(outputFileName); } - + if (m->control_pressed) { m->mothurRemove(outputFileName); return 0; } //set rabund file as new current rabundfile @@ -450,6 +451,26 @@ map CountSeqsCommand::processNameFile(string name) { in.close(); out.close(); + if (rest != "") { + vector pieces = m->splitWhiteSpace(rest); + + for (int i = 0; i < pieces.size(); i++) { + if (columnOne) { firstCol = pieces[i]; columnOne=false; } + else { secondCol = pieces[i]; pairDone = true; columnOne=true; } + + if (pairDone) { + //parse names into vector + vector theseNames; + m->splitAtComma(secondCol, theseNames); + for (int i = 0; i < theseNames.size(); i++) { out << theseNames[i] << '\t' << count << endl; } + indexToNames[count] = firstCol; + pairDone = false; + count++; + } + } + + } + return indexToNames; } catch(exception& e) { @@ -502,6 +523,26 @@ map CountSeqsCommand::getGroupNames(string filename, set& n } in.close(); out.close(); + + if (rest != "") { + vector pieces = m->splitWhiteSpace(rest); + + for (int i = 0; i < pieces.size(); i++) { + if (columnOne) { firstCol = pieces[i]; columnOne=false; } + else { secondCol = pieces[i]; pairDone = true; columnOne=true; } + + if (pairDone) { + it = groupIndex.find(secondCol); + if (it == groupIndex.end()) { //add group, assigning the group and number so we can use vectors above + groupIndex[secondCol] = count; + count++; + } + out << firstCol << '\t' << groupIndex[secondCol] << endl; + namesOfGroups.insert(secondCol); + pairDone = false; + } + } + } for (it = groupIndex.begin(); it != groupIndex.end(); it++) { indexToGroups[it->second] = it->first; }