5 * Created by Sarah Westcott on 1/8/09.
6 * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
10 #include "sharedjclass.h"
12 /***********************************************************************/
14 EstOutput SharedJclass::getValues(SharedRAbundVector* shared1, SharedRAbundVector* shared2) {
16 int S1, S2, S12, tempA, tempB;
17 S1 = 0; S2 = 0; S12 = 0; tempA = 0; tempB = 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 < shared1->size(); i++) {
25 //store in temps to avoid multiple repetitive function calls
26 tempA = shared1->getAbundance(i);
27 tempB = shared2->getAbundance(i);
33 if ((tempA != 0) && (tempB != 0)) { S12++; }
36 data[0] = S12 / (float)(S1 + S2 - S12);
38 if (isnan(data[0]) || isinf(data[0])) { data[0] = 0; }
43 cout << "Standard Error: " << e.what() << " has occurred in the SharedJclass class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
47 cout << "An unknown error has occurred in the SharedJclass class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
52 /***********************************************************************/