X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=sharedthetayc.cpp;h=864c6e63712cdc78d2cc0320ff2869c6deff196f;hp=ed18d9252ed52ef126355336f04bd04b67b0d7c3;hb=b206f634aae1b4ce13978d203247fb64757d5482;hpb=f099fdc1e3a0d7b75d780a164e5bdb93496a7a1d diff --git a/sharedthetayc.cpp b/sharedthetayc.cpp index ed18d92..864c6e6 100644 --- a/sharedthetayc.cpp +++ b/sharedthetayc.cpp @@ -29,14 +29,14 @@ EstOutput ThetaYC::getValues(vector shared) { double sumPsqQ = 0; //get the total values we need to calculate the theta denominator sums - for (int i = 0; i < shared[0]->size(); i++) { + for (int i = 0; i < shared[0]->getNumBins(); i++) { //store in temps to avoid multiple repetitive function calls Atotal += (double)shared[0]->getAbundance(i); Btotal += (double)shared[1]->getAbundance(i); } //calculate the theta denominator sums - for (int j = 0; j < shared[0]->size(); j++) { + for (int j = 0; j < shared[0]->getNumBins(); j++) { //store in temps to avoid multiple repetitive function calls pi = shared[0]->getAbundance(j) / Atotal; qi = shared[1]->getAbundance(j) / Btotal; @@ -74,6 +74,11 @@ EstOutput ThetaYC::getValues(vector shared) { if (isnan(data[1]) || isinf(data[1])) { data[1] = 0; } if (isnan(data[2]) || isinf(data[2])) { data[2] = 0; } + data[0] = 1.0 - data[0]; + double hold = data[1]; + data[1] = 1.0 - data[2]; + data[2] = 1.0 - hold; + return data; } catch(exception& e) {