]> git.donarmstrong.com Git - mothur.git/blobdiff - sharedbraycurtis.cpp
added otu.association command. added calcSpearman, calcKendall and calcPearson functi...
[mothur.git] / sharedbraycurtis.cpp
index 9a63cdf9c0a3cbf37fd2ef179ef5bd8ff3229bc7..0182e13bd34ea9164383b5f83c221ae705898677 100644 (file)
@@ -15,7 +15,7 @@ EstOutput BrayCurtis::getValues(vector<SharedRAbundVector*> shared) {
        try {   
                data.resize(1,0);
                
-               int sumSharedA, sumSharedB, sumSharedAB, tempA, tempB;
+               double sumSharedA, sumSharedB, sumSharedAB, tempA, tempB;
                sumSharedA = 0; sumSharedB = 0; sumSharedAB = 0; 
                
                /*Xi, Yi = abundance of the ith shared OTU in A and B 
@@ -37,22 +37,16 @@ EstOutput BrayCurtis::getValues(vector<SharedRAbundVector*> shared) {
                        else  { sumSharedAB += tempB; }                         
                }
                
-               data[0] = (2 * sumSharedAB) / (float)( sumSharedA + sumSharedB);
+               data[0] = 1.0 - (2 * sumSharedAB) / (float)( sumSharedA + sumSharedB);
                
                if (isnan(data[0]) || isinf(data[0])) { data[0] = 0; }
                                
                return data;
        }
        catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the BrayCurtis class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               m->errorOut(e, "BrayCurtis", "getValues");
                exit(1);
        }
-       catch(...) {
-               cout << "An unknown error has occurred in the BrayCurtis class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }       
-
-
 }
 
 /***********************************************************************/