Presentation is loading. Please wait.

Presentation is loading. Please wait.

Pairwise sequence Alignment.

Similar presentations


Presentation on theme: "Pairwise sequence Alignment."— Presentation transcript:

1 Pairwise sequence Alignment

2 Types of Alignment • Global alignment: Aligning the whole sequences
• Appropriate when aligning two very closely related sequencs • Local alignment: Aligning certain regions in the sequences • Appropriate for aligning multi-domain protein sequences • It is important to use the “appropriate” type Distinction between global and local alignments of two sequences.

3

4 How do we compute the best alignment?
AGTGCCCTGGAACCCTGACGGTGGGTCACAAAACTTCTGGA Too many possible alignments: >> 2N (exercise) AGTGACCTGGGAAGACCCTGACCCTGGGTCACAAAACTC

5 Sequence Alignment AGGCTATCACCTGACCTCCAGGCCGATGCCC
TAGCTATCACGACCGCGGTCGATTTGCCCGAC -AGGCTATCACCTGACCTCCAGGCCGA--TGCCC--- TAG-CTATCAC--GACCGC--GGTCGATTTGCCCGAC Definition Given two strings x = x1x2...xM, y = y1y2…yN, an alignment is an assignment of gaps to positions 0,…, M in x, and 0,…, N in y, so as to line up each letter in one sequence with either a letter, or a gap in the other sequence

6 Alignment is additive Observation: The score of aligning x1……xM y1……yN
Say that x1…xi xi+1…xM aligns to y1…yj yj+1…yN The two scores add up: F(x[1:M], y[1:N]) = F(x[1:i], y[1:j]) + F(x[i+1:M], y[j+1:N])

7 Calculation of an alignment score

8 DP Algorithms for PairwiseAlignment
The number of all possible pairwise alignments (if gaps are allowed) is exponential in the length of the sequences Therefore, the approach of “score every possible alignment and choose the best” is infeasible in practice Efficient algorithms for pairwise alignment have been devised using dynamic programming (DP)

9 Two kinds of sequence alignment:
global and local We will first consider the global alignment algorithm of Needleman and Wunsch (1970). We will then explore the local alignment algorithm of Smith and Waterman (1981). Finally, we will consider BLAST, a heuristic version of Smith-Waterman. We will cover BLAST in detail on Monday. Page 63

10 Global alignment with the algorithm of Needleman and Wunsch (1970)
• Two sequences can be compared in a matrix along x- and y-axes. • If they are identical, a path along a diagonal can be drawn • Find the optimal subpaths, and add them up to achieve the best score. This involves --adding gaps when needed --allowing for conservative substitutions --choosing a scoring system (simple or complicated) N-W is guaranteed to find optimal alignment(s) Page 63

11

12 İnitial stage of filling in the DP
Sm and Sn m+1 x n+1 9 x 10 The sequences are written across the top and down the left side of a matrix, respectively, An extra row and column labeled “gap” are added to allow the alignment to begin with a gap of any length in either sequence. The gap rows are filled with penalty scores for gaps of increasing lengths, as indicated. A zero is placed in the upper right box corresponding to no gaps in either sequence. columns rows

13 Gap=-8 Gap=-4

14 Three steps to global alignment with the Needleman-Wunsch algorithm
[1] set up a matrix [2] score the matrix [3] identify the optimal alignment(s) Page 63

15 Four possible outcomes in aligning two sequences
1 2 [1] identity (stay along a diagonal) [2] mismatch (stay along a diagonal) [3] gap in one sequence (move vertically!) [4] gap in the other sequence (move horizontally!) Page 64

16 Page 64

17

18

19 Necessary values in adjacent cells

20 x (x1x2...xm) and y (y1y2...yn) The matrix has (m+1) rows labeled 0➝m and (n+1) columns labeled 0➝n The rows correspond to the residues of sequence x, and the columns correspond to the residues of sequence y y S0,0 + s(x1,y1) = 0+s(I,T)=0-1=-1 S1,0 + g = -8-8=-16 S0,1 + g = -8-8=-16 x

21 s11 is the score for an a1-b1 match added to 0 in the upper left position
Trial values for s12 are calculated and the maximum score is chosen. Trial 1 is to add the score for the a1-b2 match to s11 and subtract a penalty for a gap of size 1. The other three trials shown by arrows include gap penalties and so likely cannot yield a higher score than trial 1.

22 Global alignment of two protein sequences by the Needleman-Wunsch algorithm with enhancements by Smith and Waterman. sequence 1 = MNALSDRT and sequence 2 = MGSDRTTET. Notice the subsequence SDRT in the two sequences which one might expect to be aligned if the sequences are aligned properly. JMB, 1970

23 -12 is the penalty for opening the gap in the alignment, and -4 is the penalty for each additional sequence character in the gap. Use PAM250 M S0,0 + s(x1,y1) = 0+s(M,M)=0+6=6 S1,0 + g = =-24 S0,1 + g = =-24 M - - M S1,1 = - M M -

24 sequence 1 M - N A L S D R T sequence 2 M G S D R T T E T score = -5 sequence 1 M N A L S D R T score = -5

25 Example 2 score(H,P) = -2, gap penalty=-8 (linear) - H E A G W -8 -16
 - H E A G W -8 -16 -24 -32 -40 -48 -56 -64 -72 -80 P -2

26 Example contd. score(E,P) = 0, score(E,A) = -1, score(H,A) = -2 H E A G W  - -8 -16 -24 -32 -40 -48 -56 -64 -72 -80 P -2 -10 -3

27 H E A G A W G H E - E Optimal alignment: - P - - A W - H E A E H E A G
H E A G W -8 -16 -24 -32 -40 -48 -56 -64 -72 -80 P -2 -33 -42 -49 -57 -65 -73 -10 -3 -4 -12 -19 -28 -36 -44 -52 -60 -18 -11 -6 -7 -15 -21 -29 -37 -14 -13 -9 -22 4 -5 -30 2 -38 The value in the final cell is the best score for the alignment

28 Alignments and Paths through Example 3

29 t a c g - c a a - - - a c g t g a a t t

30 t - - a c g c a - - a a c g t g - - a a t t

31 Example 4 - T G C A T - A - A T - C - T G A T Alignment:

32 Tracing back a solution (I)

33 Tracing back a solution (II)
The algorithm is called with PRINT-LCS(b,V,n,m)

34 Computing Distance di-1,j + 1 di,j-1 + 1 di-1,j-1 , if vi=wj di,j=min
Only deletions/insertions are allowed

35 Needleman-Wunsch: dynamic programming
N-W is guaranteed to find optimal alignments, although the algorithm does not search all possible alignments. It is an example of a dynamic programming algorithm: an optimal path (alignment) is identified by incrementally extending optimal subpaths. Thus, a series of decisions is made at each step of the alignment to find the pair of residues with the best score. Page 67

36 Local sequence alignment
Suppose, we have a long DNA sequence (e.g., 4000 bp) and we want to compare it with the complete yeast genome (12.5M bp). What if only a portion of our query, say 200 bp length, has strong similarity to a gene in yeast. Can we find this 200 bp portion using (semi) global alignment? Probably not. Because, we are trying to align the complete 4000 bp sequence, thus a random alignment may get a better score than the one that aligns 200 bp portion to the similar gene in yeast.

37 Global alignment versus local alignment
Global alignment (Needleman-Wunsch) extends from one end of each sequence to the other Local alignment finds optimally matching regions within two sequences (“subsequences”) Local alignment is almost always used for database searches such as BLAST. It is useful to find domains (or limited regions of homology) within sequences Smith and Waterman (1981) solved the problem of performing optimal local sequence alignment. Other methods (BLAST, FASTA) are faster but less thorough. Page 69

38 How the Smith-Waterman algorithm works
Set up a matrix between two proteins (size m+1, n+1) No values in the scoring matrix can be negative! S > 0 The score in each cell is the maximum of four values: [1] s(i-1, j-1) + the new score at [i,j] (a match or mismatch) [2] s(i,j-1) – gap penalty [3] s(i-1,j) – gap penalty [4] zero Page 69

39 Local alignemnt The major difference between this scoring matrix and the Needleman-Wunsch matrix is that there are no negative scores in the Smith-Waterman scoring matrix. The effect of this change is that an alignment can begin anywhere without receiving a negative penalty from a previously low- scoring alignment. sequence 1 S D R T sequence 2 S D R T score = 15

40 Example Linear gap model Gap = -1 Match = 4 Mismatch = -2
Q: E Q L L K A L E F K L P: K V L E F G Y - E Q L L K A L E F K L - K V L E F G Y

41 Example Linear gap model Gap = -1 Match = 4 Mismatch = -2
Q: E Q L L K A L E F K L P: K V L E F G Y - E Q L L K A L E F K L - K V L E F G Y

42 Example Linear gap model Gap = -1 Match = 4 Mismatch = -2
Q: E Q L L K A L E F K L P: K V L E F G Y - E Q L L K A L E F K L - K V L E F G Y 4 3 2 1 6 5 7 10 9 8 14 13 12 11

43 Example Linear gap model Gap = -1 Match = 4 Mismatch = -2
Q: E Q L L K A L E F K L P: K V L E F G Y - E Q L L K A L E F K L - K V L E F G Y 4 3 2 1 6 5 7 10 9 8 14 13 12 11

44 Example Alignment - E Q L L K A L E F K L - K V L E F G Y
Q: E Q L L K A L E F K L P: K V L E F G Y Q: K A - L E F P: K - V L E F - E Q L L K A L E F K L - K V L E F G Y 4 3 2 1 6 5 7 10 9 8 14 13 12 11

45 Example Alignment - E Q L L K A L E F K L - K V L E F G Y
Q: E Q L L K A L E F K L P: K V L E F G Y Q: K - A L E F P: K V - L E F - E Q L L K A L E F K L - K V L E F G Y 4 3 2 1 6 5 7 10 9 8 14 13 12 11

46 Example Alignment - E Q L L K A L E F K L - K V L E F G Y
Q: E Q L L K A L E F K L P: K V L E F G Y Q: K A L E F P: K V L E F - E Q L L K A L E F K L - K V L E F G Y 4 3 2 1 6 5 7 10 9 8 14 13 12 11

47 Another Example Linear gap model Find the local alignment between:
Match = +5 Mismatch = -4 Q: G C T G G A A G G C A T P: G C A G A G C A C G Q -- G C T A P

48 Another Example Q P Q’s subsequence: G A A G – G C A
P’s subsequence: G C A G A G C A Q -- G C T A 5 1 10 6 2 15 11 7 3 8 13 12 4 9 17 22 18 14 P

49


Download ppt "Pairwise sequence Alignment."

Similar presentations


Ads by Google