- for (int i = 0; i < globaldata->Groups.size(); i++) {
- SharedRAbundVector* temp = new SharedRAbundVector();
- *temp = getSharedRAbundVector(globaldata->Groups[i]);
- lookup.push_back(temp);
+ for (int i = 0; i < allGroups.size(); i++) {
+ SharedRAbundVector* temp = new SharedRAbundVector(data.size());
+ finder[allGroups[i]] = temp;
+ finder[allGroups[i]]->setLabel(label);
+ finder[allGroups[i]]->setGroup(allGroups[i]);
+ if (m->inUsersGroups(allGroups[i], m->getGroups())) { //if this group is in user groups
+ lookup.push_back(finder[allGroups[i]]);
+ }else {
+ lookupDelete.push_back(finder[allGroups[i]]);
+ }
+ }
+
+ //fill vectors
+ for(int i=0;i<numBins;i++){
+ 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]);
+ }
+ }
+ }