1 / 22

Review of Dynamic Programming

Review of Dynamic Programming. SEQUENCE 1. We want to calculate the score for the yellow box. The final score that we fill in the yellow box will be the SUM of two other scores, we’ll call them MATCH and MAX . Let’s try it…. SEQUENCE 2. Score = Sum of MatchScore + MAX Match Score

gus
Download Presentation

Review of Dynamic Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Review of Dynamic Programming SEQUENCE 1 We want to calculate the score for the yellow box. The final score that we fill in the yellow box will be the SUM of two other scores, we’ll call them MATCH and MAX. Let’s try it… SEQUENCE 2

  2. Score = Sum of MatchScore+MAX • Match Score • whether the sequence matches at that location • 1 for match / 0 for non match • MAX (the highest of the following three) • The score in the box at position i-1, j-1 • The highest score in the row i-x, j-1 (where 2<=x<i) • The highest score in the column i-1, j-y (where 2<=y<j) j-4 Dynamic Programming j-3 j-2 j-1 j i-4 i-3 i-2 i-1 i Fill in the Table from the top left hand corner!

  3. FILL in the Table from the top left hand corner! Dynamic Programming – Filling in the Table! A B B C D The MATCH score is assigned based on whether the residues at position i, j (i.e. yellow box) matches. In this case, the residues at i, j are A and A which matches. Therefore, the MATCH score would be 1. Since there are no i-1 or j-1 (i.e no column/rows on top) we don’t have to worry about the MAX part of the score. A B C C C

  4. Dynamic Programming – Filling in the Table! A B B C D Moving one square to the right. In this case, the residues at i, j are B and A and match. Therefore, the MATCH score would be 0. Again there are no i-1 or j-1 (i.e no column/rows on top) we don’t have to worry about the MAX part of the score. A B C C C

  5. Dynamic Programming – Filling in the Table! A B B C D We can filled in the rest of the first column and first row A B C C C

  6. Let’s move to the 2nd row • Score = Sum of MatchScore+MAX • MAX (the highest of the following three) • The score in the box at position i-1, j-1 • The highest score in the row i-x, j-1 (where 2<=x<i) • The highest score in the column i-1, j-y (where 2<=y<j) • In this case there is no 2 or 3 to consider • MatchScore = 1 • MAX = 1 • Score = 1 + 1 = 2 Dynamic Programming – Filling in the Table! A B B C D A B C C C

  7. Moving across the row • Score = Sum of MatchScore+MAX • MAX (the highest of the following three) • The score in the box at position i-1, j-1 • The highest score in the row i-x, j-1 (where 2<=x<i) • The highest score in the column i-1, j-y (where 2<=y<j) • MatchScore = 1 • MAX = 1 • Score = 1 + 1 = 2 Dynamic Programming – Filling in the Table! A B B C D A B C C C

  8. Moving across the row again! • Score = Sum of MatchScore+MAX • MAX (the highest of the following three) • The score in the box at position i-1, j-1 • The highest score in the row i-x, j-1 (where 2<=x<i) • The highest score in the column i-1, j-y (where 2<=y<j) • MatchScore = 0 • MAX = 1 • Score = 0 + 1 = 1 • We can fill in the last square using the same method = 1 Dynamic Programming – Filling in the Table! A B B C D A B C C C

  9. Moving to the next row • MAX (the highest of the following three) • The score in the box at position i-1, j-1 • The highest score in the row i-x, j-1 (where 2<=x<i) • The highest score in the column i-1, j-y (where 2<=y<j) • MatchScore = 0 • MAX = 1 • Score = 0 + 1 = 1 Dynamic Programming – Filling in the Table! A B B C D A B C C C

  10. Moving to the next row • MAX (the highest of the following three) • The score in the box at position i-1, j-1 • The highest score in the row i-x, j-1 (where 2<=x<i) • The highest score in the column i-1, j-y (where 2<=y<j) • MatchScore = 0 • MAX = 2 • Score = 0 + 2 = 2 Dynamic Programming – Filling in the Table! A B B C D A B C C C

  11. Moving to the next row • MAX (the highest of the following three) • The score in the box at position i-1, j-1 • The highest score in the row i-x, j-1 (where 2<=x<i) • The highest score in the column i-1, j-y (where 2<=y<j) • MatchScore = 1 • MAX = 2 OR2 • Score = 1 + 2 = 3 • We can fill in the last square in similar fashion Dynamic Programming – Filling in the Table! A B B C D A B C C C

  12. Dynamic Programming – Filling in the Table! A B B C D We can fill in the remaining squares! A B C C C

  13. The LAST Square! MATCH = 0 MAX = 3 Score = 0+3 = 3 Dynamic Programming – Filling in the Table! A B B C D A B C C C

  14. QUESTIONS? A B B C D A B C C C

  15. Traceback Protocol Used to get the alignment from the filled in table. Start in the lower right corner. You can only move to the largest number that is UP and TO THE LEFT. D D

  16. Traceback Protocol All 3 paths start like this. But, moving up and to the left from the square with score 2, we have two possible choices, both of which are up and to the left, and contain equal values. VD VD

  17. Traceback Protocol We now have two possible alignments – red and yellow. Yellow has only one more square it can access. The red alignment can branch off again, however. ATVD V-VD TVD VVD

  18. Traceback Protocol These are the 3 possible paths through the matrix, in other words, the 3 possible alignments. AATVD -AVVD AATVD AV-VD AATVD A-VVD

  19. Traceback Protocol Every time a diagonal line “skips” a box (i.e does not lead into the box immediately to the upper left (i-1, j-1), we insert a gap into the alignment.

  20. Traceback Protocol AATVD -AVVD AATVD AV-VD AATVD A-VVD

  21. Traceback Protocol Is this possible?? AATV-D -A-VVD Optimal alignment??

  22. QUESTIONS?? AATVD -AVVD AATVD AV-VD AATVD A-VVD

More Related