+}
+/**************************************************************************************************/
+
+void SharedUtil::getSharedVectorswithReplacement(vector<string> Groups, vector<SharedRAbundVector*>& lookup, SharedOrderVector* order) {
+ try {
+
+ //delete each sharedrabundvector in lookup
+ for (int j = 0; j < lookup.size(); j++) {
+ delete lookup[j];
+ }
+ lookup.clear();
+
+ //create and initialize vector of sharedvectors, one for each group
+ for (int i = 0; i < Groups.size(); i++) {
+ SharedRAbundVector* temp = new SharedRAbundVector(order->getNumBins());
+ temp->setLabel(order->getLabel());
+ temp->setGroup(Groups[i]);
+ lookup.push_back(temp);
+ }
+
+ int numSeqs = order->size();
+
+ //sample all the members
+ for(int i=0;i<numSeqs;i++){
+ //get random number
+ int random = int((float)(i+1) * (float)(rand()) / ((float)RAND_MAX+1.0));
+ individual chosen = order->get(random);
+
+ int abundance;
+ //set info for sharedvector in chosens group
+ for (int j = 0; j < lookup.size(); j++) {
+ if (chosen.group == lookup[j]->getGroup()) {
+ abundance = lookup[j]->getAbundance(chosen.bin);
+ lookup[j]->set(chosen.bin, (abundance + 1), chosen.group);
+ break;
+ }
+ }
+ }
+
+ }
+ catch(exception& e) {
+ m->errorOut(e, "SharedUtil", "getSharedVectorswithReplacement");