0% found this document useful (0 votes)
36 views24 pages

Lecture 9

The Smith-Waterman algorithm is used for local sequence alignment to find similar regions between two nucleotide or protein sequences. It involves constructing a matrix where the edges are initialized to 0 instead of increasing gap penalties. Scores are filled into the matrix based on matches, mismatches and gaps. The traceback starts from the highest score and ends at a score of 0, finding the optimal local alignment between the sequences. As an example, the algorithm is demonstrated aligning the protein sequences "COELACANTH" and "PELICAN".

Uploaded by

SUNDAS FATIMA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views24 pages

Lecture 9

The Smith-Waterman algorithm is used for local sequence alignment to find similar regions between two nucleotide or protein sequences. It involves constructing a matrix where the edges are initialized to 0 instead of increasing gap penalties. Scores are filled into the matrix based on matches, mismatches and gaps. The traceback starts from the highest score and ends at a score of 0, finding the optimal local alignment between the sequences. As an example, the algorithm is demonstrated aligning the protein sequences "COELACANTH" and "PELICAN".

Uploaded by

SUNDAS FATIMA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 24

Bio Informatics

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)

Match: +1; Mismatch: -1; Gap: -1;


{
𝑓 ( 𝑖 , 𝑗 ) =𝑚𝑎𝑥 𝑓 (  ) +𝑆(𝐺𝑎𝑝)
𝑓 (  ) +𝑆(𝐺𝑎𝑝)
0

C O E L A C A N T H
0 ?
P
E
 
L ?
I
C
A
N
Smith-Waterman – Example
  𝑓 (  ) +𝑆(𝑚𝑎𝑡𝑐h 𝑂𝑅 𝑚𝑖𝑠𝑚𝑎𝑡𝑐h)

Match: +1; Mismatch: -1; Gap: -1;


{
𝑓 ( 𝑖 , 𝑗 ) =𝑚𝑎𝑥 𝑓 (  ) +𝑆(𝐺𝑎𝑝)
𝑓 (  ) +𝑆(𝐺𝑎𝑝)
0

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)

Match: +1; Mismatch: -1; Gap: -1;


{
𝑓 ( 𝑖 , 𝑗 ) =𝑚𝑎𝑥 𝑓 (  ) +𝑆(𝐺𝑎𝑝)
𝑓 (  ) +𝑆(𝐺𝑎𝑝)
0

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)

Match: +1; Mismatch: -1; Gap: -1;


{
𝑓 ( 𝑖 , 𝑗 ) =𝑚𝑎𝑥 𝑓 (  ) +𝑆(𝐺𝑎𝑝)
𝑓 (  ) +𝑆(𝐺𝑎𝑝)
0

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)

Match: +1; Mismatch: -1; Gap: -1;


{
𝑓 ( 𝑖 , 𝑗 ) =𝑚𝑎𝑥 𝑓 (  ) +𝑆(𝐺𝑎𝑝)
𝑓 (  ) +𝑆(𝐺𝑎𝑝)
0

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)

Match: +1; Mismatch: -1; Gap: -1;


{
𝑓 ( 𝑖 , 𝑗 ) =𝑚𝑎𝑥 𝑓 (  ) +𝑆(𝐺𝑎𝑝)
𝑓 (  ) +𝑆(𝐺𝑎𝑝)
0

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)

Match: +1; Mismatch: -1; Gap: -1;


{
𝑓 ( 𝑖 , 𝑗 ) =𝑚𝑎𝑥 𝑓 (  ) +𝑆(𝐺𝑎𝑝)
𝑓 (  ) +𝑆(𝐺𝑎𝑝)
0

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)

Match: +1; Mismatch: -1; Gap: -1;


{
𝑓 ( 𝑖 , 𝑗 ) =𝑚𝑎𝑥 𝑓 (  ) +𝑆(𝐺𝑎𝑝)
𝑓 (  ) +𝑆(𝐺𝑎𝑝)
0

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)

Match: +1; Mismatch: -1; Gap: -1;


{
𝑓 ( 𝑖 , 𝑗 ) =𝑚𝑎𝑥 𝑓 (  ) +𝑆(𝐺𝑎𝑝)
𝑓 (  ) +𝑆(𝐺𝑎𝑝)
0

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

Match: +1; Mismatch: -1; Gap: -1;


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 0 0 0 0 0 0 0
E 0 0 0
  1 0 0 0 0 0 0 0
L 0 0 0 0  2 1 0 0 0 0 0
I 0 0 0 0  1 
 
1 0 0 0 0 0
   
C 0 1 0 0 0 0  2 1 0 0 0

A 0 0 0 0 0 1 0   3 2 1 0

 
N 0 0 0 0 0 0 0 2  
4 
3 2

  
 

  
 
Smith-Waterman – Example

Match: +1; Mismatch: -1; Gap: -1;


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 0 0 0 0 0 0 0
E 0 0 0
  1 0 0 0 0 0 0 0
L 0 0 0 0  2 1 0 0 0 0 0
I 0 0 0 0  1 
 
1 0 0 0 0 0
   
C 0 1 0 0 0 0  2 1 0 0 0

A 0 0 0 0 0 1 0   3 2 1 0

 
N 0 0 0 0 0 0 0 2  
4 
3 2

  
 

  
 
Smith-Waterman – Example

Match: +1; Mismatch: -1; Gap: -1;


C O E L A C A N T H
0 0 0 0 0 0 0 0 0 0 0 N
P 0 0 0 0 0 0 0 0 0 0 0
E 0 0 0
  1 0 0 0 0 0 0 0 N
L 0 0 0 0  2 1 0 0 0 0 0
I 0 0 0 0  1 
 
1 0 0 0 0 0
   
C 0 1 0 0 0 0  2 1 0 0 0

A 0 0 0 0 0 1 0   3 2 1 0

 
N 0 0 0 0 0 0 0 2  
4 
3 2

  
 

  
 
Smith-Waterman – Example

Match: +1; Mismatch: -1; Gap: -1;


C O E L A C A N T H
0 0 0 0 0 0 0 0 0 0 0 AN
P 0 0 0 0 0 0 0 0 0 0 0
E 0 0 0
  1 0 0 0 0 0 0 0 AN
L 0 0 0 0  2 1 0 0 0 0 0
I 0 0 0 0  1 
 
1 0 0 0 0 0
   
C 0 1 0 0 0 0  2 1 0 0 0

A 0 0 0 0 0 1 0   3 2 1 0

 
N 0 0 0 0 0 0 0 2  
4 
3 2

  
 

  
 
Smith-Waterman – Example

Match: +1; Mismatch: -1; Gap: -1;


C O E L A C A N T H
0 0 0 0 0 0 0 0 0 0 0 C AN
P 0 0 0 0 0 0 0 0 0 0 0
E 0 0 0
  1 0 0 0 0 0 0 0 C AN
L 0 0 0 0  2 1 0 0 0 0 0
I 0 0 0 0  1 
 
1 0 0 0 0 0
   
C 0 1 0 0 0 0  2 1 0 0 0

A 0 0 0 0 0 1 0   3 2 1 0

 
N 0 0 0 0 0 0 0 2  
4 
3 2

  
 

  
 
Smith-Waterman – Example

Match: +1; Mismatch: -1; Gap: -1;


C O E L A C A N T H
0 0 0 0 0 0 0 0 0 0 0 A C AN
P 0 0 0 0 0 0 0 0 0 0 0 .
E 0 0 0
  1 0 0 0 0 0 0 0 I C AN
L 0 0 0 0  2 1 0 0 0 0 0
I 0 0 0 0  1 
 
1 0 0 0 0 0
   
C 0 1 0 0 0 0  2 1 0 0 0

A 0 0 0 0 0 1 0   3 2 1 0

 
N 0 0 0 0 0 0 0 2  
4 
3 2

  
 

  
 
Smith-Waterman – Example

Match: +1; Mismatch: -1; Gap: -1;


C O E L A C A N T H
0 0 0 0 0 0 0 0 0 0 0 L A C AN
P 0 0 0 0 0 0 0 0 0 0 0 .
E 0 0 0
  1 0 0 0 0 0 0 0 L I C AN
L 0 0 0 0  2 1 0 0 0 0 0
I 0 0 0 0  1 
 
1 0 0 0 0 0
   
C 0 1 0 0 0 0  2 1 0 0 0

A 0 0 0 0 0 1 0   3 2 1 0

 
N 0 0 0 0 0 0 0 2  
4 
3 2

  
 

  
 
Smith-Waterman – Example

Match: +1; Mismatch: -1; Gap: -1;


C O E L A C A N T H
0 0 0 0 0 0 0 0 0 0 0 E L A C AN
P 0 0 0 0 0 0 0 0 0 0 0 .
E 0 0 0
  1 0 0 0 0 0 0 0 E L I C AN
L 0 0 0 0  2 1 0 0 0 0 0
I 0 0 0 0  1 
 
1 0 0 0 0 0
   
C 0 1 0 0 0 0  2 1 0 0 0

A 0 0 0 0 0 1 0   3 2 1 0

 
N 0 0 0 0 0 0 0 2  
4 
3 2

  
 

  
 
Smith-Waterman – Example

Match: +1; Mismatch: -1; Gap: -1;


C O E L A C A N T H
0 0 0 0 0 0 0 0 0 0 0 E L A C AN
P 0 0 0 0 0 0 0 0 0 0 0 .
E 0 0 0
  1 0 0 0 0 0 0 0 E L I C AN
L 0 0 0 0  2 1 0 0 0 0 0
I 0 0 0 0  1 
 
1 0 0 0 0 0 =+1+1-1+1+1+1
   
C 0 1 0 0 0 0  2 1 0 0

0 =4
A 0 0 0 0 0 1 0   3 2 1 0

 
N 0 0 0 0 0 0 0 2  
4 
3 2

  
 

  
 
Smith-Waterman Algorithm - Tasks &
Homeworks
 Mandatory Task: Provide all possible
alignments to these DNA sequences.
 The task is assigned on LMS page.
 The material of the lecture will be shared on
LMS page.

 Good Luck and Thank You!

You might also like