Metabolic Networks
Biochemical pathways of metabolism
\[ A \begin{array}{c} _{k}\\ \rightarrow \\ ^{}\end{array} B \tag{1}\]
\[ v=\frac{dy}{dx}=-\frac{dA}{dt}=\frac{dB}{dt} \tag{2}\]
\[ \frac{dA}{dt}= -k*A;\\ \frac{db}{dt} = k*B \tag{3}\]
\[ dA=-k*A*dt;\\ dB=k*A*dt \tag{4}\]
Some differential equations can be solved analytically, such as those involving bacterial exponential growth:
\[ \frac{dN}{dt}=-k*N; \, N(t) = N_0*e^{-kt}; (N=N_0 \,em \, t=0) \tag{5}\]
Numerical solution for a system of differential equations
R
(deSolve
, pracma
, lsoda
), some simple systems can be solved using the basic installation packages:The simplest procedure uses the Euler method. The basic idea of the method consists of integrating a differential function of infinitesimal variation in the independent variable (in this case, time), for a real relation, and from given initial values. Simply put, the value of the function will correspond to the increase of the increment dy for each interval dx, from the relation of each reaction involved in the transformation of the compounds. Example for the reactions present in Equation 4:
# Solution of differential equations for conversion A-->B
<- 0.5 # kinetic constant of catalysis
k <- .005
dt <- 3 # time interval & maximum time
tmax <- seq(0, tmax, dt) # time vector
t <- tmax / dt + 1 # no. of simulation points (it is necessary to add 1 so that the vectors have the same size)
n <- matrix(rep(0, 2 * n), nrow = 2, ncol = n) # construction of the matrix of one row for each compound, and one column for each time dt
x 1, 1] <- 1
x[2, 1] <- 0 # initial concentration values
x[for (i in 2:n) {
<- -k * x[1, i - 1] * dt # dA
dA <- k * x[1, i - 1] * dt # dB
dB 1, i] <- x[1, i - 1] + dA # variation in A with increase in dA x[2, i] <- x[2, i - 1] + dB # variation in B with increase in dB # loop that adds the value of the new content to each interval dt composite
x[
}plot(t, x[1, ],
type = "l", lty = 1,
xlab = "time, s", ylab = "[species], M", ylim = c(0, 1.025),
bty = "l"
# plot of composite 1
) lines(t, x[2, ], lty = 2, col = 2) # add plot of composite 2
legend(
x = 2, 5, y = 1, legend = c("A", "B"), col = c(1, 2),
cex = 1, lty = c(1, 2)
)
\[ A \begin{array}{c} _{k}\\ \rightleftharpoons\\ ^{km} \end{array} B \tag{6}\]
\[ dA=-k*A*dt+km*B*dt;\\ dB=k*A*dt-km*B*dt \tag{7}\]
R
:<- 0.5
k <- 0.5 # kinetic constants of catalysis
km <- .005
dt <- 10 # time interval & maximum time
tmax <- seq(0, tmax, dt) # define time vector
t <- tmax / dt + 1 # define no. of points
n <- matrix(rep(0, 2 * n), nrow = 2, ncol = n) # build a matrix with one
x # row for each compound, and one column for each time dt
1, 1] <- 1
x[2, 1] <- 1 # initial concentration values
x[for (i in 2:n) {
<- -k * x[1, i - 1] * dt + km * x[2, i - 1] * dt
dA <- k * x[1, i - 1] * dt - km * x[2, i - 1] * dt
dB 1, i] <- x[1, i - 1] + dA
x[2, i] <- x[2, i - 1] + dB
x[# loop that adds to each interval dt the new concentration value for
# each compound
}plot(t, x[1, ],
type = "l", lty = 1,
xlab = "time, s", ylab = "[species], M", ylim = c(0, 2), bty = "l"
# graph of compound 1
) lines(t, x[2, ], lty = 2, col = 2) # addition of graph of compound 2
legend(
x = 2, 5, y = 2, legend = c("A", "B"), col = c(1, 2), cex = 1,
lty = c(1, 2)
)
# Example of conversion A-->B
<- 0.5
k <- 0.1 # kinetic constants of catalysis
km <- .005
dt <- 10 # time interval & maximum time
tmax <- seq(0, tmax, dt) # define time vector
t <- tmax / dt + 1 # define no. of points
n <- matrix(rep(0, 2 * n), nrow = 2, ncol = n) # build matrix of
x # one row for each compound, and one column for each time dt
1, 1] <- 1
x[2, 1] <- 0.2 # initial concentration values
x[for (i in 2:n) {
<- -k * x[1, i - 1] * dt + km * x[2, i - 1] * dt
dA <- k * x[1, i - 1] * dt - km * x[2, i - 1] * dt
dB 1, i] <- x[1, i - 1] + dA
x[2, i] <- x[2, i - 1] + dB
x[# loop that adds to each interval dt the new concentration value for
# each compound
}plot(t, x[1, ],
type = "l", lty = 1,
xlab = "time, s", ylab = "[species], M", ylim = c(0, 2), bty = "l"
# graph of compound 1
) lines(t, x[2, ], lty = 2, col = 2) # addition of graph of compound 2
legend(x = 2, 5, y = 2, legend = c("A", "B"), col = c(1, 2), cex = 1, lty = c(1, 2))
\[ A \begin{array}{c} _{k1}\\ \rightleftharpoons\\ ^{km1} \end{array} B \begin{array}{c} _{k2}\\ \rightarrow \\ ^{}\end{array}C \tag{8}\]
\[ dA=-k1*A*dt+km1*B*dt;\\ dB=k1*A*dt-km1*B*dt-k2*B*dt;\\ dC=k2*B \tag{9}\]
# Euler solution for 3-compound kinetics
<- 0.5
k1 <- 0.1
km1 <- 1 # kinetic constants of catalysis
k2 <- .005
dt <- 3 # time interval & maximum time
tmax <- seq(0, tmax, dt) # define time vector
t <- tmax / dt + 1 # define no. of points
n <- matrix(rep(0, 3 * n), nrow = 3, ncol = n) # build matrix of
x # one row for each compound, and one column for each time dt
1, 1] <- 1
x[2, 1] <- 0
x[3, 1] <- 0 # initial concentration values
x[for (i in 2:n) {
<- -k1 * x[1, i - 1] * dt + km1 * x[2, i - 1] * dt
dA <- k1 * x[1, i - 1] * dt - (km1 + k2) * x[2, i - 1] * dt
dB <- k2 * x[2, i - 1] * dt
dC 1, i] <- x[1, i - 1] + dA
x[2, i] <- x[2, i - 1] + dB
x[3, i] <- x[3, i - 1] + dC # loop that adds to each interval dt
x[# the new content value for each compound
}plot(t, x[1, ],
type = "l", lty = 1,
xlab = "time, s", ylab = "[species], M", ylim = c(0, 1.025), bty = "l"
# plot of compound 1
) lines(t, x[2, ], lty = 2, col = 2) # add plot of compound 2
lines(t, x[3, ], lty = 3, col = 3) # add plot of compound 3
legend(x = 2, 5, y = 1, legend = c("A", "B", "C"), col = c(1, 2, 3),
cex = 1, lty = c(1, 2, 3))

\[ A \begin{array}{c} _{k1}\\ \rightleftharpoons\\ ^{km1} \end{array} B \begin{array}{c} _{k2}\\ \rightleftharpoons\\ ^{km2}\end{array}C \tag{10}\]
R
suggest:# Euler solution for reversible kinetics of 3 compounds
# constants of the forward reaction
<- 3
k1 <- 1
km1 <- 4
k2 <- 0.7
km2 <- .005
dt <- 10
tmax <- seq(0, tmax, dt)
t <- tmax / dt + 1
n <- matrix(rep(0, 3 * n), nrow = 3, ncol = n)
x 1, 1] <- 1
x[2, 1] <- 0
x[3, 1] <- 0
x[for (i in 2:n) {
<- -k1 * x[1, i - 1] * dt + km1 * x[2, i - 1] * dt
dA <- k1 * x[1, i - 1] * dt - (km1 + k2) * x[2, i - 1] * dt +
dB * x[3, i - 1] * dt
km2 <- k2 * x[2, i - 1] * dt - km2 * x[3, i - 1] * dt
dC 1, i] <- x[1, i - 1] + dA
x[2, i] <- x[2, i - 1] + dB
x[3, i] <- x[3, i - 1] + dC
x[
}plot(t, x[1, ],
type = "l", lty = 1,
xlab = "time, s", ylab = "[species], mol/L",
ylim = c(0, 1.025), bty = "l"
)lines(t, x[2, ], col = 2, lty = 2)
lines(t, x[3, ], col = 3, lty = 3)
legend(x = 8, y = 0.6, legend = c("A", "B", "C"), col = c(1, 2, 3),
cex = 1, lty = c(1, 2, 3))
\[ dA=-k1*A*dt+ka*F*dt;\\ dB=k1*A*dt+km3*D*dt-k3*B*dt-k2*B*dt-ki*E*dt;\\ dC=k2*B*dt;\\ \tag{11}\]
\[ dD=k3*B*dt-km3*D*dt-k4*D*dt;\\ dE=k4*D*dt-k5*E*dt;\\ dF=k5*E*dt-ka*F*dt \tag{12}\]
# Solution for metabolic pathway with allosteric inhibition and activation
# Kinetic and allosteric constants
<- 2
k1 <- 0.5
k2 <- 0.7
k3 <- 0.3
km3 <- 5
k4 <- 1
k5 <- 0.3 # inhibition constant
ki <- 0.2 # activation constant
ka <- .005
dt <- 10
tmax <- seq(0, tmax, dt)
t <- tmax / dt + 1
n <- matrix(rep(0, 6 * n), nrow = 6, ncol = n)
x # Initial values of compounds
1, 1] <- 1
x[2, 1] <- 0
x[3, 1] <- 0
x[4, 1] <- 1
x[5, 1] <- 0
x[6, 1] <- 0
x[for (i in 2:n) {
# system of equations inserted into the interval matrix
<- -k1 * x[1, i - 1] * dt + ka * x[6, i - 1] * dt
dA <- k1 * x[1, i - 1] * dt + km3 * x[4, i - 1] * dt - k3 *
dB 2, i - 1] * dt - k2 * x[2, i - 1] * dt - ki * x[1, i - 1] * dt
x[<- k2 * x[2, i - 1] * dt
dC <- k3 * x[2, i - 1] * dt - km3 * x[4, i - 1] * dt - k4 *
dD 4, i - 1] * dt
x[<- k4 * x[4, i - 1] * dt - k5 * x[5, i - 1] * dt
dE <- k5 * x[5, i - 1] * dt - ka * x[6, i - 1] * dt
dF # Adding dy to y values
1, i] <- x[1, i - 1] + dA
x[2, i] <- x[2, i - 1] + dB
x[3, i] <- x[3, i - 1] + dC
x[4, i] <- x[4, i - 1] + dD
x[5, i] <- x[5, i - 1] + dE
x[6, i] <- x[6, i - 1] + dF
x[
}# Preparation of kinetic graphs
plot(t, x[1, ],
type = "l", lty = 1,
xlab = "time,s", ylab = "[species], mol/L",
ylim = c(0, 1.025), bty = "l"
)lines(t, x[2, ], col = 2, lty = 2)
lines(t, x[3, ], col = 3, lty = 3)
lines(t, x[4, ], col = 4, lty = 4)
lines(t, x[5, ], col = 5, lty = 5)
lines(t, x[6, ], col = 6, lty = 6)
legend(x = 6.5, y = 0.65, legend = c("A", "B", "C", "D", "E", "F"),
col = c(1, 2, 3, 4, 5, 6), cex = 1, lty = c(1, 2, 3, 4, 5, 6))
R
packages, or even by systems analysis.Some reactions of glucose metabolism
deSolve
package or similar to solve a system of 1st order ordinary differential equations or partial differential equations. The library aggregates functions that allow a leaner and simpler code for solving the system. Illustrating its application, here are some of the many simple relationships of the metabolic network that involves glycolysis, gluconeogenesis, and pentose pathway in cells:\[ G6P \begin{array}{c} _{k1}\\ \rightarrow \\ ^{}\end{array} R5P\\ G3P+DHCP \begin{array}{c} _{k2}\\ \rightarrow \\ ^{}\end{array} PEP\\ 2G3P \begin{array}{c} _{k3}\\ \rightarrow \\ ^{}\end{array} 6GP\\ R5P \begin{array}{c} _{k4}\\ \rightarrow \\ ^{}\end{array} G3P\\ 2PEP \begin{array}{c} _{k5}\\ \rightarrow \\ ^{}\end{array} G6P \tag{13}\]
library(deSolve)
# Solution for conversion kinetics in some metabolic pathways
# Reaction parameters
<- 0.1
k1 <- 0.5
k2 <- 0.05
k3 <- 0.5
k4 <- 0.2
k5 <- c(k1, k2, k3, k4, k5)
parms
# Initial values for each compound
<- 1
G6P0 <- 0
R5P0 <- 0.3
G3P0 <- 0.1
DHCP0 <- 0
PEP0 # Time interval
<- 0
tmin <- 20
tmax <- 0.01
dt <- seq(tmin, tmax, dt)
time # Function for the derivatives of the species in time
<- function(time, x, parms) {
eq.dif # compound specification
<- x[1]
G6P <- x[2]
R5P <- x[3]
G3P <- x[4]
DHCP <- x[5]
PEP # differential equations
<- -k1 * G6P + k3 * G3P^2 + k5 * PEP^2
dG6P <- k1 * G6P - k4 * R5P
dR5P <- -k2 * G3P * DHCP - k3 * G3P^2 + k4 * R5P
dG3P <- -k2 * G3P * DHCP
dDHCP <- k2 * G3P * DHCP - k5 * PEP^2
dPEP list(c(dG6P, dR5P, dG3P, dDHCP, dPEP)) # increments of species
}# lsoda routine for ordinary differential solution
<- lsoda(c(G6P0, R5P0, G3P0, DHCP0, PEP0), time, eq.dif, parms,
out rtol = 1e-4, atol = 1e-6
)# Output the result in vectors for each quantity (time and species)
<- out[, 1]
t <- out[, 2]
G6P <- out[, 3]
R5P <- out[, 4]
G3P <- out[, 5]
DHCP <- out[, 6]
PEP # Graphing vertical
par(mfrow = c(1, 5))
plot(t, G6P, type = "l")
plot(t, R5P, type = "l")
plot(t, G3P, type = "l")
plot(t, DHCP, type = "l")
plot(t, PEP, type = "l")
# Preparation of graph with all species
par(mfrow = c(1, 1))
plot(t, G6P, type = "l", col = 1, lty = 1, ylab = "[species]",
ylim = c(0, 1))
lines(t, R5P, type = "l", col = 2, lty = 2)
lines(t, G3P, type = "l", col = 3, lty = 3)
lines(t, DHCP, type = "l", col = 4, lty = 4)
lines(t, PEP, type = "l", col = 5, lty = 5)
legend(x = 10, y = 1, legend = c("G6P", "R5P", "G3P", "DHCP", "PEP"),
col = c(1, 2, 3, 4, 5), cex = 1, lty = c(1, 2, 3, 4, 5))
Kinetics of 6-mercaptopurine metabolism

lsoda
function:# Degradation of 6-mercaptopurine and Runge-Kutta solution
library(deSolve)
# Parameters
<- 5
k0 <- 10
k1 <- 10
k2 <- 5
k3 <- 1e-5
k4 <- 0.01
k7 <- 0.5
k8 <- 1
km7 <- 0.01
km1 <- 4
km2 <- 0.01
km3 <- 0.1
km4 <- 0.01
km8 <- 0.01
VPUR <- 0.9
VD <- 1e-4
VOUT # Parameter list
<- c(k0, k1, k2, k3, k4, k7, k8, km7, km1, km2, km3, km4, km8,
parms
VPUR, VD, VOUT)# compound specification
<- x[1]
MPex <- x[2]
MPin <- x[3]
TIMP <- x[4]
TXMP <- x[5]
TGMP <- x[6]
meTGMP <- x[7]
TITP <- x[8]
ATP <- x[9]
AMP <- x[10]
PP # initial concentrations of species
<- c(MPex0 = 0.68, MPin0 = 0, TIMP0 = 0, TXMP0 = 0, TGMP0 = 0,
reag0 meTGMP0 = 0, TITP0 = 0, ATP0 = 0.2, AMP0 = 0, PP0 = 0)
# time interval definition
<- 0
tmin <- 2
tmax <- 0.01
dt <- seq(tmin, tmax, dt)
time # Function for the derivatives of each species
<- function(time, x, parms) {
eq.dif # Parameter definition
<- x[1]
MPex <- x[2]
MPin <- x[3]
TIMP <- x[4]
TXMP <- x[5]
TGMP <- x[6]
meTGMP <- x[7]
TITP <- x[8]
ATP <- x[9]
AMP <- x[10]
PP # Differential equations
<- -k0 * MPex
dMPex <- -(VPUR + k1) * MPin + k0 * MPex + km1 * TIMP
dMPin <- k1 * MPin + km8 * TITP - (k2 + k7 * ATP + km1 + k8 * PP) *
dTIMP + km2 * TXMP + km7 * TITP * AMP
TIMP <- k2 * TIMP - k3 * TXMP * ATP - km2 * TXMP + km3 * TGMP *
dTXMP * PP
AMP <- k3 * TXMP * ATP - (k4 + VD) * TGMP - km3 * TGMP * AMP *
dTGMP + km4 * meTGMP
PP <- k4 * TGMP - VOUT * meTGMP - km4 * meTGMP
dmeTGMP <- k8 * TIMP * PP - km8 * TITP + k7 * TIMP * ATP - km7 *
dTITP *AMP
TITP<- -k7 * TIMP * ATP + km3 * TGMP * AMP * PP - k3 * TXMP *
dATP + km7 * TITP * AMP
ATP <- -km3 * TGMP * AMP * PP + k3 * TXMP * ATP + k7 * TIMP *
dAMP - km7 * TITP * AMP
ATP <- -k8 * TIMP * PP + km8 * TITP - km3 * TGMP * AMP * PP + k3 *
dPP * ATP
TXMP list(c(dMPex, dMPin, dTIMP, dTXMP, dTGMP, dmeTGMP, dTITP, dATP,
# list of differential values for each species
dAMP, dPP))
}# lsoda routine for solving differential equations ordinary
<- lsoda(reag0, time, eq.dif, parms,
sol.eq rtol = 1e-4, atol = 1e-6
)# Isolating the result columns
<- sol.eq[, 1]
t <- sol.eq[, 2]
MPex <- sol.eq[, 3]
MPin <- sol.eq[, 4]
TIMP <- sol.eq[, 5]
TXMP <- sol.eq[, 6]
TGMP <- sol.eq[, 7]
meTGMP <- sol.eq[, 8]
TITP <- sol.eq[, 9]
ATP <- sol.eq[, 10]
AMP <- sol.eq[, 11]
PP
# Creating the graph
plot(t, MPex, type = "l", xlab = "tempo, days",
ylab = "[species], umol/L")
lines(t, MPin, type = "l", col = 2, lty = 2)
lines(t, TIMP, type = "l", col = 3, lty = 3)
lines(t, TXMP, type = "l", col = 4, lty = 4)
lines(t, TGMP, type = "l", col = 5, lty = 5)
lines(t, meTGMP, type = "l", col = 6, lty = 6)
lines(t, TITP, type = "l", col = 7, lty = 7)
lines(t, ATP, type = "l", col = 8, lty = 8)
lines(t, AMP, type = "l", col = 9, lty = 9)
lines(t, PP, type = "l", col = 10, lty = 10)
legend(x = 1.5, y = 0.65, legend = c("MPex", "MPin", "TIMP", "TXMP",
"TGMP", "meTGMP", "TITP", "ATP",
"AMP", "PP"), col = c(1, 2, 3, 4,
5, 6, 7, 8,
9, 10),
cex = 0.7, lty = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))