1 / 38

Dot Matrices Global Alignments Local Alignment

HOW Can we Align Two Sequences ?. Dot Matrices Global Alignments Local Alignment. Dot Matrices. QUESTION. What are the elements shared by two sequences ?. >Seq1 THEFATCAT >Seq2 THELASTCAT. T. H. E. F. A. T. C. A. T. T. Window. H. E. Stringency. F. A. S. T. C. A. T.

marlee
Download Presentation

Dot Matrices Global Alignments Local Alignment

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. HOW Can we Align Two Sequences ? Dot MatricesGlobal Alignments Local Alignment

  2. Dot Matrices QUESTION What are the elements shared by two sequences ?

  3. >Seq1 THEFATCAT >Seq2 THELASTCAT T H E F A T C A T T Window H E Stringency F A S T C A T Dot Matrices

  4. Window size Sequences Stringency Dot Matrices

  5. Window=1Stringency=1 Window=11Stringency=7 Window=25Stringency=15 Dot Matrices Strigency

  6. x x x y y Dot Matrices

  7. Dot Matrices

  8. Dot Matrices

  9. Dot Matrices

  10. Dot Matrices

  11. wheat --DPNKPKRAMTSFVFFMSEFRSEFKQKHSKLKSIVEMVKAAGER | | |||||||| || | ||| ||| | |||| |||| ????? KKDSNAPKRAMTSFMFFSSDFRS----KHSDL-SIVEMSKAAGAA -DoesNOTprovide us with an ALIGNMENT Dot Matrices Limits -Visual aid -Best Way to EXPLORE the Sequence Organisation

  12. Using Dynamic Programming To Align Sequences

  13. Our Scope Understanding the DP concept Coding a Global and a Local Algorithm Aligning with Affine gap penalties Saving memory Sophisticated variants…

  14. Outline -Coding Dynamic Programming with Non-affine Penalties -Turning a global algorithm into a local Algorithm -Adding affine penalties -Using A Divide and conquer Strategy -Tailoring DP to your needs: -The repeated Matches Algorithm -Double Dynamic Programming

  15. Global Alignments Without Affine Gap penalties Dynamic Programming

  16. How To align Two Sequences With a Gap Penalty, A Substitution matrix and Not too Much Time Dynamic Programming

  17. A bit of History… -DP invented in the 50s by Bellman -Programming  Tabulation -Re-invented in 1970 by Needlman and Wunsch -It took 10 year to find out…

  18. The Foolish Assumption The score of each column of the alignment is independent from the rest of the alignment It is possible to model the relationship between two sequences with: -A substitution matrix -A simple gap penalty

  19. The Principal of DP X - Deletion ? ? X- XX XXXX X X + Alignment - X Insertion If you extend optimally an optimal alignment of two sub-sequences, the result remains an optimal alignment

  20. Finding the score of i,j -Sequence 1: [1-i] -Sequence 2: [1-j] -The optimal alignment of [1-i] vs [1-j] can finish in three different manners: - X X X X -

  21. Finding the score of i,j 1… i 1…j-1 - j + Three ways to buildthe alignment 1…i 1…j 1…i-1 1…j-1 i j + 1…i-1 1… j i - +

  22. Finding the score of i,j 1…i 1…j In order to Compute the score of All we need are the scores of: 1….i 1…j-1 1…i-1 1….j 1…i-1 1…j-1

  23. Formalizing the algorithm 1….i 1…j-1 - X + F(i-1,j) + Gap 1…i-1 1…j-1 X X F(i,j)= best F(i-1,j-1) + Mat[i,j] + F(i,j-1) + Gap 1…i-1 1…j X - +

  24. - F A T - F A S T Arranging Everything in a Table 1…I-1 1…J-1 1…I 1…J-1 1…I-1 1…J 1…I 1…J

  25. Taking Care of the Limits The DP strategy relies on the idea that ALL the cells in your table have the same environment… This is NOT true of ALL the cells!!!! In a Dynamic Programming strategy, the most delicate part is to take care of the limits: -what happens when you start -what happens when you finish

  26. Filing Up The Matrix

  27. F - FA-- FAT--- -1 -2 -3 -1 F - -2 FA-- -3 FAS--- Taking Care of the Limits - F A T - 0 F A S Match=2 MisMatch=-1 Gap=-1 T -4

  28. Match=2 MisMatch=-1 Gap=-1 - F A T - -1 -2 -3 -2 0 -3 -1 +1 +2 +2 -4 0 +3 +2 -1 F -1 +2 -3 -2 -3 0 0 +4 -4 -1 +3 +5 -2 +2 +5 +4 +1 +3 +3 0 +1 -1 0 +2 +3 -2 +1 0 +3 -4 -1 -3 0 -5 +1 -2 +2 A -2 S -3 T -4 0

  29. Delivering the alignment: Trace-back A A F F S - T T Score of 1…3 Vs 1…4  Optimal Aln Score

  30. Trace-back: possible implementation while (!($i==0 && $j==0)) { if ($tb[$i][$j]==$sub) #SUBSTITUTION { $alnI[$aln_len]=$seqI[--$i]; $alnJ[$aln_len]=$seqJ[--$j]; } elsif ($tb[$i][$j]==$del) #DELETION { $alnI[$aln_len]='-'; $alnJ[$aln_len]=$seqJ[--$j]; } elsif ($tb[$i][$j]==$ins) #INSERTION { $alnI[$aln_len]=$seqI[0][--$i]; $alnJ[$aln_len]='-'; } $aln_len++; }

  31. Local Alignments Dynamic Programming

  32. The Smith and Waterman Algorithm 1…i 1…j-1 - X + F(i-1,j) + Gep 1…i-1 1…j-1 X X F(i-1,j-1) + Mat[i,j] + F(i,j-1) + Gep 1…i-1 1…j X - + 0 F(i,j)= best

  33. Filing Up a SW Matrix 0

  34. Filling up a SW matrix: borders Easy:Local alignments NEVER start/end with a gap… * - A N I C E C A T- 0 0 0 0 0 0 0 0 0 C 0A 0 T 0A 0 N 0 D 0 O 0 G 0

  35. Filing Up a SW Matrix 0

  36. Filling up a SW matrix * - A N I C E C A T- 0 0 0 0 0 0 0 0 0 C 00 0 0 2 0 2 0 0 A 02 0 0 0 0 0 4 0T 00 0 0 0 0 0 2 6A 0 2 0 0 0 0 0 0 4N 0 0 4 2 0 0 0 0 2D 0 0 2 2 0 0 0 0 0O 0 0 0 0 0 0 0 0 0G 0 0 0 0 0 0 0 0 0 Best Local score  Beginning of the trace-back Match=2 MisMatch=-1 Gap=-1

  37. for ($i=1; $i<=$len0; $i++) { for ($j=1; $j<=$len1; $j++) { if ($res0[0][$i-1] eq $res1[0][$j-1]){$s=2;} else {$s=-1;} $sub=$mat[$i-1][$j-1]+$s; $del=$mat[$i ][$j-1]+$gep; $ins=$mat[$i-1][$j ]+$gep; if ($sub>$del && $sub>$ins && $sub>0) {$smat[$i][$j]=$sub;$tb[$i][$j]=$subcode;} elsif($del>$ins && $del>0 ) {$smat[$i][$j]=$del;$tb[$i][$j]=$delcode;} elsif( $ins>0 ) {$smat[$i][$j]=$ins;$tb[$i][$j]=$inscode;} else {$smat[$i][$j]=$zero;$tb[$i][$j]=$stopcode;} if ($smat[$i][$j]> $best_score) { $best_score=$smat[$i][$j]; $best_i=$i; $best_j=$j; } } } TurningNW into SW PrepareTrace back

More Related