sbgntikz is a TikZ library that allows drawing SBGN maps directly into LaTeX using the powerfull TikZ package. All three SBGN languages (PD, AF and ER) are supported. A complete documentation for the latest version is available here, as well as a set of examples.
The directory tikz-sbgn
should be copied to a directory where it can be found by your TeX engine:
-
to the directory of your TeX source file or
-
to a local
texmf
directory, whose location depends on the OS you are using:- Linux: to
/home/<user>/texmf/tex/generic/pgf/
. The index must then be updated using thetexhash /home/<user>/texmf
command. - MacOs: to
/Users/Library/texmf/tex/generic/pgf/
. - Windows: to
C:\Users\<user>\texmf\tex\generic\pgf\
.
In all cases, the
texmf
directory has to be created if it does not already exist. In the case you are using MikTeX, you will need to add this directory to the TEXMF root directories in theDirectories
tab of theSettings
page. - Linux: to
TikZ should already be installed within your TeX distribution. If not, you may install it via your TeX distribution, or download the latest build here.
sbgntikz is a TikZ package. Usually, TikZ is installed within your TeX distribution, so it can be imported directly into your LaTeX source file. The two first steps are to import the TikZ package and the sbgntikz library:
\usepackage{tikz}
\usetikzlibrary{sbgn}
SBGN maps can then be straightforwardly drawn using a tikzpicture
environment together with the sbgn
key:
\begin{tikzpicture}[sbgn]
% tikz code to draw an SBGN map
\end{tikzpicture}
Nodes and nodes attributes can be drawn using the TikZ \node
command, while arcs can be drawn using the \draw
command.
The type of glyph to be drawn is specified using a keyword that is the name of the type (e.g macromolecule
for the macromolecule glyph, necessary stimulation
for the necessary stimulation glyph).
Here is a small SBGN PD example:
\usetikzlibrary{positioning} %for relative positioning
\begin{tikzpicture}[sbgn]
%ERK
\node[macromolecule] (erk) {ERK};
\node[sv] at (erk.120) {};
%process
\node[generic process, connectors = horizontal, right = of erk] (p) {};
%p-ERK
\node[macromolecule, right = of p] (perk) {ERK};
\node[sv] at (perk.120) {P};
%atp
\node[simple chemical, below left = of p] (atp) {ATP};
%adp
\node[simple chemical, below right = of p] (adp) {ADP};
%p-MEK
\node[macromolecule, above = 2cm of p] (pmek) {MEK};
\node[sv] at (pmek.120) {P};
%arcs
\draw[consumption] (erk) -- (p.west);
\draw[consumption] (atp) to [bend left=40] (p.west);
\draw[production] (p.east) -- (perk);
\draw[production] (p.east) to [bend left=40] (adp);
\draw[catalysis] (pmek) -- (p);
\end{tikzpicture}
Here is the rendering:
All features offered by default in TikZ and by additional TikZ libraries (such as the positioning and fit libraries) are compatible with sbgntikz. You may refer to the documentation for a list of features that might be useful to easily customize SBGN maps (such as colors, size of the glyphs, ...).
SBGNTikZ includes an SBGN-ML to TikZ converter. Basic usage is as follows:
sbgnml2tikz.py [options] INPUT
All options can be listed using the following:
sbgnml2tikz.py --help
Examples of rendering using the converter are available here.