Wednesday, May 8, 2013

Drawing Pathways with Tikz

Originally Posted on  by hsauro

I had the need to draw a negative feedback around a linear pathway. Normally I would use a vector drawing packages to do this, such as Illustrator or Inkscape. This time I thought I would try the tikz package that allows one to embed diagrams inside LaTeX files in script form. The tikz manual is an excellent source of ideas and in one section they show how to draw syntax diagrams (Section 5, page 60). I re-purposed some of this code to draw the following pathway with a negative feedback:

To draw this diagram I used the following code. The code is split into fours sections. The header and three coding sections. The first coding section places and names the four species nodes. Naming nodes is very used later on. The second section draws the reaction arrows and the final section draws the negative feedback loop. The header specifies the type of arrow that will be used, >=latex’ which is the latex arrow (See section 23, page 256 for more choices of arrows), and the distance between nodes. See the comments in the code to understand how the feedback loop was made.

\begin{tikzpicture}[>=latex', node distance=2cm]

\node (Xo) {\Large $X_o$};
\node [right of = Xo] (S1) {\Large $S_1$};
\node [right of = S1] (S2) {\Large $S_2$};
\node [right of = S2] (X1) {\Large $X_1$};

\draw [->,ultra thick,blue] (Xo) -- node[above, black] {$v_1$} (S1);
\draw [->,ultra thick,blue] (S1) -- node[above, black] {$v_2$} (S2);
\draw [->,ultra thick,blue] (S2) -- node[above, black] {$v_3$} (X1);

% Lets draw a line with a blunt end, -|
\draw [-|,ultra thick,blue]
% start in the middle of S2, and move down 2.75 mm 
% ($ ... $) notation is used to add the coordinates
($ (S2) + (0mm,-2.75mm) $)
% Now draw the line down by 3mm
% -- means draw to, + means move by 
-- +(0,-3mm)
% Now move back to the left of S2
% The symbol -| means draw horizontal then vertical. 
% If we used -- instead the line would be drawn 
% diagonally to the reaction edge.
% (S1) is the center of the node. But we want the
% blunt end to end below the S1 line and
% half way to the left. The 10mm is half the node
% distance of 2cm, and 1mm is slightly below  
% the reaction line.
-| ($ (S1) - (10mm,1mm) $);


1 comment:

Unknown said...

Dear Professor Sauro,
I came across this post searching for more information on the model shown in this figure: in
Sauro, H. M., & Kholodenko, B. N. (2004). Quantitative analysis of signaling networks.

I am struggling to find the rate laws and parameters used there to get the time course shown in the figure. Would you maybe happen to remember these details? I would like to use this example in teaching, to illustrate the effect of negative feedback. Your input would be much appreciated.

Thank you and best wishes,
Eva Geissen