cobrapy integrates well with the visbio package. If it has been installed, viewing maps is extremely simple. The default map is the E. coli core map, but other maps can be viewed by passing the correct map_name. The maps are then downloaded from a map repository.
In [1]:
from IPython.html.widgets import interact, interactive, fixed
from IPython.html import widgets
from IPython.display import clear_output, display, HTML
In [2]:
from escher import Builder
import cobra.test
model = cobra.test.create_test_model(cobra.test.ecoli_pickle)
In [3]:
import escher
In [5]:
stuff = Builder('iJO1366.Central metabolism')
In [ ]:
display(HTML(stuff._get_html()))
In [34]:
def show(bound=20.):
model.reactions.get_by_id('EX_o2_e').lower_bound = -1*bound
model.optimize()
wt_solution = model.solution.x_dict
display(wt_solution['Ec_biomass_iJO1366_core_53p95M'])
display(HTML(Builder('iJO1366_central_metabolism',reaction_data=wt_solution)._get_html()))
# display(Map(flux={'ENO':upper_obj_bound,'PGK':2}))
In [35]:
i = interact(show, bound=widgets.FloatSliderWidget(min=0.0, max=20.0, step=0.1, value=1.0))
In [42]:
i.widget
In [2]:
# mutant flux has PGI knocked out
model.reactions.PGI.lower_bound = 0
model.reactions.PGI.upper_bound = 0
model.optimize()
mutant_solution = model.solution.x_dict
In [4]:
wt_map = Map(flux=wt_solution)
wt_map
Out[4]:
In [5]:
Map(flux=model.solution.x_dict)
Out[5]:
In [ ]: