segrelab / comets

Computation of Microbial Ecosystems in Time and Space
19 stars 10 forks source link

added linear production rate when lower bound > 0.0 #42

Closed behzadk closed 2 years ago

behzadk commented 2 years ago

I've added a check statement to each of the exchange style cases to ensure a linear production if the lower bound is greater than 0.0. Previously, setting lower bounds > 0 could not be used to force metabolite production from a model.

Example using Cobra e_coli 'text_book' model:

lower bound negative: e_coli.change_bounds("EX_glcD_e", -1000, 1000) lower bound zero: e_coli.change_bounds("EX_glcD_e", 0.0, 1000) lower bound positive: e_coli.change_bounds("EX_glc__D_e", 1.0, 1000)

Previous behaviour

The image below shows the biomass of the three simulations (left) and the glucose concentrations (right). We have this unexpected growth when the lower bound is set to positive

We would expect to see growth only in the first instance, no growth in the second, and no growth or an error in the third.

New behaviour

We now have growth only in when the lower bound is negative. Both negative lower bound and zero lower bound produce no growth. The negative lower bound produces an inviable solution (as expected), and the rates therefore revert to zero. Figure_2