0% found this document useful (0 votes)
6 views

algorithm

The document outlines two algorithms for aligning sequences with a linear gap penalty: Algorithm 4.1 initializes and constructs a score matrix, while Algorithm 4.2 constructs a backtrack matrix to determine the optimal alignment. The score matrix is filled based on the maximum values derived from previous calculations, incorporating gap penalties and match/mismatch scores. The backtrack matrix uses these scores to identify alignment characters, indicating matches, gaps, or mismatches.

Uploaded by

mdhasan.ansari
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

algorithm

The document outlines two algorithms for aligning sequences with a linear gap penalty: Algorithm 4.1 initializes and constructs a score matrix, while Algorithm 4.2 constructs a backtrack matrix to determine the optimal alignment. The score matrix is filled based on the maximum values derived from previous calculations, incorporating gap penalties and match/mismatch scores. The backtrack matrix uses these scores to identify alignment characters, indicating matches, gaps, or mismatches.

Uploaded by

mdhasan.ansari
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Aligning sequences sa and sb of length m and n, respectively, with linear gap penalty.

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

Algorithm 4.1: Score Matrix Initialization and Construction

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

Algorithm 4.2: Backtrack Matrix Construction Algorithm

You might also like