]> git.donarmstrong.com Git - mothur.git/blob - shen.cpp
added shen calculator
[mothur.git] / shen.cpp
1 /*
2  *  shen.cpp
3  *  Mothur
4  *
5  *  Created by Thomas Ryabin on 5/18/09.
6  *  Copyright 2009 __MyCompanyName__. All rights reserved.
7  *
8  */
9
10 #include "shen.h"
11 #include <math.h>
12
13         
14 /***********************************************************************/       
15 EstOutput Shen::getValues(SAbundVector* rank){
16
17         try {
18                 data.resize(1,0);
19                 
20                 double n = (double)rank->getNumSeqs();
21                 double f1 = (double)rank->get(1);
22                 
23                 double D_rare = 0; //I didn't know what this was. Simply replace the '0' with the appropriate expression.
24                 double C_rare = 1; //I didn't know what this was. Simply replace the '1' with the appropriate expression.
25                 double Y_rare = 1; //I didn't know what this was. Simply replace the '1' with the appropriate expression.
26                 
27                 double f0 = D_rare/C_rare + f1/C_rare * Y_rare*Y_rare - D_rare;
28                 
29                 data[0] = f0 * (1 - pow(1 - f1/n/f0, m));
30
31                 return data;
32         }
33         catch(exception& e) {
34                 cout << "Standard Error: " << e.what() << " has occurred in the Coverage class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
35                 exit(1);
36         }
37         catch(...) {
38                 cout << "An unknown error has occurred in the Coverage class function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
39                 exit(1);
40         }       
41 };
42
43
44 /***********************************************************************/