]> git.donarmstrong.com Git - mothur.git/blobdiff - sharedlennon.cpp
added otu.association command. added calcSpearman, calcKendall and calcPearson functi...
[mothur.git] / sharedlennon.cpp
index 514f2b90e502e468132d0a72e27273f05396a219..f3ed5ece3850f6528ecb56cc99a17765b7766ff7 100644 (file)
@@ -13,7 +13,7 @@
 
 EstOutput Lennon::getValues(vector<SharedRAbundVector*> shared) {
        try {
-               int S1, S2, S12, tempA, tempB, min;
+               double S1, S2, S12, tempA, tempB, min;
                S1 = 0; S2 = 0; S12 = 0; tempA = 0; tempB = 0; min = 0;
                
                /*S1, S2 = number of OTUs observed or estimated in A and B 
@@ -39,14 +39,14 @@ EstOutput Lennon::getValues(vector<SharedRAbundVector*> shared) {
                if (tempA < tempB) { min = tempA; }
                else { min = tempB; }
                
-               data[0] = S12 / (float)(S12 + min);
+               data[0] = 1.0 - S12 / (float)(S12 + min);
                
                if (isnan(data[0]) || isinf(data[0])) { data[0] = 0; }
                
                return data;
        }
        catch(exception& e) {
-               errorOut(e, "Lennon", "getValues");
+               m->errorOut(e, "Lennon", "getValues");
                exit(1);
        }
 }