Building and solving the E. coli ME model

The image includes the COBRAme and ECOLIme Python packages to get you started quickly. The docker image includes a prebuild version of the E. coli ME model iLE1678 at at me_models/iLE1678.pickle.

If you need more info about the construction process you can find it in the build_ME_model.ipynb notebook.


In [1]:
import pickle

with open("me_models/iLE1678.pickle", "rb") as model_file:
    ecoli = pickle.load(model_file)


/opt/conda/lib/python3.5/site-packages/cobra/io/sbml3.py:24: UserWarning: Install lxml for faster SBML I/O
  warn("Install lxml for faster SBML I/O")
/opt/conda/lib/python3.5/site-packages/cobra/io/__init__.py:12: UserWarning: cobra.io.sbml requires libsbml
  warn("cobra.io.sbml requires libsbml")

This will read the saved model into the variable ecoli.


In [2]:
print(ecoli)
print("Reactions:", len(ecoli.reactions))
print("Metabolites:", len(ecoli.metabolites))


iLE1678-ME
Reactions: 12677
Metabolites: 7036

We can now run the optimization for the model. This will take around 10 minutes.


In [3]:
from cobrame.solve.algorithms import binary_search

%time binary_search(ecoli, min_mu=0.1, max_mu=1.0, debug=True, mu_accuracy=1e-2)


LP files will be saved in /tmp/tmp4lf4mc9d
mu   	status	reset	time	iter	obj
0.100	+	True	71.34	26290	0.0011190117087874793
1.000	-	False	1.50	173	
0.550	+	False	1.26	94	0.002856689960381714
0.775	+	False	1.14	53	0.00166452276935499
0.887	+	True	39.05	14922	0.0004398825612577415
0.944	-	False	1.67	144	
0.916	+	False	0.64	11	6.8577056232015e-05
0.930	-	False	1.75	109	
0.923	-	False	0.70	11	
0.916	+	False	0.56	0	6.8577056232015e-05
completed in 334.2 seconds and 10 iterations
CPU times: user 7min 16s, sys: 1.78 s, total: 7min 17s
Wall time: 7min 19s
Out[3]:
<Solution 0.92 at 0x7f47badad438>

If we want to we could also visualize the model fluxes on a map of the E. coli central carbon metabolism obtained from iJO1366.


In [5]:
import escher
view = escher.Builder("iJO1366.Central metabolism")
view.reaction_data = ecoli.get_metabolic_flux()
view.display_in_notebook()


Out[5]:

In [ ]: