X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=qstat.cpp;h=e07cdb3fb860b96a17ba2972474f0abb8bf05d7e;hp=cac06be7289d3a96913bd65abbc2b94e0c798f41;hb=1a20e24ee786195ab0e1cccd4f5aede7a88f3f4e;hpb=c5c7502f435e1413c19e373dab1dfebcaa67588d diff --git a/qstat.cpp b/qstat.cpp index cac06be..e07cdb3 100644 --- a/qstat.cpp +++ b/qstat.cpp @@ -3,7 +3,7 @@ * Mothur * * Created by Thomas Ryabin on 3/4/09. - * Copyright 2009 __MyCompanyName__. All rights reserved. + * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved. * */ @@ -31,22 +31,19 @@ EstOutput QStat::getValues(SAbundVector* rank){ int r3 = -1; int r1Ind = 0; int r3Ind = 0; - int sumSpec = 0; - int iqSum = 0; - for(int i = 1; i < rank->size(); i++) - { + double sumSpec = 0; + double iqSum = 0; + for(int i = 1; i < rank->size(); i++) { if(r1 != -1 && r3 != -1) i = rank->size(); sumSpec += rank->get(i); - if(r1 == -1 && sumSpec >= numSpec*.25) - { + if(r1 == -1 && sumSpec >= numSpec*.25) { r1 = rank->get(i); r1Ind = i; } - else if(r3 == -1 && sumSpec >= numSpec*.75) - { + else if(r3 == -1 && sumSpec >= numSpec*.75) { r3 = rank->get(i); r3Ind = i; } @@ -55,7 +52,6 @@ EstOutput QStat::getValues(SAbundVector* rank){ } double qstat = (.5*r1 + iqSum + .5*r3)/log((double)r3Ind/r1Ind); - //cout << "QStat:\nQStatistic = " << qstat << "\n\n"; data[0] = qstat; if (isnan(data[0]) || isinf(data[0])) { data[0] = 0; } @@ -63,13 +59,9 @@ EstOutput QStat::getValues(SAbundVector* rank){ return data; } catch(exception& e) { - cout << "Standard Error: " << e.what() << " has occurred in the NPShannon class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + m->errorOut(e, "QStat", "getValues"); exit(1); } - catch(...) { - cout << "An unknown error has occurred in the NPShannon class function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; - exit(1); - } } /***********************************************************************/