<jupyter_start><jupyter_text>IntroductionIn previous notebooks, we've used the E. coli cor emap to visualize fluxes in metabolism. However there are of course species-differences between *P. thermoglucosidasius* NCBI 11955 and E. coli, so for further analysis of data it would be very benefical to have a map of central carbon metabolism as it is in our strain. This notebook will cover modifying the E. coli core map to fit our wishes as much as possible.Later we can decide to make one that also includes amino acid metabolism, or any other functionalities we would like.<jupyter_code>import cameo
import pandas as pd
import cobra.io
import escher
from escher import Builder
from cobra import Reaction, Metabolite
model = cobra.io.read_sbml_model('../model/p-thermo.xml')
model_e_coli = cameo.load_model('iML1515')
#here I can build the map on the e. coli core backbone
builder = Builder(model=model, map_name = 'e_coli_core.Core metabolism')
#here I can build the map on the e. coli core backbone, taking the initial changes
Builder(model=model, map_json = '../map/p-thermo-map.json')<jupyter_output><empty_output><jupyter_text>__Glutamate__I have now observed that we have three glutamate metabolites: L, D and DL glutamate. According to bioinformatic data, our starin can form both L and D glutamate, though L is the predominant form required for biomas for example. Here I will remove the DL metabolite and leave the rest.<jupyter_code>#remove ACYSAT, same as CYSAT
model.remove_reactions(model.reactions.ACYSAT)
model.remove_metabolites(model.metabolites.glu__DL_c)<jupyter_output><empty_output><jupyter_text>__Additional changes__ Modifying the map also lets us see some changes that need to be made. For example, this strain has been shown to produce formate upon fermentation, and so we need a formate transport reaction that is currently lacking. (data from Tang et al. 2009, doi 10.1002/bit.22181) Bioinformatically, a formate-proton symporter has been identified and so this will be added.<jupyter_code>#add formate transport
model.add_reaction(Reaction(id='FORt'))
model.reactions.FORt.name = 'Transport of formate via proton symport'
model.reactions.FORt.brounds = (-1000,1000)
model.add_metabolites(Metabolite(id='for_e'))
model.metabolites.for_e.name = 'Formate'
model.metabolites.for_e.formula = model.metabolites.for_c.formula
model.metabolites.for_e.name = model.metabolites.for_c.name
model.metabolites.for_e.charge = model.metabolites.for_c.charge
model.metabolites.for_e.compartment = 'e'
model.metabolites.for_e.name = 'Formate'
model.metabolites.h_e.name = 'Proton'
model.metabolites.for_e.formula = model.metabolites.for_c.formula
model.reactions.FORt.add_metabolites({model.metabolites.for_e: -1, model.metabolites.for_c: 1, model.metabolites.h_e:-1, model.metabolites.h_c:1})<jupyter_output><empty_output><jupyter_text>add phosphate transport: we supply phosphate in the medium, and it can be taken up by the cell. considering its role in ATP generation it will be an important metabolite to supply in the default medium.<jupyter_code>model.add_metabolites(Metabolite(id='pi_e'))
model.metabolites.pi_e.name = 'Phosphate'
model.metabolites.pi_e.formula = model.metabolites.pi_c.formula
model.metabolites.pi_e.charge = model.metabolites.pi_c.charge
model.metabolites.pi_e.compartment = 'e'
model.metabolites.pi_e.annotation = model_e_coli.metabolites.pi_e.annotation
model.add_reaction(Reaction(id='PIt'))
model.reactions.PIt.name = 'Transport of phosphate'
model.reactions.PIt.bounds = (-1000,1000)
model.reactions.PIt.add_metabolites({model.metabolites.pi_e:-1, model.metabolites.pi_c:1})
model.add_boundary(model.metabolites.pi_e, type = 'exchange', reaction_id = 'EX_pi_e')
model.reactions.ICDHhr.id = 'ICDHyr'
#modify name
model.reactions.R5PISO.id = 'RPI'
#save & commit
cobra.io.write_sbml_model(model,'../model/p-thermo.xml')<jupyter_output><empty_output><jupyter_text>In looking into the map, I've looked into ATP synthesis, searching for the ATP synthase. In doing so, I ran into ATPPR, which just converts ATP to ADP reversibly. This needs to be removed, and interestingly doesn't even change our biomass prediction. Which is kind of strange, but atleast then I can remove it now.<jupyter_code>model.remove_reactions(model.reactions.ATPPT)
#save&commit
cobra.io.write_sbml_model(model,'../model/p-thermo.xml')<jupyter_output><empty_output><jupyter_text>Modify map furtherNow that we have fixed quite some problems in the model, I will modify the Escher map we have again so that it includes more correct nodes.<jupyter_code>#other comment, noticed i missed adding H20 and H+ to the biomass reaction when I added atp
model.reactions.biomass.add_metabolites({model.metabolites.h2o_c:-104.9974, model.metabolites.h_c:104.9974})
#save&commit
cobra.io.write_sbml_model(model,'../model/p-thermo.xml')
#should be reversible to allow TCA cycle to function in both ways
model.reactions.SUCDi.bounds = (-1000,1000)
#save&commit
cobra.io.write_sbml_model(model,'../model/p-thermo.xml')
### here I can build the map on the e. coli core backbone, taking the initial changes
Builder(model=model, map_json = '../map/p-thermo-map.json')
solution = model.optimize()
Builder(model = model, map_json = '../map/p-thermo-map.json', reaction_data = solution.fluxes.to_dict())<jupyter_output><empty_output><jupyter_text>model.reactions.ATPM<jupyter_code>model.reactions.ATPM<jupyter_output><empty_output><jupyter_text>model.reactions.ATPM<jupyter_code>model.reactions.ATPM<jupyter_output><empty_output><jupyter_text>It is strange that so much of the glucose doesn't go through glycolysis. Looking into it, we see that the glucose is converted into fructose, which is phosphorylated 'for free' in the FRU1PT reaction. The F1P can be converted into dhAp and G3p, and flow back into metabolism. So the FRU1PT reaction should be fixed. This is one of the reactions that Martyn was going to look into and fix. So I will leave it for now, knowing that when the mass balance is complete this problem may be fixed.<jupyter_code>g_thermo_map = '../databases/Maps/p-thermo-map.json'
#save map
builder.save_html('example_map.html')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09343065693430656, 'fraction_numerical': 0.012327656123276562, 'mean_word_length': 5.8970917225950785, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 5}, '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': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '492842', 'license': 'Apache-2.0', 'n_tokens_mistral': 2143, 'n_tokens_neox': 1980, 'n_words': 607, 'path': 'notebooks/16. Build Escher Map.ipynb', 'repo_name': 'biosustain/p-thermo', 'size': '6165'}