From: westcott Date: Wed, 5 Aug 2009 22:25:58 +0000 (+0000) Subject: bugs fixes while testing for 1.5 release X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=commitdiff_plain;h=4e3fb2fef1f40eb8224abeaed0f42c33a89b6e5e bugs fixes while testing for 1.5 release --- diff --git a/unweighted.cpp b/unweighted.cpp index 687786a..c39e662 100644 --- a/unweighted.cpp +++ b/unweighted.cpp @@ -57,8 +57,10 @@ EstOutput Unweighted::getValues(Tree* t) { //This section adds in all lengths that are non leaf copyIpcount = t->tree[i].pcount; - for (it = copyIpcount.begin(); it != copyIpcount.end(); it++) { - if (inUsersGroups(it->first, groups) != true) { copyIpcount.erase(it->first); } + for (it = copyIpcount.begin(); it != copyIpcount.end();) { + if (inUsersGroups(it->first, groups) != true) { + copyIpcount.erase(it++); + }else { it++; } } //if i's children are from the same group then i's pcount size will be 1 @@ -133,8 +135,10 @@ EstOutput Unweighted::getValues(Tree* t) { //This section adds in all lengths that are non leaf copyIpcount = t->tree[i].pcount; - for (it = copyIpcount.begin(); it != copyIpcount.end(); it++) { - if (inUsersGroups(it->first, groups) != true) { copyIpcount.erase(it->first); } + for (it = copyIpcount.begin(); it != copyIpcount.end();) { + if (inUsersGroups(it->first, groups) != true) { + copyIpcount.erase(it++); + }else { it++; } } //if i's children are from the same group then i's pcount size will be 1 @@ -240,10 +244,11 @@ EstOutput Unweighted::getValues(Tree* t, string groupA, string groupB) { /**********************************************************************/ //This section adds in all lengths that are non leaf - copyIpcount = copyTree->tree[i].pcount; - for (it = copyIpcount.begin(); it != copyIpcount.end(); it++) { - if (inUsersGroups(it->first, groups) != true) { copyIpcount.erase(it->first); } + for (it = copyIpcount.begin(); it != copyIpcount.end();) { + if (inUsersGroups(it->first, groups) != true) { + copyIpcount.erase(it++); + }else { it++; } } //if i's children are from the same group then i's pcount size will be 1 @@ -324,8 +329,10 @@ EstOutput Unweighted::getValues(Tree* t, string groupA, string groupB) { //This section adds in all lengths that are non leaf copyIpcount = copyTree->tree[i].pcount; - for (it = copyIpcount.begin(); it != copyIpcount.end(); it++) { - if (inUsersGroups(it->first, groups) != true) { copyIpcount.erase(it->first); } + for (it = copyIpcount.begin(); it != copyIpcount.end();) { + if (inUsersGroups(it->first, groups) != true) { + copyIpcount.erase(it++); + }else { it++; } } //if i's children are from the same group then i's pcount size will be 1