Specifying a new growth medium in an AGORA model

Skip to first unread message

Laura Confalonieri

Aug 3, 2022, 11:05:25 AM8/3/22
to cobra pie
Hi all,

I am a PhD student new to CobraPy. I am trying to specify a new growth medium (LB from carveme/media_db.tsv at master · cdanielmachado/carveme · GitHub) into Staph. epi ATCC 12228 AGORA model (AGORA/Staphylococcus_epidermidis_ATCC_12228.xml at master · VirtualMetabolicHuman/AGORA · GitHub).

I have read the docs and also got a table for LB in .ods format with metabolite names, exchange reactions and bounds from an experienced user; however, I have not yet figured out how to input it in the .xml file using CobraPy. 

Could you please send me some suggestions?

Many thanks and best wishes,


Greg Medlock

Aug 5, 2022, 2:06:40 PM8/5/22
to cobra pie
Hi Laura,
After you load the xml file into cobrapy as a model, you need to change find the exchange reaction in the model corresponding to each exchange reaction in your spreadsheet; then, set the lower bound of the reaction to -1*limit (where limit is the value from the "limit" column in the spreadsheet; exchange bounds are defined as negative for uptake and positive for secretion).

Alternatively, you can use the model.medium helper for this. See the documentation here: https://cobrapy.readthedocs.io/en/latest/media.html.

One caveat to think about: your model from AGORA might not have all of the exchange reactions defined in the LB.xlsm file.


Laura Confalonieri

Aug 7, 2022, 11:18:08 AM8/7/22
to cobra pie
Hi Greg,

Thank you very much for your prompt reply. 

Given the complexity of the .xml file, it might be better for me not to edit it directly. 

I did try to re-specify the growth medium in CobraPy as indicated in the docs, using the model.medium helper. However, I might not have done this correctly.

It is clear to me how to drop a single reaction (e.g. oxygen exchange), but not how to replace the growth medium completely.

Shall I repeat the following steps for all the reactions which are included in the AGORA model:

medium = model.medium 

medium["EX_co2_e"] = 0.0

model.medium = medium 


then redefine all the reactions and limits as listed in the LB.xls file:

medium = model.medium 

medium["EX_adn_e"] = 1000.0

model.medium = medium 


Is there an online course or tutorial that you would recommend?

Thanks again and best wishes,
Reply all
Reply to author
0 new messages