5 * Created by Sarah Westcott on 1/8/09.
6 * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
10 #include "sharedthetayc.h"
12 /***********************************************************************/
13 EstOutput ThetaYC::getValues(vector<SharedRAbundVector*> shared) {
25 //get the total values we need to calculate the theta denominator sums
26 for (int i = 0; i < shared[0]->size(); i++) {
27 //store in temps to avoid multiple repetitive function calls
28 Atotal += shared[0]->getAbundance(i);
29 Btotal += shared[1]->getAbundance(i);
32 //calculate the theta denominator sums
33 for (int j = 0; j < shared[0]->size(); j++) {
34 //store in temps to avoid multiple repetitive function calls
35 relA = shared[0]->getAbundance(j) / (float)Atotal;
36 relB = shared[1]->getAbundance(j) / (float)Btotal;
39 b += pow((relA-relB),2);
42 thetaYC = a / (float) (b+a);
44 if (isnan(thetaYC) || isinf(thetaYC)) { thetaYC = 0; }
51 errorOut(e, "ThetaYC", "getValues");
56 /***********************************************************************/