4 #include "textfile.h"
\r
10 #define COMPARE_SIMPLE 0
\r
13 TICKS g_ticksDP = 0;
\r
17 extern bool g_bKeepSimpleDP;
\r
18 SCORE NWSmall(const ProfPos *PA, unsigned uLengthA, const ProfPos *PB,
\r
19 unsigned uLengthB, PWPath &Path);
\r
20 SCORE NWDASmall(const ProfPos *PA, unsigned uLengthA, const ProfPos *PB,
\r
21 unsigned uLengthB, PWPath &Path);
\r
22 SCORE NWDASimple(const ProfPos *PA, unsigned uLengthA, const ProfPos *PB,
\r
23 unsigned uLengthB, PWPath &Path);
\r
24 SCORE NWDASimple2(const ProfPos *PA, unsigned uLengthA, const ProfPos *PB,
\r
25 unsigned uLengthB, PWPath &Path);
\r
26 SCORE GlobalAlignSimple(const ProfPos *PA, unsigned uLengthA, const ProfPos *PB,
\r
27 unsigned uLengthB, PWPath &Path);
\r
29 SCORE GlobalAlignNoDiags(const ProfPos *PA, unsigned uLengthA, const ProfPos *PB,
\r
30 unsigned uLengthB, PWPath &Path)
\r
32 return GlobalAlign(PA, uLengthA, PB, uLengthB, Path);
\r
37 SCORE GlobalAlign(const ProfPos *PA, unsigned uLengthA, const ProfPos *PB,
\r
38 unsigned uLengthB, PWPath &Path)
\r
41 TICKS t1 = GetClockTicks();
\r
43 g_bKeepSimpleDP = true;
\r
45 GlobalAlignSimple(PA, uLengthA, PB, uLengthB, SimplePath);
\r
47 SCORE Score = NWSmall(PA, uLengthA, PB, uLengthB, Path);
\r
49 if (!Path.Equal(SimplePath))
\r
55 Quit("Paths differ");
\r
59 TICKS t2 = GetClockTicks();
\r
60 g_ticksDP += (t2 - t1);
\r
65 #else // COMPARE_SIMPLE
\r
67 SCORE GlobalAlign(const ProfPos *PA, unsigned uLengthA, const ProfPos *PB,
\r
68 unsigned uLengthB, PWPath &Path)
\r
71 TICKS t1 = GetClockTicks();
\r
73 SCORE Score = NWSmall(PA, uLengthA, PB, uLengthB, Path);
\r
75 TICKS t2 = GetClockTicks();
\r
76 g_ticksDP += (t2 - t1);
\r
85 static void AllInserts(PWPath &Path, unsigned uLengthB)
\r
90 Edge.uPrefixLengthA = 0;
\r
91 for (unsigned uPrefixLengthB = 1; uPrefixLengthB <= uLengthB; ++uPrefixLengthB)
\r
93 Edge.uPrefixLengthB = uPrefixLengthB;
\r
94 Path.AppendEdge(Edge);
\r
98 static void AllDeletes(PWPath &Path, unsigned uLengthA)
\r
103 Edge.uPrefixLengthB = 0;
\r
104 for (unsigned uPrefixLengthA = 1; uPrefixLengthA <= uLengthA; ++uPrefixLengthA)
\r
106 Edge.uPrefixLengthA = uPrefixLengthA;
\r
107 Path.AppendEdge(Edge);
\r
111 SCORE GlobalAlign(const ProfPos *PA, unsigned uLengthA, const ProfPos *PB,
\r
112 unsigned uLengthB, PWPath &Path)
\r
115 TICKS t1 = GetClockTicks();
\r
119 AllInserts(Path, uLengthB);
\r
122 else if (0 == uLengthB)
\r
124 AllDeletes(Path, uLengthA);
\r
130 Score = GlobalAlignDiags(PA, uLengthA, PB, uLengthB, Path);
\r
132 Score = GlobalAlignNoDiags(PA, uLengthA, PB, uLengthB, Path);
\r
134 TICKS t2 = GetClockTicks();
\r
135 g_ticksDP += (t2 - t1);
\r
140 SCORE GlobalAlignNoDiags(const ProfPos *PA, unsigned uLengthA, const ProfPos *PB,
\r
141 unsigned uLengthB, PWPath &Path)
\r
144 return GlobalAlignDimer(PA, uLengthA, PB, uLengthB, Path);
\r
149 return GlobalAlignLE(PA, uLengthA, PB, uLengthB, Path);
\r
153 return GlobalAlignSP(PA, uLengthA, PB, uLengthB, Path);
\r
156 return GlobalAlignSPN(PA, uLengthA, PB, uLengthB, Path);
\r
159 Quit("Invalid PP score (GlobalAlignNoDiags)");
\r
165 #endif // !VER_3_52
\r