Download presentation
Presentation is loading. Please wait.
Published byAndrea Marshall Modified over 9 years ago
1
Traceback and local alignment Prof. William Stafford Noble Department of Genome Sciences Department of Computer Science and Engineering University of Washington thabangh@gmail.com
2
Outline Responses from last class Sequence alignment – Motivation – Scoring alignments Python
3
One-minute responses Thank you for doing the one-minute responses and the revisions. Liked that you let us solve the DP. Liked going to lab in second half of lecture. More slowly with Python programming. Please explain more about string handling in Python, especially sys.argv. sys.argv is now more clear. Need more practical problems using sys. I know how to compute the DP score but not how to get the alignment. I still do not get how sequence alignment works. Can we go over DP again? Please don’t give us a test because our essay phase has begun already. Please limit the number of questions in class. Moving too slow with previous work and too fast with current work. I understood about 95% of the lecture. Can you give us some Python documentation or some interesting web site to improve and learn?
4
Revision What two things are needed to score a pairwise alignment? – A substitution matrix and a gap penalty. What does entry (i,j) in the DP matrix store? – The score of the best-scoring alignment up to those positions. What are the three valid moves when filling in the DP matrix? – Horizontal and vertical, corresponding to gaps. Diagonal, corresponding to a substitution.
5
A small example ACGT A2-7-5-7 C 2 -5 G -72 T -5-72 AAG A G C Find the optimal alignment of AAG and AGC. Use a gap penalty of d=-5.
6
A simple example ACGT A2-7-5-7 C 2 -5 G -72 T -5-72 AAG 0-5-10-15 A-5 G-10 C-15 Find the optimal alignment of AAG and AGC. Use a gap penalty of d=-5.
7
A simple example ACGT A2-7-5-7 C 2 -5 G -72 T -5-72 AAG 0-5-10-15 A-52-3-8 G-10-3 C-15-8 -6 Find the optimal alignment of AAG and AGC. Use a gap penalty of d=-5.
8
Traceback Start from the lower right corner and trace back to the upper left. Each arrow introduces one character at the end of each aligned sequence. A horizontal move puts a gap in the left sequence. A vertical move puts a gap in the top sequence. A diagonal move uses one character from each sequence.
9
Start from the lower right corner and trace back to the upper left. Each arrow introduces one character at the end of each aligned sequence. A horizontal move puts a gap in the left sequence. A vertical move puts a gap in the top sequence. A diagonal move uses one character from each sequence. A simple example AAG 0-5 A2-3 G C-6 Find the optimal alignment of AAG and AGC. Use a gap penalty of d=-5.
10
Start from the lower right corner and trace back to the upper left. Each arrow introduces one character at the end of each aligned sequence. A horizontal move puts a gap in the left sequence. A vertical move puts a gap in the top sequence. A diagonal move uses one character from each sequence. A simple example AAG 0-5 A2-3 G C-6 Find the optimal alignment of AAG and AGC. Use a gap penalty of d=-5. AAG- -AGC A-GC
11
DP matrix GAATC 0-4-8-12-16-20 C-4-5-9-13-12-6 A-8-451-3-7 T-12-810117 A-16-1221176 C-20-16-271117 GA-ATC CATA-C
12
DP matrix GAATC 0-4-8-12-16-20 C-4-5-9-13-12-6 A-8-451-3-7 T-12-810117 A-16-1221176 C-20-16-271117 GAAT-C CA-TAC
13
DP matrix GAATC 0-4-8-12-16-20 C-4-5-9-13-12-6 A-8-451-3-7 T-12-810117 A-16-1221176 C-20-16-271117 GAAT-C C-ATAC
14
DP matrix GAATC 0-4-8-12-16-20 C-4-5-9-13-12-6 A-8-451-3-7 T-12-810117 A-16-1221176 C-20-16-271117 GAAT-C -CATAC
15
Multiple solutions When a program returns a sequence alignment, it may not be the only best alignment. GA-ATC CATA-C GAAT-C CA-TAC GAAT-C C-ATAC GAAT-C -CATAC
16
Traceback problem #1 GAATC 0-4-8-12-16-20 C-4-5-9-13-12-6 A-8-451-3-7 T-12-810117 A-16-1221176 C-20-16-271117 Write down the alignment corresponding to the circled score.
17
Solution #1 GAATC 0-4-8-12-16-20 C-4-5-9-13-12-6 A-8-451-3-7 T-12-810117 A-16-1221176 C-20-16-271117 Write down the alignment corresponding to the circled score. GA CA
18
Traceback problem #2 GAATC 0-4-8-12-16-20 C-4-5-9-13-12-6 A-8-451-3-7 T-12-810117 A-16-1221176 C-20-16-271117 Write down three alignments corresponding to the circled score.
19
GAATC 0-4-8-12-16-20 C-4-5-9-13-12-6 A-8-451-3-7 T-12-810117 A-16-1221176 C-20-16-271117 GAATC CA--- Solution #2 Write down three alignments corresponding to the circled score.
20
GAATC 0-4-8-12-16-20 C-4-5-9-13-12-6 A-8-451-3-7 T-12-810117 A-16-1221176 C-20-16-271117 GAATC CA--- GAATC C-A-- Solution #2 Write down three alignments corresponding to the circled score.
21
Solution #2 GAATC 0-4-8-12-16-20 C-4-5-9-13-12-6 A-8-451-3-7 T-12-810117 A-16-1221176 C-20-16-271117 GAATC CA--- GAATC C-A-- GAATC -CA-- Write down three alignments corresponding to the circled score.
22
Local alignment A protein may be homologous to a region within a second protein. Usually, an alignment that spans the complete length of both sequences is not required.
23
BLAST allows local alignments Global alignment Local alignment
24
Global alignment DP Align sequence x and y. F is the DP matrix; s is the substitution matrix; d is the linear gap penalty.
25
Local alignment DP Align sequence x and y. F is the DP matrix; s is the substitution matrix; d is the linear gap penalty.
26
Local DP in equation form 0
27
A simple example ACGT A2-7-5-7 C 2 -5 G -72 T -5-72 AAG A G C Find the optimal local alignment of AAG and AGC. Use a gap penalty of d=-5. 0
28
A simple example ACGT A2-7-5-7 C 2 -5 G -72 T -5-72 AAG 0000 A0 G0 C0 Find the optimal local alignment of AAG and AGC. Use a gap penalty of d=-5. 0
29
A simple example ACGT A2-7-5-7 C 2 -5 G -72 T -5-72 AAG 0000 A0 G0 C0 Find the optimal local alignment of AAG and AGC. Use a gap penalty of d=-5. 0 0 -5 0 2
30
A simple example ACGT A2-7-5-7 C 2 -5 G -72 T -5-72 AAG 0000 A02 G0? C0? Find the optimal local alignment of AAG and AGC. Use a gap penalty of d=-5. 0
31
A simple example ACGT A2-7-5-7 C 2 -5 G -72 T -5-72 AAG 0000 A02?? G00?? C00?? Find the optimal local alignment of AAG and AGC. Use a gap penalty of d=-5. 0
32
A simple example ACGT A2-7-5-7 C 2 -5 G -72 T -5-72 AAG 0000 A0220 G0004 C0000 Find the optimal local alignment of AAG and AGC. Use a gap penalty of d=-5. 0
33
Local alignment Two differences with respect to global alignment: – No score is negative. – Traceback begins at the highest score in the matrix and continues until you reach 0. Global alignment algorithm: Needleman- Wunsch. Local alignment algorithm: Smith-Waterman.
34
A simple example ACGT A2-7-5-7 C 2 -5 G -72 T -5-72 AAG 0000 A0220 G0004 C0000 Find the optimal local alignment of AAG and AGC. Use a gap penalty of d=-5. 0 AG
35
Local alignment ACGT A2-7-5-7 C 2 -5 G -72 T -5-72 AAG 0000 G0 A0 A0 G0 G0 C0 Find the optimal local alignment of AAG and GAAGGC. Use a gap penalty of d=-5. 0
36
Local alignment ACGT A2-7-5-7 C 2 -5 G -72 T -5-72 AAG 0000 G0002 A0220 A0240 G0006 G0002 C0000 Find the optimal local alignment of AAG and GAAGGC. Use a gap penalty of d=-5. 0
37
Local alignment ACGT A2-7-5-7 C 2 -5 G -72 T -5-72 AAG 0000 G0002 A0220 A0240 G0006 G0002 C0000 Find the optimal local alignment of AAG and GAAGGC. Use a gap penalty of d=-5. 0 AAG
38
Summary Local alignment finds the best match between subsequences. Smith-Waterman local alignment algorithm: – No score is negative. – Trace back from the largest score in the matrix.
39
Sample problem #1 Given: – Two letters – A substitution matrix written as three columns (letter, letter, value) A C 0 A D -2 Return: – The value associated with the two letters You must store the substitution matrix in memory. You must account for the fact that the order of the letters doesn’t matter.
40
Solution outline Read the substitution matrix into a dictionary. – Each line of the file has three values. A C 4 A D -2 – Each line is stored in a dictionary with the first two entries as a tuple key and the last entry as the value. substitionMatrix[(letter1, letter2)] = value
41
Sample problem #2 Given: – A file containing two sequences of equal length (one per line) – A substitution matrix written as three columns (letter, letter, value) Return: – The score of the ungapped alignment between the sequences Test using input files from class web page. – Solutions: 1 = 69, 2 = 104, 3 = 153
42
Solution outline Store the substitution matrix in memory, as before. Check to be sure the sequences are the same length, and report an error if they are not. Use a for loop to traverse both sequences at once.
43
One-minute response At the end of each class Write for about one minute. Provide feedback about the class. Was part of the lecture unclear? What did you like about the class? Do you have unanswered questions? I will begin the next class by responding to the one-minute responses
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.