]> git.donarmstrong.com Git - mothur.git/blob - bergerparker.cpp
added the Calculators Thomas made in the fall. Added parameter and command error...
[mothur.git] / bergerparker.cpp
1 /*
2  *  ssbp.cpp
3  *  Mothur
4  *
5  *  Created by Thomas Ryabin on 3/6/09.
6  *  Copyright 2009 __MyCompanyName__. All rights reserved.
7  *
8  */
9
10 #include "bergerparker.h"
11 #include "calculator.h"
12
13 /***************************************************************/
14
15 EstOutput BergerParker::getValues(SAbundVector* rank){
16         try {
17                 data.resize(1,0);
18                 //Berger-Parker index
19                 double BP = (double)rank->getNumSeqs()/(double)rank->getMaxRank();
20                 //cout << "BP index = " << 1/BP << "\n\n";
21                 
22                 data[0] = BP;
23                 if (isnan(data[0]) || isinf(data[0])) { data[0] = 0; }
24
25                 return data;
26         }
27         catch(exception& e) {
28                 cout << "Standard Error: " << e.what() << " has occurred in the NPShannon class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
29                 exit(1);
30         }
31         catch(...) {
32                 cout << "An unknown error has occurred in the NPShannon class function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
33                 exit(1);
34         }       
35 }
36
37 /***********************************************************************/
38