This preview shows pages 1–6. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Gap Penalties CMSC 423 General Gap Penalties Now, the cost of a run of k gaps is gap k It might be more realistic to support general gap penalty, so that the score of a run of k gaps is gap ( k ) < gap k . Then, the optimization will prefer to group gaps together. AAAGAATTCA AAATCA AAAGAATTCA AAATCA vs. These have the same score, but the second one is often more plausible. A single insertion of GAAT into the Frst string could change it into the second. General Gap Penalties AAAGAATTCA AAATCA AAAGAATTCA AAATCA vs. Previous DP no longer works with general gap penalties because the score of the last character depends on details of the previous alignment: AAAGAAC AAA AAAGAATC AAA vs. Instead, we need to know how long a Fnal run of gaps is in order to give a score to the last subproblem. Three Matrices We now keep 3 different matrices: M[i,j] = score of best alignment of x[1..i] and y[1..j] ending with a character character match or mismatch . X[i,j] = score of best alignment of x[1..i] and y[1..j] ending with a space in X . Y[i,j] = score of best alignment of x[1..i] and y[1..j] ending with a space in Y . M [ i,j ] = match( i,j ) + max > < > : M [ i 1 ,j 1] X [ i 1 ,j 1] Y [ i 1 ,j 1] X [ i,j ] = max ( M [ i,j k ] gap( k ) for 1 k j Y [ i,j k ] gap( k ) for 1 k j Y [ i,j ] = max ( M [ i k,j ] gap( k ) for 1 k i X [ i k,j ] gap( k ) for 1 k i The M Matrix M [ i,j ] = match( i,j ) + max > < > : M [ i 1 ,j 1] X [ i 1 ,j 1] Y [ i 1 ,j 1] We now keep 3 different matrices: M[i,j] = score of best alignment of x[1..i] and y[1..j] ending with a character character match or mismatch ....
View
Full
Document
 Fall '07
 staff

Click to edit the document details