+
+ //numComp+1 for AB, AC, BC, ABC
+ data.resize(numComp+1,0);
+
+ int count = 0;
+ for (int a=0; a<numGroups; a++) {
+ for (int l = a+1; l < numGroups; l++) {
+ UniqueBL=0.0000; //a branch length is unique if it's chidren are from the same group
+ totalBL = 0.00; //all branch lengths
+ UW = 0.00; //Unweighted Value = UniqueBL / totalBL;
+
+ //copy random tree passed in
+ copyTree->getCopy(t);
+
+ //groups in this combo
+ groups.push_back(globaldata->Groups[a]); groups.push_back(globaldata->Groups[l]);
+
+ //swap labels in the groups you want to compare
+ copyTree->assembleRandomUnifracTree(groups[0], groups[1]);
+
+ if (m->control_pressed) { delete copyTree; return data; }
+
+ for(int i=0;i<copyTree->getNumNodes();i++){
+
+ if (m->control_pressed) { return data; }
+
+ //pcountSize = 0, they are from a branch that is entirely from a group the user doesn't want
+ //pcountSize = 2, not unique to one group
+ //pcountSize = 1, unique to one group
+
+ int pcountSize = 0;
+ for (int j = 0; j < groups.size(); j++) {
+ map<string, int>::iterator itGroup = copyTree->tree[i].pcount.find(groups[j]);
+ if (itGroup != copyTree->tree[i].pcount.end()) { pcountSize++; }
+ }
+
+ if (pcountSize == 0) { }
+ else if ((copyTree->tree[i].getBranchLength() != -1) && (pcountSize == 1)) { UniqueBL += abs(copyTree->tree[i].getBranchLength()); }
+
+ if ((copyTree->tree[i].getBranchLength() != -1) && (pcountSize != 0)) {
+ totalBL += abs(copyTree->tree[i].getBranchLength());
+ }
+ }
+
+
+ UW = (UniqueBL / totalBL);