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

Lecture 5

The Needleman-Wunsch algorithm is used to align protein or nucleotide sequences and find the optimal global alignment between them. It works by constructing a grid with the two sequences along the axes and recursively calculating alignment scores for each cell based on matches, mismatches and gaps. The algorithm traces back through the optimal score to determine the highest scoring alignment between the two sequences.

Uploaded by

SUNDAS FATIMA
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views

Lecture 5

The Needleman-Wunsch algorithm is used to align protein or nucleotide sequences and find the optimal global alignment between them. It works by constructing a grid with the two sequences along the axes and recursively calculating alignment scores for each cell based on matches, mismatches and gaps. The algorithm traces back through the optimal score to determine the highest scoring alignment between the two sequences.

Uploaded by

SUNDAS FATIMA
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 15

Bio Informatics

Lecture 5
Needleman–Wunsch Algorithm
• The Needleman–Wunsch algorithm is an algorithm used
in bioinformatics to align protein or nucleotide sequences.
• It was one of the first applications of
dynamic programming to compare biological sequences.
• The algorithm was developed by Saul B. Needleman and
Christian D. Wunsch and published in 1970.
• The algorithm essentially divides a large problem (e.g. the
full sequence) into a series of smaller problems, and it
uses the solutions to the smaller problems to find an
optimal solution to the larger problem.
Needleman–Wunsch Algorithm
• It is also sometimes referred to as the
optimal matching algorithm and the global alignment
technique.
• The Needleman–Wunsch algorithm is still widely
used for optimal global alignment, particularly when
the quality of the global alignment is of the utmost
importance.
• The algorithm assigns a score to every possible
alignment, and the purpose of the algorithm is to
find all possible alignments having the highest score.
Needleman–Wunsch Algorithm
• This algorithm can be used for any two strings.
• This guide will use two small DNA sequences
as examples as shown below:
• Sequence (1): GCATGCU
• Sequence (2): GATTACA

• The first step is to construct a grid.


Needleman–Wunsch Algorithm
G C A T G C U Match: +1; Mismatch: -1; Gap: -1

  𝑓 ( 𝑖−1, 𝑗−1 )+𝑆(𝑥𝑖 , 𝑦𝑖 )


G
A {
𝑓 ( 𝑖 , 𝑗 ) =𝑚𝑎𝑥 𝑓 ( 𝑖−1, 𝑗 )+𝑆(𝐺𝑎𝑝)
𝑓 ( 𝑖 , 𝑗−1 )+𝑆(𝐺𝑎𝑝)
T
T   𝑓 (  ) +𝑆(𝑚𝑎𝑡𝑐h𝑂𝑅 𝑚𝑖𝑠𝑚𝑎𝑡𝑐h)

A {
𝑓 ( 𝑖 , 𝑗 ) =𝑚𝑎𝑥 𝑓 (  ) +𝑆(𝐺𝑎𝑝)
𝑓 (  ) +𝑆(𝐺𝑎𝑝)
C
A
Needleman–Wunsch Algorithm
Next, decide how to score each individual pair of letters.
The letters may match, mismatch, or be matched to a
gap (a deletion or insertion (Indel)):
 Match: The two letters at the current index are the
same.
 Mismatch: The two letters at the current index are
different.
 Indel (INsertion or DELetion): The best alignment
involves one letter aligning to a gap(-) in the other
string.
Needleman–Wunsch Algorithm
• Each of these scenarios is assigned a score and
the sum of the scores of all the pairings is the
score of the whole alignment candidate.
• Different systems exist for assigning scores;
For now, the following system will be used:
• Match: +1
• Mismatch or Gap: −1
Needleman–Wunsch Algorithm
G C A T G C U Match: +1; Mismatch: -1; Gap: -1;

0   -2
  -1   -3
  -4
  -5
  -6 
  -7   𝑓 (  ) +𝑆(𝑚𝑎𝑡𝑐h 𝑂𝑅 𝑚𝑖𝑠𝑚𝑎𝑡𝑐h)
G
A
-1

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

T 
 
-3

T 
 
-4
Sequence (1): GCATGCU
Sequence (2): GATTACA
A 
 
-5

C 
 
-6

A 
 
-7
Needleman–Wunsch Algorithm
G C A T G C U Match: +1; Mismatch: -1; Gap: -1;

0   -2
  -1   -3
  -4
  -5
  -6 
  -7   𝑓 (  ) +𝑆(𝑚𝑎𝑡𝑐h 𝑂𝑅 𝑚𝑖𝑠𝑚𝑎𝑡𝑐h)
G
A
-1

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

T 
 
-3

T 
 
-4
Sequence (1): GCATGCU
Sequence (2): GATTACA
A 
 
-5  
?
C 
 
-6

A 
 
-7
Needleman–Wunsch Algorithm
G C A T G C U Match: +1; Mismatch: -1; Gap: -1;

0   -2
  -1   -3
  -4
  -5
  -6 
  -7   𝑓 (  ) +𝑆(𝑚𝑎𝑡𝑐h 𝑂𝑅 𝑚𝑖𝑠𝑚𝑎𝑡𝑐h)
G
A
-1

 
-2
 
1 ?
{
𝑓 ( 𝑖 , 𝑗 ) =𝑚𝑎𝑥 𝑓 (  ) +𝑆(𝐺𝑎𝑝)
𝑓 (  ) +𝑆(𝐺𝑎𝑝)

T 
 
-3

T 
 
-4
Sequence (1): GCATGCU
Sequence (2): GATTACA
A 
 
-5  
?
C 
 
-6

A 
 
-7
Needleman–Wunsch Algorithm
G C A T G C U Match: +1; Mismatch: -1; Gap: -1;

0   -2
  -1   -3
  -4
  -5
  -6 
  -7   𝑓 (  ) +𝑆(𝑚𝑎𝑡𝑐h 𝑂𝑅 𝑚𝑖𝑠𝑚𝑎𝑡𝑐h)
G
A
-1

 
-2
 

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

T 
 
-3

T 
 
-4
Sequence (1): GCATGCU
Sequence (2): GATTACA
A 
 
-5  
?
C 
 
-6

A 
 
-7
Needleman–Wunsch Algorithm
G C A T G C U Match: +1; Mismatch: -1; Gap: -1;

0   -2
  -1   -3
  -4
  -5
  -6 
  -7   𝑓 (  ) +𝑆(𝑚𝑎𝑡𝑐h 𝑂𝑅 𝑚𝑖𝑠𝑚𝑎𝑡𝑐h)
G
A
-1

 
 


 

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

T 
 
-3

T 
 
-4
Sequence (1): GCATGCU
Sequence (2): GATTACA
A 
 
-5  
?
C 
 
-6

A 
 
-7
Needleman–Wunsch Algorithm
G C A T G C U Match: +1; Mismatch: -1; Gap: -1;

0   -2
  -1   -3
  -4
  -5
  -6 
  -7   𝑓 (  ) +𝑆(𝑚𝑎𝑡𝑐h 𝑂𝑅 𝑚𝑖𝑠𝑚𝑎𝑡𝑐h)
G
A
-1

 
-2
 



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

T 
 
-3 ?
T 
 
-4
Sequence (1): GCATGCU
Sequence (2): GATTACA
A 
 
-5  
?
C 
-6
 

A 
-7
 
Needleman–Wunsch Algorithm
Needleman–Wunsch Algorithm

You might also like