]> git.donarmstrong.com Git - mothur.git/blobdiff - sharedbraycurtis.cpp
added otu.association command. added calcSpearman, calcKendall and calcPearson functi...
[mothur.git] / sharedbraycurtis.cpp
index e8512d4b95bf3d2d32e058ca5c0b250d25609979..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,7 +37,7 @@ 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; }