]> git.donarmstrong.com Git - mothur.git/blob - bergerparker.cpp
started shared utilities, updates to venn and heatmap added tree.groups command
[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
12 /***************************************************************/
13
14 EstOutput BergerParker::getValues(SAbundVector* rank){
15         try {
16                 data.resize(1,0);
17                 //Berger-Parker index
18                 double BP = (double)rank->getNumSeqs()/(double)rank->getMaxRank();
19                 //cout << "BP index = " << 1/BP << "\n\n";
20                 
21                 data[0] = BP;
22                 if (isnan(data[0]) || isinf(data[0])) { data[0] = 0; }
23
24                 return data;
25         }
26         catch(exception& e) {
27                 cout << "Standard Error: " << e.what() << " has occurred in the NPShannon class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
28                 exit(1);
29         }
30         catch(...) {
31                 cout << "An unknown error has occurred in the NPShannon class function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
32                 exit(1);
33         }       
34 }
35
36 /***********************************************************************/
37