X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=weighted.cpp;h=a0d593c803f691821afdb680e79be80f179b0afa;hb=5334a314651228c55fd0f206dec0209bc3148b24;hp=1ce6230df933eab46bee132a76ec32c2c4e9a666;hpb=c53ef46b40b97c00e32bfd8c3924ce8c51b5cd7b;p=mothur.git diff --git a/weighted.cpp b/weighted.cpp index 1ce6230..a0d593c 100644 --- a/weighted.cpp +++ b/weighted.cpp @@ -73,7 +73,6 @@ EstOutput Weighted::createProcesses(Tree* t, vector< vector > namesOfGro try { #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) int process = 1; - int num = 0; vector processIDS; EstOutput results; @@ -204,9 +203,7 @@ EstOutput Weighted::driver(Tree* t, vector< vector > namesOfGroupCombos, for (int h = start; h < (start+num); h++) { //report progress m->mothurOut("Processing combo: " + toString(h)); m->mothurOutEndLine(); - - int numLeaves = t->getNumLeaves(); - + string groupA = namesOfGroupCombos[h][0]; string groupB = namesOfGroupCombos[h][1]; @@ -234,10 +231,13 @@ EstOutput Weighted::driver(Tree* t, vector< vector > namesOfGroupCombos, //if this is not the root then add it if (rootForGrouping[namesOfGroupCombos[h]].count(i) == 0) { - u = abs(u * t->tree[i].getBranchLength()); - WScore[(groupA+groupB)] += u; + if (t->tree[i].getBranchLength() != -1) { + u = abs(u * t->tree[i].getBranchLength()); + WScore[(groupA+groupB)] += u; + } } + } } @@ -247,7 +247,6 @@ EstOutput Weighted::driver(Tree* t, vector< vector > namesOfGroupCombos, count = 0; for (int h = start; h < (start+num); h++) { UN = (WScore[namesOfGroupCombos[h][0]+namesOfGroupCombos[h][1]] / D[count]); - if (isnan(UN) || isinf(UN)) { UN = 0; } results.push_back(UN); count++; @@ -297,9 +296,7 @@ EstOutput Weighted::getValues(Tree* t, string groupA, string groupB) { D += weightedSum; } - - int numLeaves = t->getNumLeaves(); - + //calculate u for the group comb for(int i=0;igetNumNodes();i++){ @@ -324,12 +321,14 @@ EstOutput Weighted::getValues(Tree* t, string groupA, string groupB) { //if this is not the root then add it if (rootForGrouping[groups].count(i) == 0) { - u = abs(u * t->tree[i].getBranchLength()); - WScore[(groupA+groupB)] += u; + if (t->tree[i].getBranchLength() != -1) { + u = abs(u * t->tree[i].getBranchLength()); + WScore[(groupA+groupB)] += u; + } } } /********************************************************/ - + //calculate weighted score for the group combination double UN; UN = (WScore[(groupA+groupB)] / D);