+
+
+ if (persample) {
+ //divide names by group
+ map<string, vector<string> > parsedNames;
+ map<string, vector<string> >::iterator itParsed;
+
+ //parse names by group
+ for (int j = 0; j < names.size(); j++) {
+ if (groupfile != "") {
+ string group = groupMap->getGroup(names[j]);
+ itParsed = parsedNames.find(group);
+
+ if (itParsed != parsedNames.end()) { itParsed->second.push_back(names[j]); }
+ else { vector<string> tempNames; tempNames.push_back(names[j]); parsedNames[group] = tempNames; }
+ }else { //count file was used
+ vector<string> thisSeqsGroups = ct->getGroups(names[j]);
+ for (int k = 0; k < thisSeqsGroups.size(); k++) {
+ string group = thisSeqsGroups[k];
+ itParsed = parsedNames.find(group);
+
+ if (itParsed != parsedNames.end()) { itParsed->second.push_back(names[j]); }
+ else { vector<string> tempNames; tempNames.push_back(names[j]); parsedNames[group] = tempNames; }
+ }
+ }
+ }
+
+ for (itParsed = parsedNames.begin(); itParsed != parsedNames.end(); itParsed++) {
+ vector<string> theseNames = findConsensusTaxonomy(itParsed->second, size, conTax);
+
+ if (m->control_pressed) { break; }
+
+ //output to new names file
+ string binLabel = "Otu";
+ string sbinNumber = toString(i+1);
+ if (sbinNumber.length() < snumBins.length()) {
+ int diff = snumBins.length() - sbinNumber.length();
+ for (int h = 0; h < diff; h++) { binLabel += "0"; }
+ }
+ binLabel += sbinNumber;
+
+ (*outs[groupIndex[itParsed->first]]) << binLabel << '\t' << size << '\t' << conTax << endl;
+
+ string noConfidenceConTax = conTax;
+ m->removeConfidences(noConfidenceConTax);
+
+ //add this bins taxonomy to summary
+ if (basis == "sequence") {
+ for(int j = 0; j < theseNames.size(); j++) {
+ int numReps = 1;
+ if (countfile != "") { numReps = ct->getGroupCount(theseNames[j], itParsed->first); } //get num seqs for this seq from this group
+ for(int k = 0; k < numReps; k++) { (taxaSums[groupIndex[itParsed->first]])->addSeqToTree(theseNames[j], noConfidenceConTax); }
+ }
+ }else { //otu
+ map<string, bool> containsGroup;
+ containsGroup[itParsed->first] = true;
+ (taxaSums[groupIndex[itParsed->first]])->addSeqToTree(noConfidenceConTax, containsGroup);
+ }
+ }
+ }