Docsity

How Sequences Evolve - Lecture Slides | BIOL 4540, Study notes of Biology

Partial preview of the text

Download How Sequences Evolve - Lecture Slides | BIOL 4540 and more Study notes Biology in PDF only on Docsity!

  • SeqLab: using BestFitDynamic Programming AlgorithmEvolution of proteinsGaps, Gap penaltiesBioinformatics 1: lecture

•more??•transposable element•polymerase "stutter"•duplication or whole gene or domainMechanisms of insertion or extension:•extension (gain of residues at either end)•insertion (gain of residue within the sequence)•deletion (loss of residues within the sequence)•truncation (loss of either end)•point mutations (single base changes)How sequences evolve

AB~~EFG ABCDEFG ABCDEFGWe don't know which, since we don't know the ancestral sequence.•Gaps can be caused by either a deletion or an insertion event.•Gaps are regions of length difference between two sequences.Where gaps come from

AB~~EFG ABCDEFG ABEFG

A the Alignment MatrixAn Alignment as a Path through

F E D B C

Imagine each of these boxes has a score in it. (i.e. from BLOSUM)

right-hand corner box.when we reach the lowerThe alignment is completediagonal.each step: down, right, orThere are directions for

A B C Gap rows

F E D

scores.("gap" rows) have noRows on top and leftsequences.lengths of the twowhere N and M are thematrix is (N+1)x(M+1),The size of the alignment

starting point

F E D A B C An alignment

~DEF AB~C

Bseq = Bseq+ 1score = score + gappenaltyelseif (walk[i]==down)Aseq = Aseq+1score = score + gappenaltyif (walk[i]==right) thenfor i from 1 to len(walk) doscore = 0.walk[1..4]=(right,diag,down,diag)read myfile, A[1..3,1.. 3 ]Aseq=0; Bseq=0; gappenalty=2;^ right=1; down=2; diag=3;Pseudocode for scoring an alignment with gaps

write *, "Score =",scoreenddoendifscore = score + A[Aseq,Bseq]Bseq = Bseq+1Aseq = Aseq+1elseif (walk[i]==diag) then

A B A walk through the alignment matrix

C

F E D

F E D A B C

F E D A B C

F E D A B C

F E D A B C

F E D A B C

DEF~~~ ~~~ABC

DEF~~~~ABC

DEF~A~BC ~DEFAB~C

~DEFABC~

DEFABC

possible pathsAll possible alignments = all

F E D A B C

starting here

ending here

Each box spawns three paths.

F E D A B C

possible paths ofTotal number of (^) n

diagonal.(the original) gogoes down, and yougoes right, one clonein each box. One clonecloning yourself twicepossible walks byYou could take all arrows = 3 n

Getting the

optimal

alignment

All "walks" through the alignment matrix end in the

(^) lower

right-hand corner

. We can ask each "walker" as it enters the

Consider the lastlast box what its score is. Then we pick the best one. (^) down (^) arrow before the last box. All

those (^) suboptimal together. That means we didn't need to keep track of any ofhighest score after all the walkers traverse the same arrowwalker had the highest score in the previous box still has thethe arrow and after the arrow did not change Whichever- a gap penalty. So the relative scores of those walks beforealignments that traversed that arrow added the same amount - (^) walks, just the (^) optimal (^) one for that box.

others, since they will always rank lower than the optimal.to keep the optimal walk into each box. We can ignore theThis is true for all boxes back to the beginning. We only need

that box. Keep just the highest scoring one For each box, add up the scores of the three walks that end in“Dynamic Programming”

. Draw an arrow

Make the alignment from the arrows. (When you reach the last box, trace back along the arrows.(traceback) from the box that had the highest scoring walk. This is the optimal

alignment !)

i,j i-1,j-1^ S = MAX { S Dynamic programming algorithm

i,j-1 (^) y S (^) - w (^) } i-1,j (^) xS (^) - w (^) , (^) + s(i,j),

F i,ji-1,j S S E i,j-1i-1,j-1S S D A B C

  • s(i,j)x- w y- w penalty.new term, either s(i,j) or a gap^ Think of each arrow as adding a

Filling in a box requires that the values in the three input boxes be already filled in.

i,j-1 y S - w } i-1,j xS - w , i,j^ i-1,j-1 S^ = MAX { S^ + s(i,j), Forward summation

F E D A B C

  • s(i,j)x - w y- w y-3w y-2w^ y-w^ x (^) x -w (^) -2w 0 are out-of-bounds..of the arrows, since the other tworows) are filled in using only one The first row and column (gap x-3w