sbml_to_bngl writes simulate actions with no tolerances, so BNG2.pl runs BIOMD0000000571 at its default atol=1e-8 and 57 of 76 species miss by up to 2.6x their peak; event-free models get no actions block, and there is no sedml= input
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
Research direction
Start in bngsim.convert.sbml_to_bngl and compare its generated simulate actions with the issue’s reproduced tolerances and event-free examples. Then read sbml_to_net for its SED-ML handling and warning; the issue proposes carrying time-course settings into BNGL actions and correcting that warning. Done means generated actions preserve the requested simulation settings and avoid the demonstrated default-tolerance error, including for event-free models.
Written by the indexing model from the issue text.
Description
Summary
bngsim.convert.sbml_to_bngl(strict=True) translates fixed-time SBML events into a BNGL actions block (#224 phase 2), but the simulate actions it writes carry no atol/rtol. BNG2.pl then runs run_network -a 1e-08 -r 1e-08, its defaults. On a model in molar units, where species sit at 1e-7 to 1e-12, that absolute tolerance is larger than the solution. The converted file reports ok=True, lossy=[], dropped=[], but BNG2.pl's trajectory is wrong.
Related gaps in the same channel:
- Event-free models get no actions block at all (BIOMD0000000883, BIOMD0000000667, BIOMD0000001065), so BNG2.pl on the file only reads the model. Fixed-time-event models do get
generate_network+simulate. - There is no
sedml=argument.sbml_to_nethas one, butsbml_to_bnglcannot carry the model's own horizon, output grid or tolerances into the actions. sbml_to_net's warning points at a tool that doesn't exist. For a model with events it says "emit them as a SED-ML sidecar instead", butsbml_to_bnglis the converter that carries fixed-time events, as BNGL actions.
Reproduction (bngsim 0.17.2, BioNetGen 2.9.3, libRoadRunner 2.11.0)
Model: BIOMD0000000571 (Nishio 2008, E. coli phosphotransferase system), sys-bio/temp-biomodels @ 6a09daf46af1bb89e4857436b623a7b8720863ad, final/BIOMD0000000571/BIOMD0000000571_url.xml (sha256 9410de3b8aff1ec7…, as in parity_checks/rr_parity/temp_biomodels_manifest.json). One event: at time >= 500, Glucose := 2e-9.
from bngsim.convert import sbml_to_bngl
rep = sbml_to_bngl("BIOMD0000000571_url.xml", "nishio.bngl", strict=True)
# rep.ok == True, rep.lossy == [], rep.dropped == []
The actions it writes:
generate_network({overwrite=>1})
simulate({method=>"ode",t_start=>0,t_end=>500,n_steps=>100})
setConcentration("@comp1:Glucose()",2e-09)
simulate({method=>"ode",t_start=>500,t_end=>1000,n_steps=>100,continue=>1})
perl BNG2.pl nishio.bngl was compared, at every .gdat time except the t=500 phase boundary, with bngsim Model.from_sbml on the SBML (rtol 1e-10, atol 1e-14). Errors are max |diff| / peak per species, using the observable named after each SBML species ID. bngsim and libRoadRunner agree on the SBML to 2.8e-7.
| BNG2.pl run | species > 1e-4 of peak | worst |
|---|---|---|
| actions as written (BNG defaults atol = rtol = 1e-8) | 57 of 76 | 2.57 x peak (CRPsite_cyaA at t = 525: BNG2.pl -7.9e-11; bngsim and roadrunner 7.73e-13). Already > 1e-4 at t = 5, and 4.7e-2 before the event. |
same actions plus atol=>1e-14, rtol=>1e-10 |
0 of 76 | 9.9e-5 (IICB_Mlc) |
The converted model itself is exact. bngsim integrating the .net that BNG2.pl generates from nishio.bngl matches bngsim on the SBML with zero difference over 0–470. So the 1e-4 left in the second row is run_network's own integration, and the first row is the tolerance alone.
Suggested directions
- Write
atol/rtolinto every generatedsimulate. Take them from the SED-ML when one is given, and otherwise from a scale-aware default rather than BNG's absolute 1e-8. - Accept
sedml=assbml_to_netdoes. Emit its time course (initial time, output start, end, points, tolerances) as the actions, including for event-free models, which today get nosimulateat all. - Point
sbml_to_net's dropped-events warning atsbml_to_bngl, which carries fixed-time events.
Found while building the SBML ODE suite of lanl/bngsim-benchmarks, which drives BioNetGen's run_network as a reference engine.
- Dominant language
- Python
- Stars
- 3
- Forks
- 6
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 295
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from lanl/bngsim
-
testing
Difficulty 1/5 Under an hour Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
bug correctness concern
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
bug latent bug low priority
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
benchmarks/README: 'perl BNG2.pl model.bngl' runs the whole protocol, not just generate_networkOpendocumentation
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
software-mansion-labs/Diplomat#20 ·
Maintainers usually reply within 1 day
-
[Windows] Hidden title bar: a maximized window restored from minimized on a secondary monitor gets the primary monitor's work area as its client areaPossibly taken @lijy91 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
libnativeapi/nativeapi#53 · 1 reaction ·
Maintainers usually reply within 1 day
-
View Counts discarded due to field name mismatchPossibly taken @rsiva0400 claimed this today. Opensite-bug triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Model version publishes the new UK firm entity as a personPossibly taken @vahid-ahmadi claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
PolicyEngine/policyengine.py#764 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
spcl/HPCAgent-Bench#264 ·
Maintainers usually reply within 1 day