- //set non-leaf node info and update leaves to know their parents
- //non-leaf
- t->tree[numGroups + i].setChildren(index[row], index[column]);
-
- //parents
- t->tree[index[row]].setParent(numGroups + i);
- t->tree[index[column]].setParent(numGroups + i);
-
- //blength = distance / 2;
- float blength = ((1.0 - largest) / 2);
-
- //branchlengths
- t->tree[index[row]].setBranchLength(blength - t->tree[index[row]].getLengthToLeaves());
- t->tree[index[column]].setBranchLength(blength - t->tree[index[column]].getLengthToLeaves());
-
- //set your length to leaves to your childs length plus branchlength
- t->tree[numGroups + i].setLengthToLeaves(t->tree[index[row]].getLengthToLeaves() + t->tree[index[row]].getBranchLength());
-
-
- //update index
- index[row] = numGroups+i;
- index[column] = numGroups+i;
-
- //remove highest value that caused the merge.
- simMatrix[row][column] = -1000.0;
- simMatrix[column][row] = -1000.0;
-
- //merge values in simsMatrix
- for (int n = 0; n < simMatrix.size(); n++) {
- //row becomes merge of 2 groups
- simMatrix[row][n] = (simMatrix[row][n] + simMatrix[column][n]) / 2;
- simMatrix[n][row] = simMatrix[row][n];
- //delete column
- simMatrix[column][n] = -1000.0;
- simMatrix[n][column] = -1000.0;
- }
- }
-
- //adjust tree to make sure root to tip length is .5
- int root = t->findRoot();
- t->tree[root].setBranchLength((0.5 - t->tree[root].getLengthToLeaves()));
- */
- //assemble tree
- t->assembleTree();
-
- if (m->control_pressed) { delete t; t = NULL; return t; }
-