| Line | |
|---|
| 1 | #ifndef MSADist_h |
|---|
| 2 | #define MSADist_h |
|---|
| 3 | |
|---|
| 4 | #include <math.h> |
|---|
| 5 | |
|---|
| 6 | double GetScoreDist(const MSA &msa, unsigned SeqIndex1, unsigned SeqIndex2); |
|---|
| 7 | |
|---|
| 8 | class MSADist |
|---|
| 9 | { |
|---|
| 10 | public: |
|---|
| 11 | MSADist(DISTANCE Distance) |
|---|
| 12 | { |
|---|
| 13 | m_Distance = Distance; |
|---|
| 14 | } |
|---|
| 15 | |
|---|
| 16 | double ComputeDist(const MSA &msa, unsigned uSeqIndex1, unsigned uSeqIndex2) |
|---|
| 17 | { |
|---|
| 18 | if (m_Distance == DISTANCE_ScoreDist) |
|---|
| 19 | return GetScoreDist(msa, uSeqIndex1, uSeqIndex2); |
|---|
| 20 | |
|---|
| 21 | double dPctId = msa.GetPctIdentityPair(uSeqIndex1, uSeqIndex2); |
|---|
| 22 | switch(m_Distance) |
|---|
| 23 | { |
|---|
| 24 | case DISTANCE_PctIdKimura: |
|---|
| 25 | return KimuraDist(dPctId); |
|---|
| 26 | case DISTANCE_PctIdLog: |
|---|
| 27 | if (dPctId < 0.05) |
|---|
| 28 | dPctId = 0.05; |
|---|
| 29 | return -log(dPctId); |
|---|
| 30 | } |
|---|
| 31 | Quit("MSADist::ComputeDist, invalid DISTANCE_%u", m_Distance); |
|---|
| 32 | return 0; |
|---|
| 33 | } |
|---|
| 34 | |
|---|
| 35 | private: |
|---|
| 36 | DISTANCE m_Distance; |
|---|
| 37 | }; |
|---|
| 38 | |
|---|
| 39 | #endif // MSADist_h |
|---|
Note: See
TracBrowser
for help on using the repository browser.