//if i's chidren are leaves
if (t->tree[rc].getRChild() == -1) {
//if rc is a valid group and rc has a BL
- if ((inUsersGroups(t->tree[rc].getGroup(), globaldata->Groups) == true) && (t->tree[rc].getBranchLength() != -1)) {
+ if ((inUsersGroups(t->tree[rc].getGroup(), groups) == true) && (t->tree[rc].getBranchLength() != -1)) {
UniqueBL += t->tree[rc].getBranchLength();
totalBL += t->tree[rc].getBranchLength();
}
if (t->tree[lc].getLChild() == -1) {
//if lc is a valid group and lc has a BL
- if ((inUsersGroups(t->tree[lc].getGroup(), globaldata->Groups) == true) && (t->tree[lc].getBranchLength() != -1)) {
+ if ((inUsersGroups(t->tree[lc].getGroup(), groups) == true) && (t->tree[lc].getBranchLength() != -1)) {
UniqueBL += t->tree[lc].getBranchLength();
totalBL += t->tree[lc].getBranchLength();
}
//if i's chidren are leaves
if (t->tree[rc].getRChild() == -1) {
//if rc is a valid group and rc has a BL
- if ((inUsersGroups(t->tree[rc].getGroup(), globaldata->Groups) == true) && (t->tree[rc].getBranchLength() != -1)) {
+ if ((inUsersGroups(t->tree[rc].getGroup(), groups) == true) && (t->tree[rc].getBranchLength() != -1)) {
UniqueBL += t->tree[rc].getBranchLength();
totalBL += t->tree[rc].getBranchLength();
}
if (t->tree[lc].getLChild() == -1) {
//if lc is a valid group and lc has a BL
- if ((inUsersGroups(t->tree[lc].getGroup(), globaldata->Groups) == true) && (t->tree[lc].getBranchLength() != -1)) {
+ if ((inUsersGroups(t->tree[lc].getGroup(), groups) == true) && (t->tree[lc].getBranchLength() != -1)) {
UniqueBL += t->tree[lc].getBranchLength();
totalBL += t->tree[lc].getBranchLength();
}
//if the users enters no groups then give them the score of all groups
int numGroups = globaldata->Groups.size();
-
+cout << "NumGroups = " << numGroups << endl;
//calculate number of comparsions
int numComp = 0;
for (int r=0; r<numGroups; r++) {
//copy random tree passed in
copyTree->getCopy(t);
-
- //swap labels in the groups you want to compare
- copyTree->assembleRandomUnifracTree(globaldata->Groups[a], globaldata->Groups[l]);
-
+
//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]);
+
for(int i=t->getNumLeaves();i<t->getNumNodes();i++){
//if i's chidren are leaves
if (t->tree[rc].getRChild() == -1) {
//if rc is a valid group and rc has a BL
- if ((inUsersGroups(t->tree[rc].getGroup(), globaldata->Groups) == true) && (t->tree[rc].getBranchLength() != -1)) {
+ if ((inUsersGroups(t->tree[rc].getGroup(), groups) == true) && (t->tree[rc].getBranchLength() != -1)) {
UniqueBL += t->tree[rc].getBranchLength();
totalBL += t->tree[rc].getBranchLength();
}
if (t->tree[lc].getLChild() == -1) {
//if lc is a valid group and lc has a BL
- if ((inUsersGroups(t->tree[lc].getGroup(), globaldata->Groups) == true) && (t->tree[lc].getBranchLength() != -1)) {
+ if ((inUsersGroups(t->tree[lc].getGroup(), groups) == true) && (t->tree[lc].getBranchLength() != -1)) {
UniqueBL += t->tree[lc].getBranchLength();
totalBL += t->tree[lc].getBranchLength();
}
copyTree->getCopy(t);
//swap labels in all the groups you want to compare
- copyTree->assembleRandomUnifracTree();
+ copyTree->assembleRandomUnifracTree(groups);
for(int i=t->getNumLeaves();i<t->getNumNodes();i++){
//if i's chidren are leaves
if (t->tree[rc].getRChild() == -1) {
//if rc is a valid group and rc has a BL
- if ((inUsersGroups(t->tree[rc].getGroup(), globaldata->Groups) == true) && (t->tree[rc].getBranchLength() != -1)) {
+ if ((inUsersGroups(t->tree[rc].getGroup(), groups) == true) && (t->tree[rc].getBranchLength() != -1)) {
UniqueBL += t->tree[rc].getBranchLength();
totalBL += t->tree[rc].getBranchLength();
}
if (t->tree[lc].getLChild() == -1) {
//if lc is a valid group and lc has a BL
- if ((inUsersGroups(t->tree[lc].getGroup(), globaldata->Groups) == true) && (t->tree[lc].getBranchLength() != -1)) {
+ if ((inUsersGroups(t->tree[lc].getGroup(), groups) == true) && (t->tree[lc].getBranchLength() != -1)) {
UniqueBL += t->tree[lc].getBranchLength();
totalBL += t->tree[lc].getBranchLength();
}