{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"pycharm": {
"name": "#%% md\n"
}
},
"source": [
"# Flux balance analysis in systems biology"
]
},
{
"cell_type": "markdown",
"source": [
"Flux balance analysis is based on a very simple model of\n",
"the reactions going on in a cell, keeping track only of the gross rate of consumption and production\n",
"of various chemical species within the cell. Based on the known stoichiometry of the reactions, and\n",
"known upper bounds on some of the reaction rates, we can compute bounds on the other reaction\n",
"rates, or cell growth, for example.\n",
"\n",
"We focus on m metabolites in a cell, labeled $M_1, \\ldots, M_m$. There are $n$ reactions going on, labeled\n",
"$R_1, \\ldots, R_n$, with nonnegative reaction rates $v_1, \\ldots, v_n$. Each reaction has a (known) stoichiometry,\n",
"which tells us the rate of consumption and production of the metabolites per unit of reaction rate.\n",
"The stoichiometry data is given by the *stoichiometry matrix* $S \\in \\mathbf{R}^{m \\times n}$, defined as follows: $S_{ij}$\n",
"is the rate of production of $M_i$ due to unit reaction rate $v_j = 1$. Here we consider consumption\n",
"of a metabolite as negative production; so $S_{ij} = −2$, for example, means that reaction $R_j$ causes\n",
"metabolite $M_i$ to be consumed at a rate $2v_j$.\n",
"\n",
"As an example, suppose reaction $R_1$ has the form $M_1 \\rightarrow M_2 + 2M_3$. The consumption rate of $M_1$,\n",
"due to this reaction, is $v_1$; the production rate of $M_2$ is $v_1$; and the production rate of $M_3$ is $2v_1$.\n",
"(The reaction $R_1$ has no effect on metabolites $M_4, \\ldots, M_m$.) This corresponds to a first column of\n",
"$S$ of the form $(−1, 1, 2, 0, \\ldots, 0)$.\n",
"\n",
"Reactions are also used to model flow of metabolites into and out of the cell. For example, suppose\n",
"that reaction $R_2$ corresponds to the flow of metabolite $M_1$ into the cell, with $v_2$ giving the flow\n",
"rate. This corresponds to a second column of $S$ of the form $(1, 0, \\ldots, 0)$.\n",
"\n",
"The last reaction, $R_n$, corresponds to biomass creation, or cell growth, so the reaction rate $v_n$ is\n",
"the cell growth rate. The last column of $S$ gives the amounts of metabolites used or created per\n",
"unit of cell growth rate.\n",
"\n",
"Since our reactions include metabolites entering or leaving the cell, as well as those converted\n",
"to biomass within the cell, we have conservation of the metabolites, which can be expressed as\n",
"$Sv = 0$. In addition, we are given upper limits on some of the reaction rates, which we express as\n",
"$v \\preceq v^\\mathrm{max}$, where we set $v^\\mathrm{max}_j = \\infty$ if no upper limit on reaction rate $j$ is known. The goal is to\n",
"find the maximum possible cell growth rate (i.e., largest possible value of $v_n$) consistent with the\n",
"constraints\n",
"$$\n",
"Sv = 0, \\quad v \\succeq 0, \\quad v \\preceq v^\\mathrm{max}.\n",
"$$"
],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "markdown",
"metadata": {
"pycharm": {
"name": "#%% md\n"
}
},
"source": [
"## (a) Maximum growth rate\n",
"Find the maximum possible cell growth rate $G^\\star$, using the data provided below."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"# data file for flux balance analysis in systems biology\n",
"# From Segre, Zucker et al \"From annotated genomes to metabolic flux\n",
"# models and kinetic parameter fitting\" OMICS 7 (3), 301-316.\n",
"import numpy as np\n",
"\n",
"# Stoichiometric matrix\n",
"# columns are M1 M2 M3 M4 M5 M6\n",
"# For your interest, the rows correspond to the following equations\n",
"# R1: extracellular --> M1\n",
"# R2: M1 --> M2\n",
"# R3: M1 --> M3\n",
"# R4: M2 + M5 --> 2 M4\n",
"# R5: extracellular --> M5\n",
"# R6: 2 M2 --> M3 + M6\n",
"# R7: M3 --> M4\n",
"# R8: M6 --> extracellular\n",
"# R9: M4 --> cell biomass\n",
"S = np.array(\n",
" np.matrix(\n",
" \"\"\"\n",
" 1,0,0,0,0,0;\n",
" -1,1,0,0,0,0;\n",
" -1,0,1,0,0,0;\n",
" 0,-1,0,2,-1,0;\n",
" 0,0,0,0,1,0;\n",
" 0,-2,1,0,0,1;\n",
" 0,0,-1,1,0,0;\n",
" 0,0,0,0,0,-1;\n",
" 0,0,0,-1,0,0\n",
" \"\"\"\n",
" ).T\n",
")\n",
"m, n = S.shape\n",
"\n",
"vmax = np.array(\n",
" [10.10,\n",
" 100,\n",
" 5.90,\n",
" 100,\n",
" 3.70,\n",
" 100,\n",
" 100,\n",
" 100,\n",
" 100]\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"import cvxpy as cp\n",
"\n",
"v = cp.Variable(n)\n",
"# TODO: your code here\n",
"\n",
"\n",
"print(Gstar)"
]
},
{
"cell_type": "markdown",
"metadata": {
"pycharm": {
"name": "#%% md\n"
}
},
"source": [
"## (b) Essential genes and synthetic lethals\n",
"\n",
"For simplicity, we'll assume that each reaction is controlled\n",
"by an associated gene, i.e., gene $G_i$ controls reaction $R_i$. Knocking out a set of genes\n",
"associated with some reactions has the effect of setting the reaction rates (or equivalently, the\n",
"associated $v^\\mathrm{max}$ entries) to zero, which of course reduces the maximum possible growth rate.\n",
"If the maximum growth rate becomes small enough or zero, it is reasonable to guess that\n",
"knocking out the set of genes will kill the cell. An *essential gene* is one that when knocked\n",
"out reduces the maximum growth rate below a given threshold $G^\\mathrm{min}$. (Note that $G_n$ is always\n",
"an essential gene.) A *synthetic lethal* is a pair of non-essential genes that when knocked out\n",
"reduces the maximum growth rate below the threshold. Find all essential genes and synthetic\n",
"lethals for the given problem instance, using the threshold $G^\\mathrm{min} = 0.2G^\\star$."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"# Check essential genes and synthetic lethals\n",
"G = np.zeros((n, n))\n",
"for i in range(n):\n",
" for j in range(i, n):\n",
" # Taking out genes i and j (i can equal j)\n",
" # TODO: your code here\n",
"\n",
"\n",
"print(G < 0.2*Gstar)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.4"
}
},
"nbformat": 4,
"nbformat_minor": 1
}