WOLFRAM|DEMONSTRATIONS PROJECT

Global and Local Sequence Alignment Algorithms

​
string1
BANDMASTERS
string2
TWINSET
alignment
global
local
Needleman-Wunsch algorithm
match
1
mismatch
-1
insertion/deletion
-1
-
B
A
N
D
M
A
S
T
E
R
S
T
W
I
N
-
-
-
S
-
E
-
T
B
A
N
D
M
A
S
T
E
R
S
0
←
-1
←
-2
←
-3
←
-4
←
-5
←
-6
←
-7
←
-8
←
-9
←
-10
←
-11
T
↑
-1
↖
-1
↖
-2
↖
-3
↖
-4
↖
-5
↖
-6
↖
-7
↖
-6
←
-7
←
-8
←
-9
W
↑
-2
↖
-2
↖
-2
↖
-3
↖
-4
↖
-5
↖
-6
↖
-7
↑
-7
↖
-7
↖
-8
↖
-9
I
↑
-3
↖
-3
↖
-3
↖
-3
↖
-4
↖
-5
↖
-6
↖
-7
↖
-8
↖
-8
↖
-8
↖
-9
N
↑
-4
↖
-4
↖
-4
↖
-2
←
-3
←
-4
←
-5
←
-6
←
-7
←
-8
↖
-9
↖
-9
S
↑
-5
↖
-5
↖
-5
↑
-3
↖
-3
↖
-4
↖
-5
↖
-4
←
-5
←
-6
←
-7
↖
-8
E
↑
-6
↖
-6
↖
-6
↑
-4
↖
-4
↖
-4
↖
-5
↑
-5
↖
-5
↖
-4
←
-5
←
-6
T
↑
-7
↖
-7
↖
-7
↑
-5
↖
-5
↖
-5
↖
-5
↖
-6
↖
-4
↑
-5
↖
-5
↖
-6
Sequence alignment is widely used in molecular biology to find similar DNA or protein sequences. These algorithms generally fall into two categories: global, which align the entire sequence, and local, which only look for highly similar subsequences. This Demonstration uses the Needleman–Wunsch (global) and Smith–Waterman (local) algorithms to align random English words. Gaps are shaded yellow, mismatches orange, and matches red (with a lighter shade for those matches not appearing in the final alignment).