-
Notifications
You must be signed in to change notification settings - Fork 2
/
dotplot.sty
61 lines (55 loc) · 1.76 KB
/
dotplot.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{tikz}
\RequirePackage{ifthen}
\RequirePackage{blosum62}
\ProvidesPackage{dotplot}[2016/02/10 dotplot package]
\newcommand{\seqa}{A}
\newcommand{\seqb}{A}
\newcommand{\dotplot}[2]{%
\renewcommand{\seqa}{#1}
\renewcommand{\seqb}{#2}
\begin{tikzpicture}[
match/.style={rectangle, draw=black!100, fill=blue!35, minimum size=0.5cm},
scale=0.5
]
%\foreach \x [count=\xi] in {a, b, c, d, e, f, g, h} \node[draw] at (\xi, 1) {\x};
\foreach \charA [count=\xi] in \seqa
{%
\node[] at (\xi+1, 1) {\charA};
\foreach \charB [count=\yi] in \seqb
{%
\draw (0.5,-\yi+1.5) -- (\xi+1.5,-\yi+1.5);
\draw (\xi+0.5, +1.5) -- (\xi+0.5,-\yi+0.5);
\ifnum\xi=1
\node[] at (1, -\yi+1) {\charB};
\fi
\ifthenelse{\equal{\charA}{\charB}}{%
\node [match] at (\xi+1,-\yi+1) {};
}{}
}
}
\end{tikzpicture}
}
\newcommand{\protdotplot}[2]{%
\renewcommand{\seqa}{#1}
\renewcommand{\seqb}{#2}
\begin{tikzpicture}[
match/.style={rectangle, draw=black!100, fill=blue!35, minimum size=0.5cm},
scale=0.5
]
%\foreach \x [count=\xi] in {a, b, c, d, e, f, g, h} \node[draw] at (\xi, 1) {\x};
\foreach \charA [count=\xi] in \seqa
{%
\node[] at (\xi+1, 1) {\charA};
\foreach \charB [count=\yi] in \seqb
{%
%\draw (0.5,-\yi+1.5) -- (\xi+1.5,-\yi+1.5);
%\draw (\xi+0.5, +1.5) -- (\xi+0.5,-\yi+0.5);
\ifnum\xi=1
\node[] at (1, -\yi+1) {\charB};
\fi
\node [match, fill=blue!\the\numexpr(\blosumLookup{\charA}{\charB}+4)*11\relax] at (\xi+1,-\yi+1) {};
}
}
\end{tikzpicture}
}