micom-dev / micom

Python package to study microbial communities using metabolic modeling.
https://micom-dev.github.io/micom
Apache License 2.0
89 stars 18 forks source link

Question on setting import flux upper bounds #6

Closed krcurtis closed 4 years ago

krcurtis commented 5 years ago

When setting the upper bound for the import fluxes from the gut lumen, do I need to adjust for organism abundance? I noticed that if I look at community.medium, I get

In [12]: community.medium
Out[12]: {'EX_4abut91e93__Bacteroides_fragilis_YCH46_m': 1000.0, 'EX_7dhcdchol91e93__Bacteroides_fragilis_YCH46_m': 1000.0, 'EX_7ocholate91e93__Bacteroides_fragilis_YCH46_m': 1000.0, 'EX_C0252891e93__Bacteroides_fragilis_YCH46_m': 1000.0, ...

where the flux for a metabolite includes the organism name already. The community constraints from the MICOM preprint suggest that I would not (instead setting all keys with"7ocholate" to have the same upper bound) but since these dictionary elements already include the organism name, I'm not sure.

Is there a way to see a pretty-print-ish format for the constraints sent off to the solver (Gurobi, in my case)?

Thanks!

cdiener commented 5 years ago

Depends on what you want to adjust. The imports from the gut lumen towards and from the entire community are marked with "_m". You can get and set those with the Community.medium accessors (see https://micom-dev.github.io/micom/media.html). This is the most common use case.

If you want to set only individual exchanges for one microbe I would do that before constructing the community model. This way you won't have to worry about scaling by abundance since this will be handled by micom. Also if you do that you can again use the Model.medium methods for cobrapy models (see https://cobrapy.readthedocs.io/en/stable/media.html).