Here, we make the plot of the response of an incoherent fead-forward loop (I1-FFL). The IPython notebook may be downloaded here.
First thing's first. Let's import the necessary modules to do the computation.
# Import necessary modules
import numpy as np
from scipy.integrate import odeint
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style('ticks')
%matplotlib inline
The incoherent feed-forward loop is shown below.
The input, X, activates Y and Z, and Y represses Z. A dimensionless set of differential equations describing an I1-FFL network motif is
\begin{align} \dot{y}&=F-y,\\[1em] \dot{z} &= \frac{1}{r}\left(\frac{F}{y}-z\right), \end{align}where $F$ is the fold change in the input X and $r$ is the ratio of the degradation rates of species Y and Z. The variables $y$ and $z$ represent the dimensionless concentrations of species Y and Z.
Assume that for $t < 0$, we have $F = 2$. For $t \ge 0$, we have $F = 4$. Assuming steady state for $t < 0$, we have $y_\mathrm{ss} = 2$ and $z_\mathrm{ss} = 1$. We can solve the first ODE analytically for $y(t)$, but we can easily solve these coupled equations using odeint
, which we will do for illustrative purposes.
def rhs(yz, t, F, r):
"""
Right hand side of system of ODEs describing I1-FFL.
"""
y, z = yz
return np.array([F - y, (F / y - z) / r])
# Time points we want for the solution
t = np.linspace(0, 4, 1000)
# Initial condition
yz_0 = np.array([2.0, 1.0])
# Parameters
F = 4.0
r = 0.1
# Integrate ODES
yz = odeint(rhs, yz_0, t, args=(F, r))
With the results in hand, we can generate our plots.
# Pluck out y and z
y, z = yz.transpose()
# Append the pre-fold change steady state
t = np.insert(t, 0, -1.0)
y = np.insert(y, 0, 2.0)
z = np.insert(z, 0, 1.0)
# Generate x
x = 2.0 + 2.0 * (t > 0.0).astype(np.float)
# Plot the results
fig, ax = plt.subplots(1, 1)
ax.plot(t, x, '-')
ax.plot(t, y, '-')
ax.plot(t, z, '-')
ax.set_xticks([])
ax.set_yticks([])
ax.margins(0.02)
ax.set_xlabel('time', x=1, fontsize=14)
ax.set_ylabel('level', rotation=0, fontsize=14)
ax.yaxis.set_label_coords(-0.05, 0.95)
sns.despine(offset=0.1)
plt.savefig('fig.pdf', bbox_inches='tight', transparent=True)