segrelab / comets

Computation of Microbial Ecosystems in Time and Space
GNU General Public License v3.0
19 stars 10 forks source link

Bug fix: objective reaction not adhering to upper bound #18

Open mquintin opened 5 years ago

mquintin commented 5 years ago

Bug description: In FBACell.run, the upper bound on the biomass reaction is set to be equivalent to the rate that would fill the current cell. This overrides the limit set in the model file, which we may want to limit. For example, I discovered this when trying knockouts of every reaction, and the model that knocks out the "growth" reaction still grew.

Sorry for not making this change myself, turns out my local code base is kind of screwy since I didn't properly migrate to the github repo. Could one of you please make the following changes?

Step 1: Modify FBACell.run(model[]) to change the part that says /************************* SET MAX BIOMASS *****************************/ ((FBAModel)models[i]).setObjectiveUpperBound((cParams.getMaxSpaceBiomass() - (Utility.sum(biomass) + Utility.sum(deltaBiomass))) / (biomass[i] * cParams.getTimeStep())); to /************************* SET MAX BIOMASS *****************************/

double bioUB = ((FBAModel)models[i]).getBaseUB()[((FBAModel)models[i]).getBiomassReaction()];

double capacityUB = (cParams.getMaxSpaceBiomass() - (Utility.sum(biomass) + Utility.sum(deltaBiomass))) / (biomass[i] * cParams.getTimeStep());

((FBAModel)models[i]).setObjectiveUpperBound(Math.min(bioUB, capacityUB));

Step 2: Add getBaseUB() to FBAModel public double[] getBaseUB() { return baseUB; }

jeremymchacon commented 3 years ago

This should be fixed in my "signal bugfix" pull request.