Download presentation
Presentation is loading. Please wait.
Published byAyanna Enfield Modified over 9 years ago
2
Solusi DP Menggunakan Software Pertemuan 24 : (Off Class) Mata kuliah:K0164-Pemrograman Matematika Tahun:2008
3
Learning Outcomes Mahasiswa dapat mendemonstrasikan penyelesaian masalah dinamik programming, dengan menggunakan bantuan program komputer..
4
Outline Materi: Penerapan Dinamik Programming (DP) Penyelesaian masalah DP dengan program komputer..
5
Alignments -GCGC-ATGGATTGAGCGA TGCGCCATTGAT-GACC-A Three elements: Perfect matches Mismatches Gaps
6
Choosing Alignments There are many possible alignments For example, compare: -GCGC-ATGGATTGAGCGA TGCGCCATTGAT-GACC-A to ------GCGCATGGATTGAGCGA TGCGCC----ATTGATGACCA-- Which one is better?
7
Scoring Rule Example Score = (# matches) – (# mismatches) – (# gaps) x 2
8
Example -GCGC-ATGGATTGAGCGA TGCGCCATTGAT-GACC-A Score: (+1x13) + (-1x2) + (-2x4) = 3 ------GCGCATGGATTGAGCGA TGCGCC----ATTGATGACCA-- Score: (+1x5) + (-1x6) + (-2x11) = -23
9
Optimal Alignment Optimal alignment is achieved at best similarity score d, thus is determined by the scoring rule
10
Finding the Best Alignment Score The additive form of the score allows to perform dynamic programming to find the best score efficiently Guaranteed to find the best alignment
11
The Idea The best alignment that ends at a given pair of bases: the best among best alignments of the sequences up to that point, plus the score for aligning the two additional bases.
12
Dynamic Programming Consider the best alignment score of two sequences s, t at base/residue i+1, j+1, respectively:
13
Dynamic Programming The best alignment must be in one of three cases: 1. Last position is ( s[i+1],t[j +1] ) 2. Last position is ( -, t[j +1] ) 3. Last position is ( s[i +1], - )
14
Dynamic Programming The best alignment must be in one of three cases: 1. Last position is ( s[i+1],t[j +1] ) 2. Last position is ( -, t[j +1] ) 3. Last position is ( s[i +1], - )
15
Dynamic Programming The best alignment must be in one of three cases: 1. Last position is ( s[i+1],t[j +1] ) 2. Last position is ( -, t[j +1] ) 3. Last position is ( s[i +1], - )
16
Dynamic Programming
17
Of course, we first need to handle the base cases in the recursion:
18
Dynamic Programming We fill the matrix using the recurrence rule – A G C – – A A A C –
19
Dynamic Programming
20
Conclusion: d( AAAC, AGC ) = -1
21
Reconstructing the Best Alignment AAAC AG-C
22
More than one best alignment AAAC A-GC
23
Complexity Space: O(mn) Time: O(mn) Filling the matrix O(mn) Backtrace O(m+n)
24
Best-aligned Subsequences The best score or start over
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.