Summary
The action-argument grammar in bionetgen/core/utils/utils.py (ActionList.define_parser) is stricter than BNG2.pl for list-valued arguments. It rejects two forms that BNG2.pl (Perl) accepts and runs fine:
- Scientific notation in list elements — e.g.
par_scan_vals=>[2.3e-10, 5.1e-10]
- A trailing comma in a list — e.g.
par_scan_vals=>[1, 2, 3,]
When a model uses either in a list-valued arg (most commonly par_scan_vals on parameter_scan), modelapi.bngmodel raises BNGParseError ("Failed to parse action …"). Consequence for the merged BNGsim bridge: under bionetgen.run(simulator='bngsim') the bridge cannot inspect the model's actions, so it silently falls back to the legacy BNG2.pl subprocess — the model never runs on bngsim, with no error surfaced.
Root cause
In define_parser:
arg_type_float = pp.Word(pp.nums + ".") # digits + '.' only
arg_type_list = "[" + pp.delimitedList(quote_word ^ arg_type_float) + "]"
arg_type_float excludes e/E/+/-, so 2.3e-10 fails to match (the grammar stops at the e).
pp.delimitedList(...) does not allow a trailing delimiter, so [1,2,3,] fails on the final comma.
Both are valid Perl list syntax, which is why BNG2.pl parses and runs these models (a parameter_scan over e-notation values produces correct .scan/.gdat output on the legacy stack).
Repro
from bionetgen.core.utils.utils import ActionList
al = ActionList(); al.define_parser()
al.action_parser.parse_string(
'parameter_scan({parameter=>"x",par_scan_vals=>[2.3e-10,5.1e-10],method=>"ode"})',
parse_all=True,
)
# pyparsing.ParseException: Expected '}', found ','
Real models affected
Surfaced by a downstream parity/golden suite's per-job engine audit. In RuleHub:
Published/Mitra2019/15-igf1r/fit_{ade,de,pso,ss}/IGF1R_fit_all_*.bngl (4 models) — e-notation and trailing commas in par_scan_vals
Published/Salazar-Cavazos2019/190127_CHO_EGFR_best-fit.bngl — e-notation in par_scan_vals
All five parse + run on BNG2.pl today; all five silently route to the legacy stack under simulator='bngsim'.
Proposed fix
Broaden arg_type_list to accept e-notation values and an optional trailing comma. arg_type_expr already covers nums + ".+-eE()/*^":
arg_type_list = (
"[" + pp.Optional(pp.delimitedList(quote_word ^ arg_type_expr)) + pp.Optional(",") + "]"
)
Validated against the full corpus list forms:
- ✅ accepts
[0.3,1,3], [2.3e-10,5.1e-10], [0.0,0.05e-9,50.0e-9], [2.3e-10,4.9e-07,] (trailing comma), ["a","b"], and []
- ✅ still rejects genuinely-malformed lists: double commas (
[1,,2]) and unclosed lists ([1,2, with no ])
With this change, all five models above parse and route to bngsim in-process.
Refs
Summary
The action-argument grammar in
bionetgen/core/utils/utils.py(ActionList.define_parser) is stricter than BNG2.pl for list-valued arguments. It rejects two forms that BNG2.pl (Perl) accepts and runs fine:par_scan_vals=>[2.3e-10, 5.1e-10]par_scan_vals=>[1, 2, 3,]When a model uses either in a list-valued arg (most commonly
par_scan_valsonparameter_scan),modelapi.bngmodelraisesBNGParseError("Failed to parse action …"). Consequence for the merged BNGsim bridge: underbionetgen.run(simulator='bngsim')the bridge cannot inspect the model's actions, so it silently falls back to the legacy BNG2.pl subprocess — the model never runs on bngsim, with no error surfaced.Root cause
In
define_parser:arg_type_floatexcludese/E/+/-, so2.3e-10fails to match (the grammar stops at thee).pp.delimitedList(...)does not allow a trailing delimiter, so[1,2,3,]fails on the final comma.Both are valid Perl list syntax, which is why BNG2.pl parses and runs these models (a
parameter_scanover e-notation values produces correct.scan/.gdatoutput on the legacy stack).Repro
Real models affected
Surfaced by a downstream parity/golden suite's per-job engine audit. In RuleHub:
Published/Mitra2019/15-igf1r/fit_{ade,de,pso,ss}/IGF1R_fit_all_*.bngl(4 models) — e-notation and trailing commas inpar_scan_valsPublished/Salazar-Cavazos2019/190127_CHO_EGFR_best-fit.bngl— e-notation inpar_scan_valsAll five parse + run on BNG2.pl today; all five silently route to the legacy stack under
simulator='bngsim'.Proposed fix
Broaden
arg_type_listto accept e-notation values and an optional trailing comma.arg_type_expralready coversnums + ".+-eE()/*^":Validated against the full corpus list forms:
[0.3,1,3],[2.3e-10,5.1e-10],[0.0,0.05e-9,50.0e-9],[2.3e-10,4.9e-07,](trailing comma),["a","b"], and[][1,,2]) and unclosed lists ([1,2,with no])With this change, all five models above parse and route to bngsim in-process.
Refs