5 * Created by Sarah Westcott on 3/24/09.
6 * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
10 #include "sharedlennon.h"
12 /***********************************************************************/
14 EstOutput Lennon::getValues(vector<SharedRAbundVector*> shared) {
16 double S1, S2, S12, tempA, tempB, min;
17 S1 = 0; S2 = 0; S12 = 0; tempA = 0; tempB = 0; min = 0;
19 /*S1, S2 = number of OTUs observed or estimated in A and B
20 S12=number of OTUs shared between A and B */
24 for (int i = 0; i < shared[0]->getNumBins(); i++) {
25 //store in temps to avoid multiple repetitive function calls
26 tempA = shared[0]->getAbundance(i);
27 tempB = shared[1]->getAbundance(i);
29 if (tempA != 0) { S1++; }
30 if (tempB != 0) { S2++; }
33 if ((tempA != 0) && (tempB != 0)) { S12++; }
37 tempA = S1 - S12; tempB = S2 - S12;
39 if (tempA < tempB) { min = tempA; }
42 data[0] = 1.0 - S12 / (float)(S12 + min);
44 if (isnan(data[0]) || isinf(data[0])) { data[0] = 0; }
49 m->errorOut(e, "Lennon", "getValues");
54 /***********************************************************************/