+void LibShuffCommand::setGroups() {
+ try {
+ //if the user has not entered specific groups to analyze then do them all
+ if (globaldata->Groups.size() == 0) {
+ numGroups = globaldata->gGroupmap->getNumGroups();
+ for (int i=0; i < numGroups; i++) {
+ globaldata->Groups.push_back(globaldata->gGroupmap->namesOfGroups[i]);
+ }
+ }else {
+ if (globaldata->getGroups() != "all") {
+ //check that groups are valid
+ for (int i = 0; i < globaldata->Groups.size(); i++) {
+ if (globaldata->gGroupmap->isValidGroup(globaldata->Groups[i]) != true) {
+ cout << globaldata->Groups[i] << " is not a valid group, and will be disregarded." << endl;
+ // erase the invalid group from globaldata->Groups
+ globaldata->Groups.erase (globaldata->Groups.begin()+i);
+ }
+ }
+
+ //if the user only entered invalid groups
+ if ((globaldata->Groups.size() == 0) || (globaldata->Groups.size() == 1)) {
+ numGroups = globaldata->gGroupmap->getNumGroups();
+ for (int i=0; i < numGroups; i++) {
+ globaldata->Groups.push_back(globaldata->gGroupmap->namesOfGroups[i]);
+ }
+ cout << "When using the groups parameter you must have at least 2 valid groups. I will run the command using all the groups in your groupfile." << endl;
+ }else { numGroups = globaldata->Groups.size(); }
+ }else { //users wants all groups
+ numGroups = globaldata->gGroupmap->getNumGroups();
+ globaldata->Groups.clear();
+ for (int i=0; i < numGroups; i++) {
+ globaldata->Groups.push_back(globaldata->gGroupmap->namesOfGroups[i]);
+ }
+ }
+ }
+
+ // number of comparisons i.e. with groups A,B,C = AA, AB, AC, BA, BB, BC...;
+ for (int i=0; i<numGroups; i++) {
+ for (int l = 0; l < numGroups; l++) {
+ //set group comparison labels
+ groupComb.push_back(globaldata->Groups[i] + "-" + globaldata->Groups[l]);
+ }
+ }
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the LibShuffCommand class Function setGroups. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the LibShuffCommand class function setGroups. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+}
+/***********************************************************/
+int LibShuffCommand::findIndex(float score, int index) {
+ try{
+ for (int i = 0; i < rsumDelta[index].size(); i++) {
+ if (rsumDelta[index][i] >= score) { return i; }
+ }
+ return rsumDelta[index].size();
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the LibShuffCommand class Function findIndex. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the LibShuffCommand class function findIndex. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+}
+
+/***********************************************************/
+