]> git.donarmstrong.com Git - mothur.git/blobdiff - bergerparker.cpp
added the Calculators Thomas made in the fall. Added parameter and command error...
[mothur.git] / bergerparker.cpp
diff --git a/bergerparker.cpp b/bergerparker.cpp
new file mode 100644 (file)
index 0000000..c8c25ea
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ *  ssbp.cpp
+ *  Mothur
+ *
+ *  Created by Thomas Ryabin on 3/6/09.
+ *  Copyright 2009 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#include "bergerparker.h"
+#include "calculator.h"
+
+/***************************************************************/
+
+EstOutput BergerParker::getValues(SAbundVector* rank){
+       try {
+               data.resize(1,0);
+               //Berger-Parker index
+               double BP = (double)rank->getNumSeqs()/(double)rank->getMaxRank();
+               //cout << "BP index = " << 1/BP << "\n\n";
+               
+               data[0] = BP;
+               if (isnan(data[0]) || isinf(data[0])) { data[0] = 0; }
+
+               return data;
+       }
+       catch(exception& e) {
+               cout << "Standard Error: " << e.what() << " has occurred in the NPShannon class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }
+       catch(...) {
+               cout << "An unknown error has occurred in the NPShannon class function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }       
+}
+
+/***********************************************************************/
+