Modify a genome-scale metabolic model using AI

Maëva Beugin
Oct 23, 2023, 9:28 AM


You have a genome-scale metabolic model and it's not exactly as annotated as you'd like?
Constellab already has functions for modifying your model but if you want to make another more specific modification, read on!

Using AI to modify your model

You can now use AI to modify your model using the task Smart json modificator (cobra) from the gws_gena brick. All you have to do is provide a model in json format and ask what you want.
This task is still in beta version.
This task uses openAI API to generate python code that modify a genome scale metabolic model stored in a json format; using cobra library. This code is then automatically executed.
The data of the model is not transferered to OpenAI, only the provided text.


  • You need to have a model stored in json format. If your model is in a different format, go here.
  • An access to Constellab and to a digital lab
  • The brick "gws_gena" (version > 0.5.2)

Steps to follow

  1. Ensure that the "gws_gena" brick is loaded
  2. So first, upload your model (in json format) in a new experiment.
  3. Link it to the "Smart json modificator (cobra)" task available in the "gws_gena" brick.
  4. Write and save your request
  5. Run your experiment
  6. Get your modified model on output in json format

Here are few examples of what you can ask for:
- Please change the id of the metabolite "xxx" by "yyy"
- Please change the id of the reaction "xxx" by "yyy"
- Please change the id of the gene "xxx" by "yyy" with the function cobra.manipulation.modify.rename_genes
You get a new model, modified according to your wishes!
You can also keep the code prompt in the message if you want to repeat this manipulation for another model.
As this task is still under construction, please don't hesitate to send us your feedback. Also, don't hesitate to reformulate your request as a re-run of the experience in case of error.
This demonstration was done using task from the brick gws_gena in version 0.5.2 and with this model from BiGG.