algorithm
algorithm
Here F is
score matrix of dimensions n, m and d is the gap penalty.
begin
initialization:
F(0, 0) = 0
for i=0 to m do
F(0, i) = −i * d
end
for j=0 to n do
F(j, 0) = −j* d
end
matrix fill:
for i=1 to n do
for j=1 to m do
F(I, j) = max { F(i-1,j-1)+ s(x, y), F(i-1,j) – d, F(i,j-1) – d }
end
end
end
Backtrack matrix is constructed using Algorithm 4.2. Aligning sequences sa and sb of length m
and n, respectively, with linear gap penalty [13].
begin
for i := 1 to n do
for j := 1 to m do
UP_Value = F(i – 1, j)
Left_Value = F(i, j – 1)
UP_Left_Value = F(i –1, j – 1)
if (sja := sjb) do
BM(i, j) = '*'
else
if (Left_Value >= U_Value) do
if (Left_Value + gap_penalty >= UP_Left_Value + Mismatch) do
fill BM(i, j) with '–'
else
fill BM(i, j) with '*'
end
else
if (UP_Value + gap_penalty >= UP_Left_Value + Mismatch) do
fill BM(i, j) with '#'
else
fill BM(i, j) with '*'
end
end
end
end
end
end