Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Project 3: Dynamic Programming Optimal String Alignment.

Similar presentations


Presentation on theme: "Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Project 3: Dynamic Programming Optimal String Alignment."— Presentation transcript:

1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Project 3: Dynamic Programming Optimal String Alignment

2 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Development of a Dynamic Programming Algorithm 1.Characterize the structure of a solution 2.Recursively define the value of a solution 3.Compute the value of a solution in a bottom-up fashion(using a table) 4.Construct a solution from computed information

3 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Example: Optimal String Alignment Images taken from http://www.sbc.su.se/~per/molbioinfo2001/dynprog/dynamic.html Want to find optimal (best) alignment between two strings where matches count as 1, mismatches count as 0, and “gaps” count as 0. Example: G A A T T C A G T T A G G A T C G A G _ A A T T C A G T T A G G _ A _ T C _ G _ _ A Notice that every alignment can start in exactly one of three ways: (1)Two non-gap characters (2)Non-gap above, gap below (3)Gap above, non-gap below Score == 6

4 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Example: Optimal String Alignment Notice in an optimal alignment of (s 1,s 2,…,s n ) with (t 1,t 2,…,t m ) one of these must be true: (1)S 2..n must be optimally aligned with T 2..m (2)S 2..n must be optimally aligned with T 1..m (3)S 1..n must be optimally aligned with T 2..m The score of each is then (1)Score(S 2..n, T 2..m ) + Score(S 1,T 1 ) (2)Score(S 2..n, T 1..m ) + Score(S 1,gap) (3)Score(S 1..n, T 2..m ) + Score(T 1,gap) We want to select the maximum of these, giving Score(S 1..n, T 1..m ) = max(Score(S 2..n, T 2..m ) + Score(S 1,T 1 ), Score(S 2..n, T 1..m ) + Score(S 1,gap), Score(S 1..n, T 2..m ) + Score(gap,T 1 )) base case given by scoring function Only gives score of optimal, not actual alignment

5 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Example: Optimal String Alignment Let’s build a table, M, of values such that M[i][j] is the optimal score for S 1..i aligned with T 1..j. If we have this, M[n][m] is the overall optimal score M is zero-indexed to allow for beginning gap Notice by our recurrence relation, M[i][j] = max(M[i-1][j-1] + Score(S i,T j ), M[i][j-1] + Score(gap,Tj), M[i-1][j] + Score(S i,gap))

6 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Example: Optimal String Alignment M[i][0] = Score(S i,gap) M[0][j] = Score(gap,S j ) Base Case

7 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Example: Optimal String Alignment M[i][j] = max(M[i-1][j-1] + Score(S i,T j ), M[i][j-1] + Score(gap,Tj), M[i-1][j] + Score(S i,gap))

8 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Example: Optimal String Alignment M[i][j] = max(M[i-1][j-1] + Score(S i,T j ), M[i][j-1] + Score(gap,Tj), M[i-1][j] + Score(S i,gap))

9 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Example: Optimal String Alignment M[i][j] = max(M[i-1][j-1] + Score(S i,T j ), M[i][j-1] + Score(gap,Tj), M[i-1][j] + Score(S i,gap))

10 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Example: Optimal String Alignment M[i][j] = max(M[i-1][j-1] + Score(S i,T j ), M[i][j-1] + Score(gap,Tj), M[i-1][j] + Score(S i,gap))

11 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Example: Optimal String Alignment M[i][j] = max(M[i-1][j-1] + Score(S i,T j ), M[i][j-1] + Score(gap,Tj), M[i-1][j] + Score(S i,gap))

12 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Example: Optimal String Alignment Still need to find actual alignment that results in maximum score Can be done by tracing back from optimal value to find where it must have originated representing earlier optimal alignment G _ A A T T C A G T T A G G _ A _ T C _ G _ _ A


Download ppt "Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Project 3: Dynamic Programming Optimal String Alignment."

Similar presentations


Ads by Google