]> git.donarmstrong.com Git - mothur.git/blob - odum.cpp
added modify names parameter to set.dir
[mothur.git] / odum.cpp
1 /*
2  *  odum.cpp
3  *  Mothur
4  *
5  *  Created by westcott on 12/14/10.
6  *  Copyright 2010 Schloss Lab. All rights reserved.
7  *
8  */
9
10 #include "odum.h"
11
12 /***********************************************************************/
13
14 EstOutput Odum::getValues(vector<SharedRAbundVector*> shared) {
15         try {
16                 data.resize(1,0);
17                 
18                 double sumNum = 0.0;
19                 double sumDenom = 0.0;
20                 
21                 for (int i = 0; i < shared[0]->getNumBins(); i++) { 
22                         
23                         int Aij = shared[0]->getAbundance(i);
24                         int Bij = shared[1]->getAbundance(i);
25                         
26                         sumNum += abs(Aij - Bij);
27                         sumDenom += (Aij + Bij);
28                 }
29                 
30                 data[0] = sumNum / sumDenom;
31                 
32                 if (isnan(data[0]) || isinf(data[0])) { data[0] = 0; }
33                 
34                 return data;
35         }
36         catch(exception& e) {
37                 m->errorOut(e, "Odum", "getValues");
38                 exit(1);
39         }
40 }
41
42 /***********************************************************************/