]> git.donarmstrong.com Git - mothur.git/blob - whittaker.cpp
This is v.1.4.0
[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*sTotal/(float)(countA+countB)-1;
27                 return data;
28         }
29         catch(exception& e) {
30                 cout << "Standard Error: " << e.what() << " has occurred in the Whittaker class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
31                 exit(1);
32         }
33         catch(...) {
34                 cout << "An unknown error has occurred in the Whittaker class function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
35                 exit(1);
36         }       
37 }
38
39 /***********************************************************************/