<jupyter_start><jupyter_text>Escher map<jupyter_code>builder = Builder(
    height=600, 
    map_name=None, 
    model_name='e_coli_core',
    map_json='https://escher.github.io/1-0-0/5/maps/Escherichia%20coli/e_coli_core.Core%20metabolism.json',
)
builder
builder._model_module_version<jupyter_output><empty_output><jupyter_text>Using options<jupyter_code>builder.metabolite_data = {'ac_c': -100, 'nadph_c': 200}

builder.disabled_buttons

builder.scroll_behavior = 'none'

builder.reaction_styles = ['color', 'size', 'text']

builder.metabolite_scale

builder.use_3d_transform = False

builder.metabolite_no_data_size = 0

builder.hide_secondary_metabolites<jupyter_output><empty_output><jupyter_text>Generate JSON models in COBRApy In COBRApy version 0.3.0b4 and later, you can generate JSON files for COBRA models, and these files are compatible with Escher. See the example below.JSON models for Escher are also available in the BiGG Database: http://bigg.ucsd.edu<jupyter_code>import cobra

# Start with any SBML models
!wget http://bigg.ucsd.edu/static/models/iJO1366.xml

# Load a cobra model from anywhere you like
model = cobra.io.read_sbml_model('iJO1366.xml')

# generate a json file to load into Escher
cobra.io.save_json_model(model, 'iJO1366.json')

# JSON models are also available directly from BiGG Models
!wget http://bigg.ucsd.edu/static/models/iJO1366.json
# Embed an Escher map in an IPython notebook
escher.list_available_maps()

b = escher.Builder(map_name='e_coli_core.Core metabolism')
# b.display_in_notebook()

### Plot FBA solutions in Escher

model = cobra.io.json.from_json(escher.plots.model_json_for_name('e_coli_core'))
solution = model.optimize()
print('Growth rate: %.2f' % solution.f)<jupyter_output><empty_output><jupyter_text>Advanced: Save changes back to model  Advanced: Make an animation<jupyter_code>builder = Builder(
    height=600, 
    map_name=None, 
    model_name='e_coli_core',
    map_json='https://escher.github.io/1-0-0/5/maps/Escherichia%20coli/e_coli_core.Core%20metabolism.json',
)
builder
!wget http://bigg.ucsd.edu/static/models/e_coli_core.json
model = cobra.io.load_json_model('e_coli_core.json')
reverse = False
step = 0.1
timestep = 0.1
duration = 100 # seconds
lim = [0, 0.5]
val = lim[-1]
for _ in range(int(duration / timestep)):
    model.reactions.EX_o2_e.lower_bound = -val
    solution = model.optimize()
    builder.reaction_data = solution.fluxes
    if val <= lim[0]:
        reverse = True
    if val >= lim[1]:
        reverse = False
    if reverse:
        val += step
    else:
        val -= step
    sleep(timestep)<jupyter_output><empty_output><jupyter_text>Advanced: connect to a slider<jupyter_code>from ipywidgets import interact, interactive, fixed, interact_manual
def f(x):
    return x
interact(f, x=10);
# testing
!wget https://github.com/ismms-himc/clustergrammer2/raw/master/examples/rc_two_cats.txt
from clustergrammer2 import net
df = {}
net.load_file('rc_two_cats.txt')
df['ini'] = net.export_df()
net.load_df(df['ini'])
net.widget()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11870503597122302, 'fraction_numerical': 0.022563767168083716, 'mean_word_length': 5.081510934393638, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 22, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '569036', 'license': 'MIT', 'n_tokens_mistral': 1176, 'n_tokens_neox': 1096, 'n_words': 222, 'path': 'docs/notebooks/Escher Python Tutorial.ipynb', 'repo_name': 'lukaw3d/escher', 'size': '3058'}