(also published in my blog)
Reaction networks are models of (bio)chemical systems in which chemical species are interconverted through the action of chemical reactions. Typically, a reaction network is represented by its stoichiometrix matrix
Suppose that we are interested in evaluating the concentration dynamics of the chemical species in a homogeneous chemical system. We can model that with a system of ordinary differential equations:
with
That is, the flux
Reaction kinetics are crucial to investigate chemical dynamics. Unfortunately, the parameterization of such systems is not straighforward. Oftentimes, a large fraction of parameter values are not accessible, which makes their investigation complicated. However, in such escenarios, it may still be possible to evaluate how network and stoichiometric constraints affect concentration dynamics. Specifically, we can apply constraint-based modeling techniques to the linear system in eq \ref{eq:1}.
In constraint-based metabolic modeling, a steady-state scenario is typically assumed, i.e, we have
In eq \ref{eq:3} a linear function of the reaction fluxes
Putting together the previous ideas, we arrive at the LP:
In LP \ref{eq:4}, we maximize the sum of linear function of the concentrations,
Solving LP \ref{eq:4} will render a single optimal solution. However, the system will most likely be proned to host a space of alternative optimal solutions, a situaltion that is common in constraint-based metabolic modeling setups. We can explore the space of alternative optimal concentration trajectories in two ways. On the one hand, we can compute the minimum and maximum concentration values for each chemical species along the trajectory. On the other hand, we can randomly sample the space of alternative optimal concentration trajectories, e.g, to conduct statistical analyses on them.
First, let's adapt LP \ref{eq:4} to compute the concentration bounds along the trajectory. Specifically, we need to solve the following two LPs for each
$$ \begin{align} \begin{aligned} & x^{\mathrm{min}}{it},; x^{\mathrm{max}}{it} = \min_{v_t,\dot x_t,x_t} x_{it}, ;\max_{v_t,\dot x_t,x_t} x_{it} \ &\mathrm{s.t.} \ &1.;Sv_t = \dot x_t \ &2.;x_{t+1} = x_t + \dot x_t \ &3.;v^{lb}_t \leq v_t \leq v^{ub}_t \ &4.;\dot x^{lb}_t \leq \dot x_t \leq \dot x^{ub}t \ &5.;x_t \geq 0 \ &6.;\sum{t,=,0}^{t_f}\phi(x_t) = Z \ &t = {0,...,t_f}, \end{aligned} \label{eq:5} % \tag{5} \end{align} $$$
where
$$ \begin{align} \begin{aligned} &\min_{\substack{v_t,\dot x_t,x_t,\ \epsilon_t^+,\epsilon_t^-}} \sum_{i=1}^{m} \sum_{t=0}^{t_f+1} (\epsilon_{it}^+ + \epsilon_{it}^-) \ &\mathrm{s.t.} \ &1.;Sv_t = \dot x_t \ &2.;x_{t+1} = x_t + \dot x_t \ &3.;v^{lb}t \leq v_t \leq v^{ub}t \ &4.;\dot x^{lb}t \leq \dot x_t \leq \dot x^{ub}t \ &5.;x_t \geq 0 \ &6.;\sum{t,=,0}^{t_f}\phi(x_t) = Z \ &7.;x{t} - x{\mathrm{rand}t} = \epsilon{t}^+ - \epsilon{t}^- \ &8.;\epsilon_t^+,;\epsilon_{t}^+ \geq 0 \ &t = {0,\dots,t_f}. \end{aligned} \label{eq:6} % \tag{6} \end{align} $$
We just need to repeat the process of generating
Let's exemplify the methods presented in the previous section with the following chemical network:
with chemical species,
We will use LPs \ref{eq:4},\ref{eq:5},\ref{eq:6} to explore the alternative optimal space resulting from maximizing the total concentration, i.e., sum over all time steps, of species
import numpy as np
from networkflow import NetworkFlow
S = np.array([
[-1,0,0,-1,0],
[-1,0,0,0,0],
[2,-1,1,0,-1],
[0,1,0,0,0],
[0,0,-1,1,1],
[0,1,0,0,0]
])
var_names = ['A', 'B', 'C', 'D', 'E', 'F']
flux_names=['v1', 'v2', 'v3', 'v4', 'v5']
# Define initial conditions
var_x0 = [10, 5, 5, 1, 2, 2]
Network = NetworkFlow(S, obj_x='C', n_steps=100,
x_names=var_names, x_0=var_x0,
xp_min=-10, xp_max=10, v_names=flux_names,
v_delta_max=0.1)
Network.solve(verbose=False)
Network.findAlternativeOptimaBounds()
Network.sampleAlternativeOptimaSpace(n_samples=500)
Network.plotXSolution('A')
Network.plotXSolution('B')
Network.plotXSolution('C')
Network.plotXSolution('D')
Network.plotXSolution('E')
Network.plotXSolution('F')
The figures above show the minimum and maximum concentration bounds, depicted in blue and red, respectively, as well as a random sample of optimal trajectories, light gray, and their average, dark gray, for all five chemical species in our example network — remember that in this esceneraio we were optimizing the sum over time steps of the concentration of species
We observe that some species show more constrained trajectories than others. Specifically, species
If you use this software, please cite it as below:
Semidán Robaina Estévez. (2022). Netflowpy: exploring network constraints on concentration dynamics in Python (Version 0.0.1). Zenodo. https://doi.org/10.5281/zenodo.7018381