Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions ecoli/processes/metabolism.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class Metabolism(Step):
"linked_metabolites": None,
"aa_exchange_names": [],
"removed_aa_uptake": [],
"set_reaction_bounds": {}, # In form: {RXN_ID:[lb,ub]}
"seed": 0,
# TODO: For testing, remove later (perhaps after modifying sim data)
"reduce_murein_objective": False,
Expand Down Expand Up @@ -532,6 +533,27 @@ def next_update(self, timestep, states):
catalyst_counts, counts_to_molar, coefficient, translation_gtp
)

# Set reaction limits from config options
Comment thread
heenasaqib marked this conversation as resolved.
config_reaction_bounds = self.parameters.get("set_reaction_bounds", {})
for rxn, bounds in config_reaction_bounds.items():
if rxn not in self.fba_reaction_ids:
raise ValueError(
f"set_reaction_bounds: reaction '{rxn}' not found in FBA reaction IDs"
)
try:
lower_bound, upper_bound = bounds
except (TypeError, ValueError) as e:
raise ValueError(
f"set_reaction_bounds for '{rxn}' must be a 2-item sequence [lower, upper], got: {bounds!r}"
) from e
if lower_bound > upper_bound:
raise ValueError(
f"set_reaction_bounds for '{rxn}' has lower_bound > upper_bound ({lower_bound} > {upper_bound})"
)
self.model.fba.setReactionFluxBounds(
rxn, lowerBounds=lower_bound, upperBounds=upper_bound
)
Comment thread
Copilot marked this conversation as resolved.
Comment on lines +536 to +555

# Constrain reactions based on targets
targets, upper_targets, lower_targets = self.model.set_reaction_targets(
kinetic_enzyme_counts,
Expand Down
Loading