Skip to content

Rule-based applications: use the stored math in vcml_to_ode_input (0.0.21) - #28

Merged
jcschaff merged 2 commits into
mainfrom
feat/rule-based-stored-math
Oct 23, 2026
Merged

jcschaff merged 2 commits into
mainfrom
feat/rule-based-stored-math

Conversation

@jcschaff

Copy link
Copy Markdown
Member

vcml_to_ode_input couldn't convert a simulation in a rule-based application. VCell expands reaction rules into a reaction network with BioNetGen, and BioNetGen runs BNG2.pl from a VCell installation, which libvcell doesn't have. The failure surfaced as required System property "vcell.installDir" not defined.

It also regenerated every application's math (BioModel.updateAll), so a single rule-based application broke the input of every other simulation in the same document.

Change

  • Only the simulation's own application is regenerated.
  • A rule-based application uses the math stored in the document, with a warning. That's the case where VCell's NetworkTransformer applies, i.e. the application has enabled reaction rules. The stored math is the network VCell generated when the model was saved, and it's what the VCell server runs for a saved simulation.
  • The success message says when stored math was used: "<input file>; stored math (rule-based application: BioNetGen, which would regenerate its reaction network, is not available in libvcell)". Input file names have no ;, so message.split(";")[0] is the name. A regenerated simulation's message is just the name, as in 0.0.20. In Java, SolverUtils.vcmlToOdeInput returns an OdeInput(inputFile, usedStoredMath) record.

How much it matters, and whether the stored math is right

  • Scale: in a 2,730-model VCell corpus, 109 of the 1,411 models with ODE simulations (8%) have reaction rules, and every one stores math. Before this change, all of them failed.

  • Checked against BioNetGen 2.9.3 (PyPI bionetgen, as a stand-in VCell installation) by regenerating 25 of them and comparing solver input:

    • The networks are the same in all 25: same equations, same expressions.
    • 8 give identical input.
    • The others differ only by Avogadro's number. VCell has since changed it from 6.02e23 to 6.02214179e23, a 0.036% change in some rates.

    So the stored math reproduces the model as VCell computed it when it was saved. Very sensitive models amplify that 0.036% difference, so a result from stored math is "the model as saved", not "regenerated by today's VCell". That's what the message note is for.

Tests

  • Java: a test on public BioModel 100992568 ("CompartmentTransport", one reaction rule, downloaded anonymously from the VCell API) checks the input and usedStoredMath. SolverEntrypointsTest gives 23/23.
  • Python: a test on the same model, through the native library, checks the message note and solves the input with pyvcell-odesolver. 28/28 pass locally on a fresh native build.
  • MainRecorder exercises the path for native-image.
  • make check is clean.

Follow-ups

🤖 Generated with Claude Code

jcschaff and others added 2 commits October 23, 2026 14:14
vcml_to_ode_input regenerated every application's math (BioModel.updateAll),
which fails for a rule-based application: VCell expands its reaction rules
into a network with BioNetGen (BNG2.pl from a VCell installation), which
libvcell does not have ("required System property vcell.installDir not
defined"). It also made any rule-based application in a document break the
input of every other simulation in it.

Now only the simulation's own application is regenerated, and for a
rule-based one (VCell's NetworkTransformer applies: enabled reaction rules)
the math stored in the document is used, with a warning: the network VCell
generated when the model was saved, which is what the VCell server runs for
a saved simulation. In a 2,730-model VCell corpus, 109 of the 1,411 models
with ODE simulations (8%) have reaction rules, and every one stores math.

Checked against BioNetGen 2.9.3 (PyPI bionetgen, as a stand-in VCell
installation) on 25 of them: the regenerated networks are the same (same
equations and expressions) in all 25; 8 give identical solver input and the
others differ only by Avogadro's number, which VCell has since changed from
6.02e23 to 6.02214179e23 (a 0.036% change in rates that sensitive models
amplify). The stored math reproduces the model as VCell computed it then.

Tests: a Java and a Python test (the Python one solves the input) on public
BioModel 100992568 ("CompartmentTransport", one reaction rule), downloaded
anonymously from the VCell API; MainRecorder exercises the path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rsion 0.0.21

SolverUtils.vcmlToOdeInput returns an OdeInput record (the input file, and
whether the document's stored math was used); the entry point's success
message is the input file's name, followed by "; stored math (rule-based
application: BioNetGen ... is not available in libvcell)" when it was.
Input file names have no ";", so message.split(";")[0] is the name; a
regenerated simulation's message is just the name, as in 0.0.20.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jcschaff
jcschaff merged commit 9391d10 into main Oct 23, 2026
5 checks passed
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