Closed joeryjoery closed 2 years ago
Hi @joeryjoery,
You'll need to be a little bit more specific. What change do you observe exactly? In which model is this? Changes within the solver's tolerance, for example, can be expected.
Hi,
I'm using the iNF517 model: http://bigg.ucsd.edu/models/iNF517. (I edited it into the post).
What I expect is happening is that the default model medium has asymmetric bounds within the exchange reactions. I see in the source @medium.setter (line 253: https://github.com/opencobra/cobrapy/blob/devel/src/cobra/core/model.py) that the bounds are overriden.
I am not aware of what exactly is being overriden behind the scenes
I would expect that this isn't intended behaviour...
I can reproduce that.
In [39]: import cobra
...:
...: model = cobra.io.read_sbml_model("iNF517.xml")
...:
...: with model:
...: print(model.optimize())
...:
...: with model:
...: model.medium = model.medium
...: print(model.optimize())
...:
<Solution 0.043 at 0x7fb3a251a940>
<Solution 0.075 at 0x7fb3a2488910>
The issue is that this model has fixed export bounds. In particular:
EX_ac_e (0.83, 1.92)
EX_etoh_e (0.44, 1.02)
EX_for_e (1.71, 3.94)
EX_lac__L_e (0.4, 0.92)
EX_pro__L_e (0.03, 0.44)
which will be converted to
EX_ac_e (0, 1.92)
EX_etoh_e (0, 1.02)
EX_for_e (0, 3.94)
EX_lac__L_e (0, 0.92)
EX_pro__L_e (0, 0.44)
dtype: object
The problematic behavior is how the medium setter manages exchanges not in the medium. Right not those get set to (0, default_bound)
which overwrites the export bounds. I can send a fix.
Though for that particular case this is probably kind of a bad set of defaults. Fixing secretion rates independent of the actual growth medium is likely not going to give you good results. It's kind of a bad decision by BIGG to keep those in the model. In this case, it cuts the maximum growth rate almost by half.
Problem description
I was changing around some of the variables within the model.medium; I found that setting the medium using model.set alters the optimization objective.
By setting the medium of model to itself, which shouldn't change anything, the output of the optimization changes.
Edit: added cobra import and model name.
Model: BiGG Model iNF517 - http://bigg.ucsd.edu/models/iNF517
Code Sample
Create a minimal, complete, verifiable example.
Context