segrelab / cometspy

Python interface for running COMETS simulations and analyzing the results
GNU General Public License v3.0
11 stars 9 forks source link

Changing upper bound of objective function to limit growth #47

Closed zoey-rw closed 3 months ago

zoey-rw commented 5 months ago

To cap the maximum growth rate in a COMETS model (after conversion from cobra), I want to set the maximum bound of the biomass function to a lower value, based off distance from optimal growth temperature.

species_max_growth_rate = .5
temperature_scaling = .2
new_max_growth = species_max_growth_rate*temperature_scaling

In cobra, checking the output is simple:

iYO844_cobra = cobra.io.read_sbml_model("/projectnb2/talbot-lab-data/metabolic_models/curated_models/iYO844/bigg_iYO844.COBRA-sbml3.xml")
iYO844_cobra.slim_optimize()
# 0.26725162282652803
iYO844_cobra_copy = copy.deepcopy(iYO844_orig)
iYO844_cobra_copy.reactions.reacCD8EB705.upper_bound = new_max_growth
iYO844_cobra_copy.slim_optimize()
# .1

In COMETS, this is my approach:

iYO844 = c.model("/projectnb2/talbot-lab-data/metabolic_models/curated_models/iYO844/bigg_iYO844.COBRA-sbml3.xml")
iYO844_copy = copy.deepcopy(iYO844)
obj_id = iYO844_copy.objective
rxn_names = iYO844_copy.get_reaction_names()
obj_rxn = rxn_names[obj_id-1] 
iYO844_copy.change_bounds(obj_rxn, 0, new_max_growth)
iYO844_copy.id="bigg_iYO844_copy"
# ....set initial populations, parameters, add both models to layout, run simulation....
params.set_param('timeStep', 2) # in hours
params.set_param('spaceWidth', .1) # one cell = one cm3

And the results look ok, but I'm wondering if the max flux rates are dependent on the timestep and cell size, or if there's anything else I should be considering here? image Thanks!

zoey-rw commented 3 months ago

Closing this (the resulting growth rates seem reasonable enough for my comfort)