- tempA = shared1->getAbundance(j);
- tempB = shared2->getAbundance(j);
-
- //they are shared
- if ((tempA != 0) && (tempB != 0)) {
- if (Atotal != 0) { sumSharedA = (tempA / (float)Atotal); }
- if (Btotal != 0) { sumSharedB = (tempB / (float)Btotal); }
-
- a += sumSharedA * sumSharedA;
- b += sumSharedB * sumSharedB;
- d += sumSharedA * sumSharedB;
- }
+ relA = shared1->getAbundance(j) / (float)Atotal;
+ relB = shared2->getAbundance(j) / (float)Btotal;
+
+ a += relA * relB;
+ b += pow((relA-relB),2);