1 #include "muscle.h"
2 #include "distfunc.h"
3 #include "msa.h"
4 #include "seqvect.h"
5 #include "pwpath.h"
6
DistPWKimura(const SeqVect & v,DistFunc & DF)7 void DistPWKimura(const SeqVect &v, DistFunc &DF)
8 {
9 SEQWEIGHT SeqWeightSave = GetSeqWeightMethod();
10 SetSeqWeightMethod(SEQWEIGHT_Henikoff);
11
12 const unsigned uSeqCount = v.Length();
13 DF.SetCount(uSeqCount);
14
15 const unsigned uPairCount = (uSeqCount*(uSeqCount + 1))/2;
16 unsigned uCount = 0;
17 SetProgressDesc("PWKimura distance");
18 for (unsigned uSeqIndex1 = 0; uSeqIndex1 < uSeqCount; ++uSeqIndex1)
19 {
20 const Seq &s1 = v.GetSeq(uSeqIndex1);
21 MSA msa1;
22 msa1.FromSeq(s1);
23 for (unsigned uSeqIndex2 = 0; uSeqIndex2 < uSeqIndex1; ++uSeqIndex2)
24 {
25 if (0 == uCount%20)
26 Progress(uCount, uPairCount);
27 ++uCount;
28 const Seq &s2 = v.GetSeq(uSeqIndex2);
29 MSA msa2;
30 msa2.FromSeq(s2);
31
32 PWPath Path;
33 MSA msaOut;
34 AlignTwoMSAs(msa1, msa2, msaOut, Path, false, false);
35
36 double dPctId = msaOut.GetPctIdentityPair(0, 1);
37 float f = (float) KimuraDist(dPctId);
38
39 DF.SetDist(uSeqIndex1, uSeqIndex2, f);
40 }
41 }
42 ProgressStepsDone();
43
44 SetSeqWeightMethod(SeqWeightSave);
45 }
46