sequence-algorithms/figures/part1/motif_search_automaton.tex

43 lines
1.3 KiB
TeX
Raw Permalink Normal View History

2024-03-15 09:16:50 +01:00
\documentclass[tikz]{standalone}
\usepackage{tikz}
\begin{document}
\usetikzlibrary{automata,positioning}
\iffalse
Let $M = $ ACACT be a motif.
$\Sigma = \{ACT\}$
\fi
\begin{tikzpicture}[shorten >=1pt,node distance=2cm,on grid, auto]
% TODO
\node[state, initial] (q_0) {$q_{0}$};
\node[state,right=of q_0] (q_1) {$q_{1}$};
\node[state,right=of q_1] (q_2) {$q_{2}$};
\node[state,right=of q_2] (q_3) {$q_{3}$};
\node[state,right=of q_3] (q_4) {$q_{4}$};
\node[state,right=of q_4,accepting] (q_5) {$q_{5}$};
% M itself
\path[->] (q_0) edge node {A} (q_1)
(q_1) edge node {C} (q_2)
(q_2) edge node {A} (q_3)
(q_3) edge node {C} (q_4)
(q_4) edge node {T} (q_5);
% Make it complete so that it recognize all motif in the sequence
\path[->] (q_0) edge[loop above] node {C, T} (q_1);
\path[->] (q_1) edge[loop above] node {A} (q_1);
\path[->] (q_1) edge[bend left=30] node {T} (q_0);
\path[->] (q_2) edge[bend left=30] node {C, T} (q_0);
\path[->] (q_3) edge[bend right=30] node[above] {A} (q_1);
\path[->] (q_3) edge[bend left=40] node {T} (q_0);
\path[->] (q_4) edge[bend right=50] node[above] {A} (q_3);
\path[->] (q_4) edge[bend left=40] node {C} (q_0);
\path[->] (q_5) edge[bend right=40] node[above] {A} (q_1);
\path[->] (q_5) edge[bend left=50] node {C,T} (q_0);
\end{tikzpicture}
\end{document}