]> git.donarmstrong.com Git - mothur.git/commitdiff
fixed Thomas' calculators
authorwestcott <westcott>
Thu, 21 May 2009 14:13:47 +0000 (14:13 +0000)
committerwestcott <westcott>
Thu, 21 May 2009 14:13:47 +0000 (14:13 +0000)
Mothur.xcodeproj/project.pbxproj
boneh.cpp
shen.cpp
shen.h

index 8136cc2c71aabdc3299b84edf22545ab0d095a00..c49b637db8a6e8d44298f741ff23f3794d95d2c4 100644 (file)
                        isa = PBXGroup;
                        children = (
                                37D927BE0F21331F001D4494 /* calculator.h */,
-                               373C69950FC1E63600137ACD /* boneh.h */,
-                               373C69940FC1E63600137ACD /* boneh.cpp */,
-                               3792948D0F2E271100B9034A /* treecalculator.h */,
                                37D927BD0F21331F001D4494 /* calculator.cpp */,
+                               3792948D0F2E271100B9034A /* treecalculator.h */,
                                37D927B90F21331F001D4494 /* ace.h */,
                                37D927B80F21331F001D4494 /* ace.cpp */,
                                EB1216860F619B83004A865F /* bergerparker.h */,
                                EB1216870F619B83004A865F /* bergerparker.cpp */,
+                               373C69950FC1E63600137ACD /* boneh.h */,
+                               373C69940FC1E63600137ACD /* boneh.cpp */,
                                37D927BC0F21331F001D4494 /* bootstrap.h */,
                                37D927BB0F21331F001D4494 /* bootstrap.cpp */,
                                EB1216E30F61ACFB004A865F /* bstick.h */,
index 7117e356928cd11db90b260f9496a3f21db3048f..2025ae70d10311c6184ee723097be4e67b22b318 100644 (file)
--- a/boneh.cpp
+++ b/boneh.cpp
@@ -70,10 +70,9 @@ EstOutput Boneh::getValues(SAbundVector* rank){
                        
                        sum = 0;
                        for(int j = 1; j < rank->size(); j++) {
-                               double Xi = 0; //I didn't know what this was, simply replace the 0
-                                                          //with the appropriate expression for the boneh calculator
-                                                          //to work.
-                               sum += pow(1 - Xi / n, n) * (1 - pow(1 - Xi / n, m)) + v * pow(1 - f1/(n*v), n) * (1 - pow(1 - f1/(n*v), m));
+                               for (int i = 0; i < rank->get(j); i++) {
+                                       sum += pow(1 - j / n, n) * (1 - pow(1 - j / n, m)) + v * pow(1 - f1/(n*v), n) * (1 - pow(1 - f1/(n*v), m));
+                               }
                        }
                }
 
index c8368c641135e3676e687c708cc1dd616e1298b4..61291a62554a3ccfb0a1b35bd761fb5bfcf1e881 100644 (file)
--- a/shen.cpp
+++ b/shen.cpp
@@ -8,23 +8,27 @@
  */
 
 #include "shen.h"
-#include <math.h>
+#include "ace.h"
 
        
 /***********************************************************************/      
 EstOutput Shen::getValues(SAbundVector* rank){
 
        try {
+               globaldata = GlobalData::getInstance();
+               
                data.resize(1,0);
                
                double n = (double)rank->getNumSeqs();
                double f1 = (double)rank->get(1);
                
-               double D_rare = 0; //I didn't know what this was. Simply replace the '0' with the appropriate expression.
-               double C_rare = 1; //I didn't know what this was. Simply replace the '1' with the appropriate expression.
-               double Y_rare = 1; //I didn't know what this was. Simply replace the '1' with the appropriate expression.
+               int abund;
+               convert(globaldata->getAbund(), abund);
+               
+               Ace* calc = new Ace(abund);
+               EstOutput ace = calc->getValues(rank);
                
-               double f0 = D_rare/C_rare + f1/C_rare * Y_rare*Y_rare - D_rare;
+               double f0 = n - ace[0];
                
                data[0] = f0 * (1 - pow(1 - f1/n/f0, m));
 
diff --git a/shen.h b/shen.h
index d9a080a1f63cbeccd6f6f15e99bdcbeeb9b56211..a96abe9ba3d3222680fd5e99470a95ca6d4d472c 100644 (file)
--- a/shen.h
+++ b/shen.h
@@ -11,6 +11,7 @@
  */
 
 #include "calculator.h"
+#include "globaldata.hpp"
 
 /* This class implements the shen calculator on single group. 
  It is a child of the calculator class. */
@@ -25,6 +26,7 @@ public:
        EstOutput getValues(vector<SharedRAbundVector*>) {return data;};
 private:
        int m;
+       GlobalData* globaldata;
 };