]> git.donarmstrong.com Git - mothur.git/blobdiff - ace.cpp
changes while testing
[mothur.git] / ace.cpp
diff --git a/ace.cpp b/ace.cpp
index d074310ab1678ca44abbb23372ee74b41321999b..92c023f663fa11e8e2ac9bc0041a15162a1abdb1 100644 (file)
--- a/ace.cpp
+++ b/ace.cpp
 
 EstOutput Ace::getValues(SAbundVector* rank) {
        try {
-               cout << "abund = " << abund << "\n";
                data.resize(3,0);
-       //      vector<double> aceData(3,0);
                double ace, acelci, acehci;
        
-               int nrare = 0;
-               int srare = 0;
-               int sabund = 0;
+               double nrare = 0;
+               double srare = 0;
+               double sabund = 0;
        
                double Cace, term1, gamace;
-               int numsum = 0;
+               double numsum = 0;
        
                double maxRank = (double)rank->getMaxRank();
        
@@ -35,7 +33,7 @@ EstOutput Ace::getValues(SAbundVector* rank) {
                        }
                        else if(i>abund)        {sabund += rank->get(i);}
                }
-               int sobs = srare + sabund;
+               double sobs = srare + sabund;
        
                if (nrare == 0){ Cace = 0.0000; }
                else { Cace = 1.0000 -(double)rank->get(1)/(double)nrare; }
@@ -44,7 +42,7 @@ EstOutput Ace::getValues(SAbundVector* rank) {
        
                if(denom <= 0.0){       term1=0.0000;   } else {        term1 = (double)(srare * numsum)/(double)denom - 1.0;   }
                if(term1 >= 0.0){       gamace = term1; } else {        gamace = 0.0;                                                                                   }
-
+               
                if(gamace >= 0.64){
                        gamace = gamace * (1 + (nrare * (1 - Cace) * numsum) / denom);
                        if(gamace<0){                   gamace = 0;                     }
@@ -64,7 +62,8 @@ EstOutput Ace::getValues(SAbundVector* rank) {
                I have also added the forumlae to calculate the 95% confidence intervals.
                */
        
-               int j,D_s=0,nn=0,ww=0,Max_Index=rank->getMaxRank()+1;
+               double j,D_s=0,nn=0,ww=0;
+               int Max_Index=rank->getMaxRank()+1;
                double pp, temp1, temp2;
                vector<double> Part_N_Part_F(Max_Index+1,0.0);
     
@@ -142,13 +141,9 @@ EstOutput Ace::getValues(SAbundVector* rank) {
                return data;
        }
        catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the Ace class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               m->errorOut(e, "Ace", "getValues");
                exit(1);
        }
-       catch(...) {
-               cout << "An unknown error has occurred in the Ace class function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
 }
 
 /***********************************************************************/