Add pfbaEnzymes, enzyme-aware parsimonious FBA - #439
Merged
Conversation
Ports geckopy's pfba_enzymes (utilities/pfba_enzymes.py) to MATLAB: among all flux distributions at (or within a fraction of) the optimal objective, finds the one minimising total enzyme usage (sum of usage_prot_* fluxes) rather than total flux. Fixes the objective as a constraint using the same "fake metabolite" technique solveLP's own minFlux=1 option already uses internally (append a row to model.S equal to model.c, bounded at fractionOfOptimum * optimal with the same 1e-6 relative safety margin), rather than introducing a new pattern. usage_prot_<id> reactions with a negative lower bound (reverse flux enabled) are explicitly rejected: minimising raw flux would not minimise |flux| for those, unlike geckopy's cobra-based forward/ reverse variable split. Not reachable through any real GECKO 3 ecModel today (usage reactions are forward-only by construction). Cross-verified against geckopy's pfba_enzymes on an identical ecTestGEM-based fixture: geckopy reports growth=90 and enzyme_usage=125 exactly; pfbaEnzymes.m reproduces both up to the ~1e-6 relative safety margin, with the same enzyme usage pattern (only usage_prot_P5 nonzero). Regression test added to geckoCoreFunctionTests.m, including the fractionOfOptimum, rxnId override, and gecko-light-guard paths.
Unit test results25 tests 25 ✅ 9s ⏱️ Results for commit b5fff36. ♻️ This comment has been updated with latest results. |
# Conflicts: # test/unit_tests/geckoCoreFunctionTests.m
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ports geckopy's
pfba_enzymes(utilities/pfba_enzymes.py) to MATLAB — itself ported from the legacy geckopy package (Carrasco et al., 2023, https://doi.org/10.1128/spectrum.01705-23,geckopy/flux_analysis.py:342-386,pfba_protein). Tracked as SysBioChalmers/raven-gecko-parity#23.What it does
Enzyme-aware parsimonious FBA: among all flux distributions at (or within a fraction of) the optimal objective, finds the one minimising total enzyme usage (
sum(usage_prot_*)) rather than total flux. For ecModels this usually picks the most parsimonious proteome, not just the most parsimonious fluxes.Implementation note
Fixes the current objective as a constraint using the same "fake metabolite" technique
solveLP's ownminFlux=1option already uses internally (append a row tomodel.Sequal tomodel.c, bounded atfractionOfOptimum * optimalwith the same ~1e-6 relative safety marginsolveLPitself applies) — reusing an established, already-battle-tested pattern in this codebase rather than introducing a new one.The one design decision flagged in #23
geckopy's usage reactions are forward-only (
lb=0) by construction; if one has been flipped to allow reverse flux, cobra'sreverse_variablemachinery still minimises|flux|correctly for it. MATLAB has no equivalent automatic variable split. Rather than build one for a case that can't currently arise in any real GECKO 3 ecModel,pfbaEnzymesexplicitly rejects ausage_prot_<id>reaction withlb<0instead of silently building an incorrect objective for it.Verification
Cross-checked against geckopy's
pfba_enzymeson an identical ecTestGEM-based fixture (uniformkcat=10, protein poolPtot=0.5/f=0.5/sigma=0.5): geckopy reports growth=90andenzyme_usage=125exactly, using onlyusage_prot_P5;pfbaEnzymes.mreproduces the same solution (same enzyme usage pattern, same reactions at zero) up to the deliberate ~1e-6 relative safety margin described above. AddedtestPfbaEnzymesMinimisesEnzymeUsage_tc0024togeckoCoreFunctionTests.m, covering the default call,fractionOfOptimum, therxnIdobjective override, and the gecko-light guard. Full suite: 24 passed, 0 failed.