]> git.donarmstrong.com Git - mothur.git/blob - whittaker.cpp
working on pam
[mothur.git] / whittaker.cpp
1 /*
2  *  whittaker.cpp
3  *  Mothur
4  *
5  *  Created by Pat Schloss on 4/23/09.
6  *  Copyright 2009 Patrick D. Schloss. All rights reserved.
7  *
8  */
9
10 #include "whittaker.h"
11
12 /***********************************************************************/
13
14 EstOutput Whittaker::getValues(vector<SharedRAbundVector*> shared){
15         try{
16                 data.resize(1);
17
18                 int countA = 0;
19                 int countB = 0;
20                 int sTotal = shared[0]->getNumBins();
21                 for(int i=0;i<sTotal;i++){
22                         if(shared[0]->getAbundance(i) != 0){    countA++;       }
23                         if(shared[1]->getAbundance(i) != 0){    countB++;       }               
24                 }
25                 
26                 data[0] = 2-2*sTotal/(float)(countA+countB);
27                 return data;
28         }
29         catch(exception& e) {
30                 m->errorOut(e, "Whittaker", "getValues");
31                 exit(1);
32         }
33 }
34
35 /***********************************************************************/