Skip to content

feat: add diffModels for structured model comparison - #686

Merged
edkerk merged 1 commit into
develop3from
feat/diff-models
Jul 17, 2026
Merged

feat: add diffModels for structured model comparison#686
edkerk merged 1 commit into
develop3from
feat/diff-models

Conversation

@edkerk

@edkerk edkerk commented Jul 17, 2026

Copy link
Copy Markdown
Member

Main improvements in this PR:

  • features:
    • diffModels(modelA, modelB) reports what changed between two models: reaction/metabolite/gene ids present in only one, and for shared ids the differences in stoichiometry (within a tolerance), bounds, objective, grRule, EC codes, and metabolite formula/charge/compartment. Returns an equal flag plus a list of differences. The existing comparison functions only give overlap counts and distances.
    • grRules are compared as logic, not text — a and b equals b and a — by expanding to DNF and sorting, reusing the grRule parser.
  • documentation:
    • Eight tests in tComparison.m covering equality, dropped reactions, bounds, stoichiometry tolerance, order-insensitive grRule equality, and truncation.

Instructions on merging this PR:

  • This PR has develop3 as target branch, and will be resolved with a squash-merge.

compareMultipleModels and compareRxnsGenesMetsComps report overlap counts
and distances; neither says what actually changed between two models.
diffModels keys reactions, metabolites and genes by id and, for the ids in
both models, compares stoichiometry (within a tolerance), bounds, objective
coefficient, grRule, EC codes, and metabolite formula, charge and
compartment. It returns an equal flag, a list of human-readable differences,
and the id sets present in only one model, with per-category truncation.

grRules are compared as logic, not text: each is expanded to DNF and the
genes within each isozyme, and the isozymes, are sorted before comparison, so
"a and b" equals "b and a". This reuses the grRule parser and is stronger
than the case/whitespace string match the Python counterpart uses.
@github-actions

Copy link
Copy Markdown

Function test results

297 tests   271 ✅  1m 13s ⏱️
 25 suites   26 💤
  1 files      0 ❌

Results for commit 5979f31.

@edkerk
edkerk merged commit d03220b into develop3 Jul 17, 2026
4 checks passed
@edkerk
edkerk deleted the feat/diff-models branch July 17, 2026 20:16
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