Skip to content

Add user guide page 16: combining and simplifying models - #37

Merged
edkerk merged 2 commits into
mainfrom
guide/combining
Aug 27, 2026
Merged

Add user guide page 16: combining and simplifying models#37
edkerk merged 2 commits into
mainfrom
guide/combining

Conversation

@edkerk

@edkerk edkerk commented Aug 27, 2026

Copy link
Copy Markdown
Owner

Adds user guide page 16, Combining and simplifying models — merging,
contracting, simplifying against the current bounds, and collapsing
compartments. MATLAB and Python side by side, every example executed.

Merging two copies says it better than prose

53 reactions become 106 while 52 metabolites stay 52. Metabolites are
matched on name and compartment (not identifier), genes on name, and reactions
are added with no check at all — so de-duplication is a separate step, and
merging models from different databases is a claim about naming consistency.

Both tabs agree exactly on merge, contract and simplify. Simplifying the
shipped-shut smallYeast leaves 2 reactions of 53 in both toolboxes, which
makes the "simplify against the condition you mean to simulate" warning concrete.

16.4 documents a bug rather than working around it

This is the one place the tabs disagree: RAVEN keeps 50 reactions, raven-
toolbox keeps 42. That gap is a defect, filed as
raven-toolbox#96:

  • merge_compartments deletes every reaction left holding a single metabolite,
    including the exchanges, which had a single metabolite all along. Of the 11
    reactions it drops, 3 are genuine transports; the other 8 are every boundary
    reaction in the model, biomassOUT included.
  • The merged model is rebuilt from scratch and the objective is not carried
    over
    , so it optimises to 0.0.

Together: growth 0.12220.0000, no error, no warning. RAVEN avoids it by
recording single-metabolite reactions before merging and refusing to delete
them. The page states which tab to trust and what to check until the fix ships.

Checks

  • 10 examples, both languages, all passing
  • check_names.py clean (three argument names added to the allowlist)
  • site builds

The guide is now 16 pages, 167 examples, no skips.

Also: a flaky example on page 13, now stabilised

CI failed on this PR in gap-filling.md, not on the new page. 13.2 documented
1 added, 11 newly connected, 23 still unconnectable; the run reported 9 and
22
— same RAVEN commit, same model, same inputs as the run half an hour before.

fillGaps solves a MILP, several solutions are equally optimal, and which one
comes back varies with the machine and thread count. Those counts were never a
stable thing to document.

The section now prints the identity of what was added — 1 added: ADH1, the
reaction the setup removed, in both toolboxes. That is the claim the section is
really making, it is reproducible, and it is better documentation. The
instability is described on the page rather than hidden.

Both jobs green.

edkerk added 2 commits August 27, 2026 03:02
Merging, contracting, simplifying against the current bounds, and
collapsing compartments -- MATLAB and Python side by side.

Merging two copies of the same model states the behaviour more clearly
than prose can: 53 reactions become 106 while 52 metabolites stay 52.
Metabolites are matched on name and compartment, genes on name, and
reactions are added with no check at all, so de-duplicating is a
separate step.

16.4 documents a raven-toolbox bug rather than working around it.
merge_compartments deletes every reaction left holding one metabolite,
including the exchanges that had one all along, and drops the objective
when it rebuilds the model -- together taking smallYeast from growth
0.1222 to 0.0000 silently. RAVEN reserves those reactions and keeps 50
where raven-toolbox keeps 42. Fix filed as SysBioChalmers/raven-toolbox#96;
the page says plainly which tab to trust until it lands.
13.2 documented "1 added, 11 newly connected, 23 still unconnectable".
Two CI runs on identical input -- same RAVEN commit, same model --
reported 11 and 9. fillGaps solves a MILP, several solutions are equally
optimal, and which one is returned varies with the machine and the
thread count, so those two counts were never a stable result to
document.

Print the identity of the added reaction instead. Both toolboxes return
ADH1, the reaction the setup removed, which is the claim the section is
actually making and is reproducible. The instability itself is now
described on the page.
@edkerk
edkerk merged commit 88cadf9 into main Aug 27, 2026
2 checks passed
@edkerk
edkerk deleted the guide/combining branch August 27, 2026 09:03
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