5 * Created by westcott on 12/17/10.
6 * Copyright 2010 Schloss Lab. All rights reserved.
12 /***********************************************************************/
13 EstOutput Gower::getValues(vector<SharedRAbundVector*> shared) {
17 vector<int> maxOtus; maxOtus.resize(shared[0]->getNumBins());
18 vector<int> minOtus; minOtus.resize(shared[0]->getNumBins());
20 for (int i = 0; i < shared[0]->getNumBins(); i++) {
22 //set otus min and max to first one
23 minOtus[i] = shared[0]->getAbundance(i);
24 maxOtus[i] = shared[0]->getAbundance(i);
27 for (int j = 1; j < shared.size(); j++) {
28 maxOtus[i] = max(shared[j]->getAbundance(i), maxOtus[i]);
29 minOtus[i] = min(shared[j]->getAbundance(i), minOtus[i]);
34 for (int i = 0; i < shared[0]->getNumBins(); i++) {
35 int A = shared[0]->getAbundance(i);
36 int B = shared[1]->getAbundance(i);
38 double numerator = abs(A - B);
39 double denominator = maxOtus[i] - minOtus[i];
41 if (denominator != 0) { sum += (numerator / denominator); }
46 if (isnan(data[0]) || isinf(data[0])) { data[0] = 0; }
51 m->errorOut(e, "Gower", "getValues");
55 /***********************************************************************/