Mac binaries
[jabaws.git] / website / archive / binaries / mac / src / muscle / msadist.h
diff --git a/website/archive/binaries/mac/src/muscle/msadist.h b/website/archive/binaries/mac/src/muscle/msadist.h
new file mode 100644 (file)
index 0000000..8dcafcd
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef MSADist_h\r
+#define MSADist_h\r
+\r
+#include <math.h>\r
+\r
+double GetScoreDist(const MSA &msa, unsigned SeqIndex1, unsigned SeqIndex2);\r
+\r
+class MSADist\r
+       {\r
+public:\r
+       MSADist(DISTANCE Distance)\r
+               {\r
+               m_Distance = Distance;\r
+               }\r
+\r
+       double ComputeDist(const MSA &msa, unsigned uSeqIndex1, unsigned uSeqIndex2)\r
+               {\r
+               if (m_Distance == DISTANCE_ScoreDist)\r
+                       return GetScoreDist(msa, uSeqIndex1, uSeqIndex2);\r
+\r
+               double dPctId = msa.GetPctIdentityPair(uSeqIndex1, uSeqIndex2);\r
+               switch(m_Distance)\r
+                       {\r
+               case DISTANCE_PctIdKimura:\r
+                       return KimuraDist(dPctId);\r
+               case DISTANCE_PctIdLog:\r
+                       if (dPctId < 0.05)\r
+                               dPctId = 0.05;\r
+                       return -log(dPctId);\r
+                       }\r
+               Quit("MSADist::ComputeDist, invalid DISTANCE_%u", m_Distance);\r
+               return 0;\r
+               }\r
+\r
+private:\r
+       DISTANCE m_Distance;\r
+       };\r
+\r
+#endif // MSADist_h\r