SysBioChalmers / yeast-GEM

The consensus GEM for Saccharomyces cerevisiae
http://sysbiochalmers.github.io/yeast-GEM/
Creative Commons Attribution 4.0 International
95 stars 46 forks source link

How to used the ID of metabolites correctly in COBRApy? #280

Closed LGJee closed 2 years ago

LGJee commented 2 years ago

Hi, I am the beginner of GEMs, I learn the usage of COBRApy through the tutorials in https://cobrapy.readthedocs.io/en/latest/, I encountered a problem when using the model of yeast8.

After executing the following code

import code.io as io
model = io.read_yeast_model()

The following three codes will raise AttributeError

print(model.metabolites.nadh_c.summary()) print(model.metabolites.s_1203_c.summary()) print(model.metabolites.s_1203.summary())

Last but not least, I would be very grateful if you can provide some basic tutorials on Yeast8 or related application cases, thanks!

edkerk commented 2 years ago

You can load the model in cobrapy with BiGG-style identifiers:

model = io.read_yeast_model(True)
print(model.metabolites.nadh_c.summary())

The original identifiers (in the style of s_1203[c]) indeed raises an AttributeError, probably related to the presence of the square brackets. This is also raised in #281.

edkerk commented 2 years ago

Also note that the BiGG-style IDs might not be actual BiGG IDs: #282. There are no tutorials for Yeast8, but this is a great suggestion that we will work on in 2022: #286