<jupyter_start><jupyter_text>Simulations with iUma22<jupyter_code>from os.path import join
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline

from cobra import Model #, Reaction, Metabolite
from cobra.io import read_sbml_model
from escher import Builder
ModelFile = join('..','model','iUma22.xml')
model=read_sbml_model(ModelFile)
model.summary()<jupyter_output><empty_output><jupyter_text>Cofeeding of Glc+Ace<jupyter_code>model.add_boundary(metabolite=model.metabolites.h_e, type='exchange', reaction_id='EX_h_e', lb=0, ub=1000)
medium=model.medium
with model:
    medium['EX_glc__D_e']= 5#7.69
#     medium['EX_ac_e']=10
    model.medium=medium
    solution=model.optimize()
    print(solution.fluxes['BIOMASS_REACTION'])
    print(model.summary())
NSamp = 6
Glucose_list = np.linspace(.1,6,NSamp) # # np.array([5,7,9,11,13,15])
Acetate_list = np.linspace(0,2,NSamp)
# medium_list = np.array([[x,y] for x in Glucose_list for y in Acetate_list])
Glc_list, Ace_list = np.meshgrid(Glucose_list, Acetate_list)
medium_list = np.transpose(np.reshape(np.array([Glc_list, Ace_list]),(2,-1)))
# print(medium_list)
medium=model.medium
Bio_list = list()
for z in medium_list:
    x=z[0]
    y=z[1]
    with model:
        medium['EX_glc__D_e']=x
        medium['EX_ac_e']=y
        model.medium=medium
        solution=model.optimize()
        Bio_list.append(solution.fluxes['BIOMASS_REACTION'])
        
Bio_list = np.reshape(np.array(Bio_list),(-1,1))
Z = np.reshape(Bio_list,(NSamp,NSamp))
plt.contourf(Glc_list, Ace_list, Z, 20, cmap='coolwarm')
plt.colorbar(label='growth /h')
plt.xlabel('Glc in mmol/gCDW/h')
plt.ylabel('Ace in mmol/gCDW/h')
# plt.savefig('Umay-Glc-Ace_default.png')<jupyter_output><empty_output><jupyter_text>forcing proton export<jupyter_code>Bio_list = list()
for z in medium_list:
    x=z[0]
    y=z[1]
    with model:
        medium['EX_glc__D_e']=x
        medium['EX_ac_e']=y
        model.medium=medium
        model.reactions.EX_h_e.lower_bound = np.power(2.33,y)
        solution=model.optimize()
        Bio_list.append(solution.fluxes['BIOMASS_REACTION'])
        
Bio_list = np.reshape(np.array(Bio_list),(-1,1))
Z = np.reshape(Bio_list,(NSamp,NSamp))
plt.contourf(Glc_list, Ace_list, Z, 20, cmap='coolwarm')
plt.colorbar(label='growth /h')
plt.xlabel('Glc in mmol/gCDW/h')
plt.ylabel('Ace in mmol/gCDW/h')
# plt.savefig('Umay-Glc-Ace_InhHigh.png')<jupyter_output><empty_output><jupyter_text>Yield simulations of itaconate from different substratesSimulations are performed to identify the maximum yield for itaconate from various substrates.<jupyter_code>Substrate_List = ['EX_glc__D_e','EX_ac_e']
Sol_Dict = dict.fromkeys(Substrate_List)
Yield_Dict = dict.fromkeys(Substrate_List)
for Substrate in Substrate_List:
    with model:
        medium=model.medium
        medium['EX_glc__D_e']=0
        medium['EX_co2_e']=0
        medium[Substrate]=10
#         medium['EX_for_e'] = 1
        model.medium=medium
        model.objective = 'EX_itacon_e'
        solution=model.optimize()
#         print(model.summary())
        Sol_Dict[Substrate] = solution
        Sub_Name = model.reactions.get_by_id(Substrate).reaction.split()[0]
        try:
            Sub_Catom = int(model.metabolites.get_by_id(Sub_Name).formula[1])
        except ValueError:
            Sub_Catom = 1
        Yield_Dict[Substrate] = round(solution.objective_value,2)*5/(Sub_Catom*medium[Substrate])

print('Yield: ')
Yield_Dict
# cofeed itaconate yield
with model:
    medium=model.medium
    medium['EX_glc__D_e']=10
    medium['EX_ac_e']=10
    medium['EX_co2_e']=0
    model.medium=medium
    model.objective = 'EX_itacon_e'
    cofeed_sol = model.optimize()
    cofeed_yield = round(cofeed_sol.objective_value,2)*5/(6*medium['EX_glc__D_e'] + 2*medium['EX_ac_e'])

print('Yield: ')
cofeed_yield
# load U. maydis ESCHER maps
builder=Builder()

Escher_Central = join('Maps','iUma22_MetMap_TCA.json')
Escher_Glycine = join('Maps','iUma22_MetMap_glycine.json')
builder = Builder(
    map_json=Escher_Central,
    model = model, # 'iCL1079.json',
)
# Run FBA with the model and add the flux data to the map
solution = builder.model.optimize()
builder.reaction_data = cofeed_sol.fluxes# Sol_Dict['EX_glc__D_e'].fluxes

builder.save_html('../code/example_map.html')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1376274328081557, 'fraction_numerical': 0.01737720111214087, 'mean_word_length': 4.7103174603174605, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 1}, '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': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '399827', 'license': 'CC-BY-4.0', 'n_tokens_mistral': 1767, 'n_tokens_neox': 1673, 'n_words': 254, 'path': 'code/iUma22_BiotechSimulations.ipynb', 'repo_name': 'iAMB-RWTH-Aachen/Ustilago_maydis-GEM', 'size': '4316'}