+}
+/***********************************************************************/
+vector<SharedRAbundVector*> SharedListVector::getSharedRAbundVector() {
+ try {
+ SharedUtil* util;
+ util = new SharedUtil();
+ vector<SharedRAbundVector*> lookup; //contains just the groups the user selected
+ vector<SharedRAbundVector*> lookupDelete;
+ map<string, SharedRAbundVector*> finder; //contains all groups in groupmap
+
+ vector<string> Groups = m->getGroups();
+ vector<string> allGroups;
+ if (m->groupMode == "group") { allGroups = groupmap->getNamesOfGroups(); }
+ else { allGroups = countTable->getNamesOfGroups(); }
+ util->setGroups(Groups, allGroups);
+ m->setGroups(Groups);
+ delete util;
+
+ 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]);
+ }
+ }
+ }
+ }
+
+ for (int j = 0; j < lookupDelete.size(); j++) { delete lookupDelete[j]; }
+
+ return lookup;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "SharedListVector", "getSharedRAbundVector");