Load a few packages and functions.
In [29]:
import pandas
pandas.options.display.max_rows = 12
import escher
from cameo import models, fba
from cameo.exceptions import Infeasible
First we load a model from the BiGG database (and make a copy of it).
In [2]:
model = models.bigg.e_coli_core.copy()
In [3]:
print(model.objective)
Run flux balance analysis.
In [4]:
result = fba(model)
The predicted growth rate is $0.87 \ h^{-1}$.
In [6]:
result.objective_value
Out[6]:
Take a look at the predicted metabolic fluxes.
In [7]:
result.data_frame
Out[7]:
In [8]:
result.data_frame.describe()
Out[8]:
In [19]:
active_fluxes = result.data_frame[result.data_frame.flux != 0].sort_values(by='flux')
active_fluxes
Out[19]:
In [20]:
model.reactions.ATPS4r
Out[20]:
In [35]:
import escher
import jupyter
In [32]:
escher.__version__
Out[32]:
In [37]:
!pip show jupyter
In [24]:
escher.Builder('e_coli_core.Core metabolism', reaction_data=active_fluxes.flux.to_dict()).display_in_notebook()
Out[24]:
In [25]:
result.display_on_map('e_coli_core.Core metabolism')
model.genes.get_by_id('<geneID>').knock_out()
where
In [31]:
gene_essentiality = {}
for gene in model.genes:
mutant = model.copy()
mutant.genes.get_by_id(gene.id).knock_out()
try:
print(gene, fba(mutant).objective_value)
gene_essentiality[gene] = fba(mutant).objective_value
except Infeasible:
print(gene, 0)
gene_essentiality[gene] = 0
In [ ]: