SUNY Geneseo Department of Computer Science


Sequence Comparisons via Dynamic Programming

Thursday, March 14

CSci 242, Spring 2013
Prof. Doug Baldwin

Return to List of Lectures

Previous Lecture

Questions?

Problem 1 in problem set?

Sequence Matching by Dynamic Programming

Biological application: how similar are 2 DNA sequences or proteins

Longest common subsequence

Make LCS of X with prefix of Y, or of Y with prefix of X

Needleman-Wunsch algorithm

Aligning base pairs

        score( X, Y, n, m )
            let C[0..n,0..m] be a new table
                // C[i,j] = max score aligning X1..i w/ Y1..j
            for i = 0 to n
                C[i,0] = d * i
            for j = 0 to m
                C[0,j] = d * j
            for i = 1 to n
                for j = 1 to m
                    C[i,j] = max( S(Xi,Yj)+C[i-1,j-1], d + C[i-1,j], d + C[i,j-1] )
            return C[n,m]

Next

Shortest paths in graphs

Section 25.2 through “Constructing a shortest path”


Next Lecture