Vous voulez faire découvrir la programmation dynamique à des lycéens ? Rien de mieux qu’une petite présentation… En bon geek, vous allez la faire en latex. Mais pour ça, il va falloir connaître quelques ficelles, surtout quand on veut pouvoir représenter la façon dont on remplit la matrice, pas à pas:
\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{verbatim}
\usepackage{url}</code>
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{footline}[page number]
\title{About optimal sequence alignment}
\subtitle{A short glimpse into bioinformatics}
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\begin{frame}
\frametitle{Pairwise sequence alignment}
Assumptions:
\begin{itemize}
\item sequences $S_1$ and $S_2$ are homologous, they share a common ancestor;
\item differences between them are due to only two kinds of events, substitutions and insertion-deletions.
\end{itemize}
Strategy:
\begin{itemize}
\item choose a scoring matrix (reward for match, penalty for mismatch and gap);
\item compute the editing distance (number of matches, mismatches and gaps) to go from one sequence to the other;
\item keep the alignment with the highest score.
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Needleman-Wunsch algorithm}
\begin{itemize}
\item Aim: find the optimal global alignment of sequences $S_1$ and $S_2$
\item Recursion rule:
\begin{align}
D(i,j) = max
\begin{cases}
D(i-1,j-1) + score( S_1[i], S_2[j] )\\
D(i-1,j) + gap\\
D(i,j-1) + gap
\end{cases}
\end{align}
\item Scoring scheme: identity=0 transition=-2 transversion=-5 gap=-10
\item Sequences: $S_1$=TTGT $S_2$=CTAGG
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Fill the matrix}
\begin{tabular}{l|cccccccccccc}
& & & C & & T & & A & & G & & G \\ \hline
& & & & & & & & & & & & \\
& \visible{0} & \visible{$\rightarrow$} & \visible{-10} & \visible{$\rightarrow$} & \visible{-20} & \visible{$\rightarrow$} & \visible{-30} & \visible{$\rightarrow$} & \visible{-40} & \visible{$\rightarrow$} & \visible{-50} \\
& \visible{$\downarrow$} & \visible{$\searrow$} & \visible{$\downarrow$} & \visible{$\searrow$} & \visible{$\downarrow$} & \visible{$\searrow$} & \visible{$\downarrow$} & \visible{$\searrow$} & \visible{$\downarrow$} & \visible{$\searrow$} & \visible{$\downarrow$} & \\
T & \visible{-10} & \visible{$\rightarrow$} & \visible{-2} & \visible{$\rightarrow$} & \visible{-10} & \visible{$\rightarrow$} & \visible{-20} & \visible{$\rightarrow$} & \visible{-30} & \visible{$\rightarrow$} & \visible{-40} \\
& \visible{$\downarrow$} & \visible{$\searrow$} & \visible{$\downarrow$} & \visible{$\searrow$} & \visible{$\downarrow$} & \visible{$\searrow$} & \visible{$\downarrow$} & \visible{$\searrow$} & \visible{$\downarrow$} & \visible{$\searrow$} & \visible{$\downarrow$} & \\
T & \visible{-20} & \visible{$\rightarrow$} & \visible{-12} & \visible{$\rightarrow$} & \visible{-2} & \visible{$\rightarrow$} & \visible{-12} & \visible{$\rightarrow$} & \visible{-22} & \visible{$\rightarrow$} & \visible{-32} & \\
& \visible{$\downarrow$} & \visible{$\searrow$} & \visible{$\downarrow$} & \visible{$\searrow$} & \visible{$\downarrow$} & \visible{$\searrow$} & \visible{$\downarrow$} & \visible{$\searrow$} & \visible{$\downarrow$} & \visible{$\searrow$} & \visible{$\downarrow$} & \\
G & \visible{-30} & \visible{$\rightarrow$} & \visible{-22} & \visible{$\rightarrow$} & \visible{-12} & \visible{$\rightarrow$} & \visible{-4} & \visible{$\rightarrow$} & \visible{-12} & \visible{$\rightarrow$} & \visible{-22} & \\
& \visible{$\downarrow$} & \visible{$\searrow$} & \visible{$\downarrow$} & \visible{$\searrow$} & \visible{$\downarrow$} & \visible{$\searrow$} & \visible{$\downarrow$} & \visible{$\searrow$} & \visible{$\downarrow$} & \visible{$\searrow$} & \visible{$\downarrow$} & \\
T & \visible{-40} & \visible{$\rightarrow$} & \visible{-32} & \visible{$\rightarrow$} & \visible{-22} & \visible{$\rightarrow$} & \visible{-14} & \visible{$\rightarrow$} & \visible{-9} & \visible{$\rightarrow$} & \visible{-17} &
\end{tabular}
\end{frame}
\begin{frame}
\frametitle{Traceback}
\begin{tabular}{l|cccccccccccc}
& & & C & & T & & A & & G & & G \\ \hline
& & & & & & & & & & & & \\
& \color{red}{0} & $\rightarrow$ & -10 & $\rightarrow$ & -20 & $\rightarrow$ & -30 & $\rightarrow$ & -40 & $\rightarrow$ & -50 \\
& $\downarrow$ & \color{red}{$\searrow$} & $\downarrow$ & $\searrow$ & $\downarrow$ & $\searrow$ & $\downarrow$ & $\searrow$ & $\downarrow$ & $\searrow$ & $\downarrow$ & \\
T & -10 & $\rightarrow$ & \color{red}{-2} & $\rightarrow$ & -10 & $\rightarrow$ & -20 & $\rightarrow$ & -30 & $\rightarrow$ & -40 \\
& $\downarrow$ & $\searrow$ & $\downarrow$ & \color{red}{$\searrow$} & $\downarrow$ & $\searrow$ & $\downarrow$ & $\searrow$ & $\downarrow$ & $\searrow$ & $\downarrow$ & \\
T & -20 & $\rightarrow$ & -12 & $\rightarrow$ & \color{red}{-2} & \color{red}{$\rightarrow$} & \color{red}{-12} & $\rightarrow$ & -22 & $\rightarrow$ & -32 & \\
& $\downarrow$ & $\searrow$ & $\downarrow$ & $\searrow$ & $\downarrow$ & $\searrow$ & $\downarrow$ & \color{red}{$\searrow$} & $\downarrow$ & $\searrow$ & $\downarrow$ & \\
G & -30 & $\rightarrow$ & -22 & $\rightarrow$ & -12 & $\rightarrow$ & -4 & $\rightarrow$ & \color{red}{-12} & $\rightarrow$ & -22 & \\
& $\downarrow$ & $\searrow$ & $\downarrow$ & $\searrow$ & $\downarrow$ & $\searrow$ & $\downarrow$ & $\searrow$ & $\downarrow$ & \color{red}{$\searrow$} & $\downarrow$ & \\
T & -40 & $\rightarrow$ & -32 & $\rightarrow$ & -22 & $\rightarrow$ & -14 & $\rightarrow$ & -9 & $\rightarrow$ & \color{red}{-17} &
\end{tabular}
\end{frame}
\begin{frame}[fragile]
\frametitle{Output}
Plot the optimal alignment:
\begin{verbatim}
CTAGG
*| |*
TT-GT
\end{verbatim}
Score: -17
Complexity in time: $O(nm)$
Complexity in memory: $O(nm)$
\end{frame}
\begin{frame}
\frametitle{Acknowledgments}
Bellman; Levenstein; Needleman and Wunsch; Sankoff and Sellers; Hirschberg; Smith and Waterman; Gotoh; Ukkonen, Myers and Fickett; and many others...
\vspace{1cm}
Want to know more? start reading!
\url{http://lectures.molgen.mpg.de/online_lectures.html}
\end{frame}
\end{document}

Publié par walrus 






Je précise que cette méthode marche aussi pour les protéines, simplement, au lieu que l’alphabet soit de 4 lettres {A;T;G;C}, il est de 20 lettres, une par acides aminés. De plus, la comparaison de deux séquences peut avoir plusieurs alignements optimaux. Et pour finir d’expliquer le titre, on parle ici d’alignement global parce qu’on essaie d’aligner les deux séquences sur toute leur longueur. Vous vous en doutez, il existe aussi l’alignement local…
