Skip to content

Add compareFluxes: ranked comparison of two flux distributions#661

Merged
edkerk merged 2 commits into
develop3from
feat/flux-comparison
Jun 18, 2026
Merged

Add compareFluxes: ranked comparison of two flux distributions#661
edkerk merged 2 commits into
develop3from
feat/flux-comparison

Conversation

@edkerk

@edkerk edkerk commented Jun 18, 2026

Copy link
Copy Markdown
Member

Summary

New function analysis/compareFluxes.m for comparing two flux vectors from the same model.

Usage:

solA = solveLP(model);
modelAna = setParam(model, 'ub', 'O2exch', 0);
solB = solveLP(modelAna);
result = compareFluxes(model, solA.x, solB.x)

Output table (printed by default):

========================================================================
  Flux comparison: 45 of 1577 reactions changed
  (on: 5  |  off: 3  |  reversed: 2)
------------------------------------------------------------------------
  Reaction              Cond.1      Cond.2     |dflux|   drel%  Type
------------------------------------------------------------------------
  ATPS4rpp           +1234.5000    +456.7000    777.800   -63%
  EX_glc__D_e         -100.0000   -200.0000    100.000  +100%
  O2t                    0.0000    +15.0000     15.000    new   on
  EX_etoh_e             -8.0000      0.0000      8.000   -100%  off
  PGM                   +2.0000     -3.0000      5.000   -250%  flip

Returned struct for programmatic use:

  • result.turnedOn / result.turnedOff / result.flipped — cell arrays of rxn IDs by category
  • result.changed.rxn, .flux1, .flux2, .absDelta, .relChange, .type — all changed reactions sorted by |dflux|

Tests added in tAnalysis: compareFluxesReturnsResult (aerobic vs anaerobic, verifies structure and sort order) and compareFluxesIdenticalIsEmpty (identical vectors produce empty result).

@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown

Function test results

215 tests   192 ✅  38s ⏱️
 22 suites   23 💤
  1 files      0 ❌

Results for commit 7a45b36.

♻️ This comment has been updated with latest results.

@edkerk edkerk force-pushed the feat/flux-comparison branch 6 times, most recently from 44af6e7 to 2c64fef Compare June 18, 2026 21:44
Base automatically changed from feat/flux-navigation to develop3 June 18, 2026 22:06
@edkerk edkerk force-pushed the feat/flux-comparison branch 2 times, most recently from c778006 to e748419 Compare June 18, 2026 22:16
edkerk added 2 commits June 19, 2026 00:22
Takes two flux vectors from the same model and returns all reactions
that changed, sorted by |dflux|. Classifies each change as turned on,
turned off, reversed direction, or changed magnitude. Relative change
(drel%) is reported against the reference flux; NaN when the reference
was near-zero (reaction emerged). Verbose output prints a compact table;
the structured result supports programmatic downstream use.
@edkerk edkerk force-pushed the feat/flux-comparison branch from e748419 to 7a45b36 Compare June 18, 2026 22:22
@edkerk edkerk merged commit 1bfd391 into develop3 Jun 18, 2026
4 checks passed
@edkerk edkerk deleted the feat/flux-comparison branch June 18, 2026 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant