X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=countseqscommand.cpp;h=7b9aebfbd63d496600a518bca7404f7a4cf4ada0;hb=28bcfc4a41b8b82f66636587e0d4d355d07cbdd1;hp=210dd9641a1736f8b0ea509f96b210dbbe3bd2e1;hpb=f06b339c5fc4b6d1b9d2a08fe16bf7670bf7aeb4;p=mothur.git diff --git a/countseqscommand.cpp b/countseqscommand.cpp index 210dd96..7b9aebf 100644 --- a/countseqscommand.cpp +++ b/countseqscommand.cpp @@ -450,6 +450,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 +522,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; }