- names = get(i);
- while (names.find_first_of(',') != -1) {
- name = names.substr(0,names.find_first_of(','));
- names = names.substr(names.find_first_of(',')+1, names.length());
- group = groupmap->getGroup(name);
- if(group == "not found") { mothurOut("Error: Sequence '" + name + "' was not found in the group file, please correct."); mothurOutEndLine(); exit(1); }
- if (group == groupName) { //this name is in the group you want the vector for.
- rav.set(i, rav.getAbundance(i) + 1, group); //i represents what bin you are in
- }
- }
-
- //get last name
- groupName = groupmap->getGroup(names);
- if(groupName == "not found") { mothurOut("Error: Sequence '" + names + "' was not found in the group file, please correct."); mothurOutEndLine(); exit(1); }
- if (group == groupName) { //this name is in the group you want the vector for.
- rav.set(i, rav.getAbundance(i) + 1, group); //i represents what bin you are in
+ string names = get(i);
+ vector<string> binNames;
+ m->splitAtComma(names, binNames);
+ for (int j = 0; j < binNames.size(); j++) {
+ if (m->control_pressed) { return rav; }
+ if (m->groupMode == "group") {
+ string group = groupmap->getGroup(binNames[j]);
+ if(group == "not found") { m->mothurOut("Error: Sequence '" + binNames[j] + "' was not found in the group file, please correct."); m->mothurOutEndLine(); exit(1); }
+ if (group == groupName) { //this name is in the group you want the vector for.
+ rav.set(i, rav.getAbundance(i) + 1, group); //i represents what bin you are in
+ }
+ }else {
+ int count = countTable->getGroupCount(binNames[j], groupName);
+ rav.set(i, rav.getAbundance(i) + count, groupName);
+ }