]> git.donarmstrong.com Git - mothur.git/blob - shen.cpp
fixed Thomas' calculators
[mothur.git] / shen.cpp
1 /*
2  *  shen.cpp
3  *  Mothur
4  *
5  *  Created by Thomas Ryabin on 5/18/09.
6  *  Copyright 2009Schloss Lab UMASS Amherst. All rights reserved.
7  *
8  */
9
10 #include "shen.h"
11 #include "ace.h"
12
13         
14 /***********************************************************************/       
15 EstOutput Shen::getValues(SAbundVector* rank){
16
17         try {
18                 globaldata = GlobalData::getInstance();
19                 
20                 data.resize(1,0);
21                 
22                 double n = (double)rank->getNumSeqs();
23                 double f1 = (double)rank->get(1);
24                 
25                 int abund;
26                 convert(globaldata->getAbund(), abund);
27                 
28                 Ace* calc = new Ace(abund);
29                 EstOutput ace = calc->getValues(rank);
30                 
31                 double f0 = n - ace[0];
32                 
33                 data[0] = f0 * (1 - pow(1 - f1/n/f0, m));
34
35                 return data;
36         }
37         catch(exception& e) {
38                 cout << "Standard Error: " << e.what() << " has occurred in the Coverage class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
39                 exit(1);
40         }
41         catch(...) {
42                 cout << "An unknown error has occurred in the Coverage class function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
43                 exit(1);
44         }       
45 };
46
47
48 /***********************************************************************/