Professional Documents
Culture Documents
Lecture 9
Smith-Waterman Algorithm – Example 3
(Local Alignment)
• The basic steps for the algorithm are similar to that of Needleman-
Wunsch algorithm.
• The steps are:
• The edges of the matrix are initialized to 0 instead of increasing
gap penalties. (Initialization of matrix)
• The maximum score is never less than 0, and no pointer is
recorded unless the score is greater than 0. (Matrix Filling with the
appropriate scores)
• The trace-back starts from the highest score in the matrix (rather
than at the end of the matrix) and ends at a score of 0 (rather than
the start of the matrix). (Trace back the sequences for a suitable
alignment)
Smith-Waterman Algorithm – Example 3
(Local Alignment)
• This algorithm can be used for any two strings.
• This guide will use two small Protein
sequences as examples as shown below:
• Sequence (1): COELACANTH
• Sequence (2): PELICAN
• The length is different. The first step is to
construct a grid.
Smith-Waterman – Example 3
C O E L A C A N T H
P
E
L
I
C
A
N
Smith-Waterman Algorithm - Scores
& Functions
Match: +1
Mismatch: -1
Gap: -1
𝑓 ( 𝑖 − 1 , 𝑗 − 1 ) + 𝑆 ( 𝑥𝑖 , 𝑦 𝑖 )
𝑓 ( 𝑖 , 𝑗 ) =𝑚𝑎𝑥
{ 𝑓 ( 𝑖 − 1 , 𝑗 ) + 𝑆 (𝐺𝑎𝑝)
𝑓 ( 𝑖 , 𝑗 − 1 ) + 𝑆 (𝐺𝑎𝑝)
0
𝑓 ( ) + 𝑆 (𝑚𝑎𝑡𝑐h 𝑂𝑅 𝑚𝑖𝑠𝑚𝑎𝑡𝑐h )
𝑓 ( 𝑖 , 𝑗 ) =𝑚𝑎𝑥
{ 𝑓 ( ) + 𝑆 (𝐺𝑎𝑝 )
𝑓 ( ) + 𝑆 (𝐺𝑎𝑝 )
0
Smith-Waterman – Example
𝑓 ( ) +𝑆(𝑚𝑎𝑡𝑐h 𝑂𝑅 𝑚𝑖𝑠𝑚𝑎𝑡𝑐h)
C O E L A C A N T H
0 ?
P
E
L ?
I
C
A
N
Smith-Waterman – Example
𝑓 ( ) +𝑆(𝑚𝑎𝑡𝑐h 𝑂𝑅 𝑚𝑖𝑠𝑚𝑎𝑡𝑐h)
C O E L A C A N T H
0 0 0 0 0 0 0 0 0 0 0
P ?
E
L ?
I
C
A
N
Smith-Waterman – Example
𝑓 ( ) +𝑆(𝑚𝑎𝑡𝑐h 𝑂𝑅 𝑚𝑖𝑠𝑚𝑎𝑡𝑐h)
C O E L A C A N T H
0 0 0 0 0 0 0 0 0 0 0
P 0 ?
E 0
L 0 ?
I 0
C 0
A 0
N 0
Smith-Waterman – Example
𝑓 ( ) +𝑆(𝑚𝑎𝑡𝑐h 𝑂𝑅 𝑚𝑖𝑠𝑚𝑎𝑡𝑐h)
C O E L A C A N T H
0 0 0 0 0 0 0 0 0 0 0
P 0 0 ?
E 0
L 0 ?
I 0
C 0
A 0
N 0
Smith-Waterman – Example
𝑓 ( ) +𝑆(𝑚𝑎𝑡𝑐h 𝑂𝑅 𝑚𝑖𝑠𝑚𝑎𝑡𝑐h)
C O E L A C A N T H
0 0 0 0 0 0 0 0 0 0 0
P 0 0 0
E 0 ?
L 0 ?
I 0
C 0
A 0
N 0
Smith-Waterman – Example
𝑓 ( ) +𝑆(𝑚𝑎𝑡𝑐h 𝑂𝑅 𝑚𝑖𝑠𝑚𝑎𝑡𝑐h)
C O E L A C A N T H
0 0 0 0 0 0 0 0 0 0 0
P 0 0 0
E 0 0 ?
L 0 ?
I 0
C 0
A 0
N 0
Smith-Waterman – Example
𝑓 ( ) +𝑆(𝑚𝑎𝑡𝑐h 𝑂𝑅 𝑚𝑖𝑠𝑚𝑎𝑡𝑐h)
C O E L A C A N T H
0 0 0 0 0 0 0 0 0 0 0
P 0 0 0 ?
E 0 0 0
L 0 ?
I 0
C 0
A 0
N 0
Smith-Waterman – Example
𝑓 ( ) +𝑆(𝑚𝑎𝑡𝑐h 𝑂𝑅 𝑚𝑖𝑠𝑚𝑎𝑡𝑐h)
C O E L A C A N T H
0 0 0 0 0 0 0 0 0 0 0
P 0 0 0 0
E 0 0 0 ?
L 0 ?
I 0
C 0
A 0
N 0
Smith-Waterman – Example
𝑓 ( ) +𝑆(𝑚𝑎𝑡𝑐h 𝑂𝑅 𝑚𝑖𝑠𝑚𝑎𝑡𝑐h)
C O E L A C A N T H
0 0 0 0 0 0 0 0 0 0 0
P 0 0 0 0 ? ? ? ? ? ? ?
E 0 0 0
1 ? ? ? ? ? ? ?
L 0 ? ? ? ? ? ? ? ? ? ? ?
I 0 ? ? ? ? ? ? ? ? ? ?
C 0 ? ? ? ? ? ? ? ? ? ?
A 0 ? ? ? ? ? ? ? ? ? ?
N 0 ? ? ? ? ? ? ? ? ? ?
Smith-Waterman – Example