]> git.donarmstrong.com Git - mothur.git/blob - soergel.cpp
changed random forest output filename
[mothur.git] / soergel.cpp
1 /*
2  *  soergel.cpp
3  *  Mothur
4  *
5  *  Created by westcott on 12/15/10.
6  *  Copyright 2010 Schloss Lab. All rights reserved.
7  *
8  */
9
10 #include "soergel.h"
11
12 /***********************************************************************/
13 EstOutput Soergel::getValues(vector<SharedRAbundVector*> shared) {
14         try {
15                 data.resize(1,0);
16                 
17                 double sumNum = 0.0;
18                 double sumMax = 0.0;
19                 
20                 //calc the 2 denominators
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                         sumMax += max(Aij, Bij);
28                 }
29                 
30                 data[0] = sumNum / sumMax;
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, "Soergel", "getValues");
38                 exit(1);
39         }
40 }
41 /***********************************************************************/
42