X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=sharedkulczynskicody.cpp;h=8c8b7f7f4e181760b5bc9c7adb8117ab535b5c3d;hp=3de7e76b322a5496806e8e82e6bef12028290acb;hb=b206f634aae1b4ce13978d203247fb64757d5482;hpb=25cde7ff05bbe741da1712f2c740e0bc8706e523 diff --git a/sharedkulczynskicody.cpp b/sharedkulczynskicody.cpp index 3de7e76..8c8b7f7 100644 --- a/sharedkulczynskicody.cpp +++ b/sharedkulczynskicody.cpp @@ -11,9 +11,9 @@ /***********************************************************************/ -EstOutput SharedKulczynskiCody::getValues(SharedRAbundVector* shared1, SharedRAbundVector* shared2) { +EstOutput KulczynskiCody::getValues(vector shared) { try { - int S1, S2, S12, tempA, tempB; + double S1, S2, S12, tempA, tempB; S1 = 0; S2 = 0; S12 = 0; tempA = 0; tempB = 0; /*S1, S2 = number of OTUs observed or estimated in A and B @@ -21,10 +21,10 @@ EstOutput SharedKulczynskiCody::getValues(SharedRAbundVector* shared1, SharedRAb data.resize(1,0); - for (int i = 0; i < shared1->size(); i++) { + for (int i = 0; i < shared[0]->getNumBins(); i++) { //store in temps to avoid multiple repetitive function calls - tempA = shared1->getAbundance(i); - tempB = shared2->getAbundance(i); + tempA = shared[0]->getAbundance(i); + tempB = shared[1]->getAbundance(i); if (tempA != 0) { S1++; } if (tempB != 0) { S2++; } @@ -33,20 +33,16 @@ EstOutput SharedKulczynskiCody::getValues(SharedRAbundVector* shared1, SharedRAb if ((tempA != 0) && (tempB != 0)) { S12++; } } - data[0] = 0.5 * ((S12 / (float)S1) + (S12 / (float)S2)); + data[0] = 1.0 - 0.5 * ((S12 / (float)S1) + (S12 / (float)S2)); if (isnan(data[0]) || isinf(data[0])) { data[0] = 0; } return data; } catch(exception& e) { - cout << "Standard Error: " << e.what() << " has occurred in the SharedKulczynskiCody class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + m->errorOut(e, "KulczynskiCody", "getValues"); exit(1); } - catch(...) { - cout << "An unknown error has occurred in the SharedKulczynskiCody class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; - exit(1); - } } /***********************************************************************/