+
+ if (Sets.size() != 0) { //user selected sets, so we want to remove the samples not in those sets
+ SharedUtil util;
+ vector<string> dGroups = designMap->getNamesOfGroups();
+ util.setGroups(Sets, dGroups);
+
+ for(int i=0;i<distanceMatrix.size();i++){
+
+ if (m->control_pressed) { delete designMap; return 0; }
+
+ string group = designMap->getGroup(sampleNames[i]);
+
+ if (group == "not found") {
+ m->mothurOut("[ERROR]: " + sampleNames[i] + " is not in your design file, please correct."); m->mothurOutEndLine(); m->control_pressed = true;
+ }else if (!m->inUsersGroups(group, Sets)){ //not in set we want remove it
+ //remove from all other rows
+ for(int j=0;j<distanceMatrix.size();j++){
+ distanceMatrix[j].erase(distanceMatrix[j].begin()+i);
+ }
+ distanceMatrix.erase(distanceMatrix.begin()+i);
+ sampleNames.erase(sampleNames.begin()+i);
+ i--;
+ }
+ }
+ }
+