- 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);
-//cout << i << '\t' << name << '\t' << group << endl;
- if(group == "not found") { mothurOut("Error: Sequence '" + name + "' was not found in the group file, please correct."); mothurOutEndLine(); exit(1); }
- finder[group]->set(i, finder[group]->getAbundance(i) + 1, group); //i represents what bin you are in
- }
-
- //get last name
- group = groupmap->getGroup(names);
-//cout << i << '\t' << names << '\t' << group << endl;
- if(group == "not found") { mothurOut("Error: Sequence '" + names + "' was not found in the group file, please correct."); mothurOutEndLine(); exit(1); }
- finder[group]->set(i, finder[group]->getAbundance(i) + 1, group); //i represents what bin you are in
-
- }
-
- if (globaldata->Groups.size() == globaldata->gGroupmap->namesOfGroups.size()) { //no groups specified
- lookup2 = lookup;
- }else{ //delete unwanted groups
- for (int i = 0; i < globaldata->Groups.size(); i++) {
- SharedRAbundVector* temp = new SharedRAbundVector(*finder[globaldata->Groups[i]]);
- lookup2.push_back(temp);
- delete finder[globaldata->Groups[i]]; //so we don't get dup memory
+ string names = get(i);
+ vector<string> binNames;
+ m->splitAtComma(names, binNames);
+ for (int j = 0; j < binNames.size(); j++) {
+ 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); }
+ finder[group]->set(i, finder[group]->getAbundance(i) + 1, group); //i represents what bin you are in
+ }else{
+ vector<int> counts = countTable->getGroupCounts(binNames[j]);
+ for (int k = 0; k < allGroups.size(); k++) {
+ finder[allGroups[k]]->set(i, finder[allGroups[k]]->getAbundance(i) + counts[k], allGroups[k]);
+ }
+ }