Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

NetModel silently ignores a condition/mutant perturbation of a parameter that the .net file stores as an expression (ConstantExpression)

Open
#832 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
backend

Research direction

The bug is in pybnf/pset.py line 1325 where NetModel.copy_with_param_set uses a regex that only matches numeric literals, ignoring expression-based parameters like 'Btot Atot*2'. Start by examining the regex and the substitution logic. Look at _get_mutant_model (lines 1015-1016) and _override_param_block_values to understand the correct perturbation flow. Run the provided reproduction steps with fit_bionetgen.conf to see the silent failure. The fix must handle ConstantExpression parameters and ensure mutations apply, with a warning if a parameter is not found.

Written by the indexing model from the issue text.

Description

bug

NetModel.copy_with_param_set substitutes a parameter only when its .net line matches the regex at 1325, which requires a numeric literal value. BNG2.pl writes a derived parameter as its expression ('4 Btot Atot*2 # ConstantExpression'), so a mutant pset entry for Btot matches nothing and is dropped without a message. _get_mutant_model (1015-1016) explicitly allows '=' on a fixed parameter (ADR-0027). The BNGL-emit path (_override_param_block_values) and the bngsim backend both apply the same perturbation.

Failure scenario

BNGL with 'Btot = Atot*2' seeding B(a), and a condition or mutant 'KO: Btot = 0', with bngl_backend = bionetgen. The KO simulation is identical to wild type (AB(t=10)=99.90, Bfree(0)=200), and the KO data is scored against the WT trajectory. On bngsim the same mutant gives AB=0 and Bfree(0)=0.

Reproduction (independent re-run)

I ran .venv/bin/pybnf -c fit_bionetgen.conf -o and fit_bngsim.conf, which are identical except for the backend. pybnf was imported from pybnf/init.py.

  • bionetgen: best objective 39184.97. The KO mutant net Simulations/gen1ind2/ab2_gen1ind2ko.net still reads 2 Btot Atot*2 # ConstantExpression. The scored KO trajectory ab2_gen1ind2ko_ko.gdat has AB(0)=0, Bfree(0)=200, AB(1)=72.33 and AB(10)=90.94, byte-identical to the WT gdat.
  • Correct KO values: with Btot=0 there is no B, so AB(t)=0 and Bfree=0 for all t (worked out by hand, and matched by the bngsim run).
  • bngsim: best objective 0.0047 on the same conf.
  • Where 39185 comes from: it is almost exactly half the sum of the squared WT AB values, i.e. the KO data (AB=0) scored against the WT trajectory.
  • No warning: the run log has none about Btot. The exported Results/ab2_gen1ind2ko.bngl nonetheless says Btot 0.0.

Reachability

An edition-2 .conf using documented keys: model: ab2.bngl, bngl_backend = bionetgen, condition: ko, perturbations: Btot = 0, experiment: wt, data: wt.exp, experiment: ko, condition: ko, data: ko.exp, uniform_var = kf 0.009 0.011, job_type = de. The BNGL parameters block has Btot Atot*2, and B(a) is seeded with Btot. The legacy mutant = model KO Btot=0 : ko.exp goes through the same _get_mutant_model and copy_with_param_set path. bngl_backend = auto also reaches it whenever bngsim is unavailable or its bridge fails (base.py:698/702).

Where

pybnf/pset.py:1325

Found in a whole-codebase audit for silently wrong results (2026-09-23); the reproduction above was re-run independently of the original finding.

Dominant language
Python
Stars
25
Forks
25
Avg merge
2h 24m
Merged PRs (30d)
85

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lanl/PyBNF

All issues in lanl/PyBNF

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.