From abfe5f6bc178505e9f8b4a1a860dcc7337cf341f Mon Sep 17 00:00:00 2001 From: Alejandro Date: Thu, 8 Feb 2024 09:11:10 +0100 Subject: [PATCH] fix: reaction bounds in _add_cycle_free function are assigned according to the description in CycleFreeFlux paper --- src/cobra/flux_analysis/loopless.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cobra/flux_analysis/loopless.py b/src/cobra/flux_analysis/loopless.py index ca09b862c..283fc32d9 100644 --- a/src/cobra/flux_analysis/loopless.py +++ b/src/cobra/flux_analysis/loopless.py @@ -112,10 +112,10 @@ def _add_cycle_free(model: "Model", fluxes: Dict[str, float]) -> None: rxn.bounds = (flux, flux) continue if flux >= 0: - rxn.bounds = max(0, rxn.lower_bound), max(flux, rxn.upper_bound) + rxn.bounds = max(0, rxn.lower_bound), min(flux, rxn.upper_bound) objective_vars.append(rxn.forward_variable) else: - rxn.bounds = min(flux, rxn.lower_bound), min(0, rxn.upper_bound) + rxn.bounds = max(flux, rxn.lower_bound), min(0, rxn.upper_bound) objective_vars.append(rxn.reverse_variable) model.objective.set_linear_coefficients({v: 1.0 for v in objective_vars})