X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=unweighted.cpp;h=4416e79afd680059b8958cab6c28e035b3633d1c;hb=b2dca66a02f8f82aa5528e531eace60fbbd2967b;hp=a7cf9c9092e6b8565f538d38b2f86ae4a75b5944;hpb=d037597badc8d18e235c59f0c1114180edb7f98f;p=mothur.git diff --git a/unweighted.cpp b/unweighted.cpp index a7cf9c9..4416e79 100644 --- a/unweighted.cpp +++ b/unweighted.cpp @@ -13,7 +13,8 @@ EstOutput Unweighted::getValues(Tree* t) { try { - + globaldata = GlobalData::getInstance(); + //clear out old values data.resize(1,0); penalty.resize(t->getNumLeaves(), 0); @@ -60,7 +61,7 @@ EstOutput Unweighted::getValues(Tree* t) { map::iterator pos; for(pos=unique.begin();pos!=unique.end();pos++){ - if(pos->first!="xxx"){ + if((pos->first!="xxx") && (inUsersGroups(pos->first))){ UW += unique[pos->first]; } } @@ -85,4 +86,20 @@ EstOutput Unweighted::getValues(Tree* t) { } -/**************************************************************************************************/ \ No newline at end of file +/**************************************************************************************************/ +bool Unweighted::inUsersGroups(string groupname) { + try { + for (int i = 0; i < globaldata->Groups.size(); i++) { + if (groupname == globaldata->Groups[i]) { return true; } + } + return false; + } + catch(exception& e) { + cout << "Standard Error: " << e.what() << " has occurred in the Unweighted class Function inUsersGroups. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } + catch(...) { + cout << "An unknown error has occurred in the Unweighted class function inUsersGroups. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } +} \ No newline at end of file