+
+ /********************************************************/
+ //calculate a D value for each group combo
+ for(int v=0;v<t->getNumLeaves();v++){
+ int index = v;
+ double sum = 0.0000;
+
+ //while you aren't at root
+ while(t->tree[index].getParent() != -1){
+
+ //if you have a BL
+ if(t->tree[index].getBranchLength() != -1){
+ sum += t->tree[index].getBranchLength();
+ }
+
+ index = t->tree[index].getParent();
+ }
+
+ //get last breanch length added
+ if(t->tree[index].getBranchLength() != -1){
+ sum += t->tree[index].getBranchLength();
+ }
+
+ if (globaldata->Groups.size() == 0) {
+ //is this sum from a sequence which is in one of the users groups
+ if (inUsersGroups(t->tree[v].getGroup(), tmap->namesOfGroups) == true) {
+ //is this sum from a sequence which is in this groupCombo
+ if ((t->tree[v].getGroup() == tmap->namesOfGroups[b-1]) || (t->tree[v].getGroup() == tmap->namesOfGroups[l])) {
+ sum /= (double)tmap->seqsPerGroup[t->tree[v].getGroup()];
+ D[n-1] += sum;
+ }
+ }
+ }else {
+ //is this sum from a sequence which is in one of the users groups
+ if (inUsersGroups(t->tree[v].getGroup(), globaldata->Groups) == true) {
+ //is this sum from a sequence which is in this groupCombo
+ if ((t->tree[v].getGroup() == globaldata->Groups[b-1]) || (t->tree[v].getGroup() == globaldata->Groups[l])) {
+ sum /= (double)tmap->seqsPerGroup[t->tree[v].getGroup()];
+ D[n-1] += sum;
+ }
+ }
+ }
+ }
+ /*********************************************************/
+ //calculate a u value for each combo