From: westcott Date: Wed, 23 Feb 2011 21:56:08 +0000 (+0000) Subject: fixed bug in unifrac commands with nexus translation if files don't match X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=commitdiff_plain;h=f40e9e38c5604fdbe90f964fc26eca7758e6257f fixed bug in unifrac commands with nexus translation if files don't match --- diff --git a/unweighted.cpp b/unweighted.cpp index 312d549..d0eea3d 100644 --- a/unweighted.cpp +++ b/unweighted.cpp @@ -168,7 +168,8 @@ EstOutput Unweighted::createProcesses(Tree* t, vector< vector > namesOfG /**************************************************************************************************/ EstOutput Unweighted::driver(Tree* t, vector< vector > namesOfGroupCombos, int start, int num) { try { - + + EstOutput results; results.resize(num); int count = 0; @@ -178,7 +179,7 @@ EstOutput Unweighted::driver(Tree* t, vector< vector > namesOfGroupCombo for (int h = start; h < (start+num); h++) { - //cout << namesOfGroupCombos[h][0] << '\t' << namesOfGroupCombos[h][1] << endl; + if (m->control_pressed) { return results; } double UniqueBL=0.0000; //a branch length is unique if it's chidren are from the same group @@ -214,7 +215,7 @@ EstOutput Unweighted::driver(Tree* t, vector< vector > namesOfGroupCombo map::iterator itGroup = t->tree[i].pcount.find(namesOfGroupCombos[h][j]); if (itGroup != t->tree[i].pcount.end()) { pcountSize++; if (pcountSize > 1) { break; } } } - // + //unique calc if (pcountSize == 0) { } else if ((t->tree[i].getBranchLength() != -1) && (pcountSize == 1) && (rootForGrouping[namesOfGroupCombos[h]].count(i) == 0)) { //you have a unique branch length and you are not the root @@ -228,7 +229,7 @@ EstOutput Unweighted::driver(Tree* t, vector< vector > namesOfGroupCombo } } - cout << UniqueBL << '\t' << totalBL << endl; + //cout << UniqueBL << '\t' << totalBL << endl; UW = (UniqueBL / totalBL); if (isnan(UW) || isinf(UW)) { UW = 0; } @@ -238,11 +239,11 @@ EstOutput Unweighted::driver(Tree* t, vector< vector > namesOfGroupCombo count++; //report progress - if((count % twentyPercent) == 0) { float tempOut = (count / (float)total); if (isnan(tempOut) || isinf(tempOut)) { tempOut = 0.0; } m->mothurOut("Percentage complete: " + toString((int(tempOut) * 100.0))); m->mothurOutEndLine(); } + //if((count % twentyPercent) == 0) { float tempOut = (count / (float)total); if (isnan(tempOut) || isinf(tempOut)) { tempOut = 0.0; } m->mothurOut("Percentage complete: " + toString((int(tempOut) * 100.0))); m->mothurOutEndLine(); } } //report progress - if((count % twentyPercent) != 0) { float tempOut = (count / (float)total); if (isnan(tempOut) || isinf(tempOut)) { tempOut = 0.0; } m->mothurOut("Percentage complete: " + toString((int(tempOut) * 100.0))); m->mothurOutEndLine(); } + //if((count % twentyPercent) != 0) { float tempOut = (count / (float)total); if (isnan(tempOut) || isinf(tempOut)) { tempOut = 0.0; } m->mothurOut("Percentage complete: " + toString((int(tempOut) * 100.0))); m->mothurOutEndLine(); } return results; } @@ -536,7 +537,7 @@ int Unweighted::getRoot(Tree* t, int v, vector grouping) { while(t->tree[index].getParent() != -1){ int parent = t->tree[index].getParent(); rootForGrouping[grouping].insert(parent); - cout << parent << " in root" << endl; + //cout << parent << " in root" << endl; index = parent; }