The table-function guide says BioNetGen writes a tfun into the .net, but the released BioNetGen 2.9.3 aborts on every tfun(...) spelling: Model.from_bngl raises 'Expecting operator argument', and nothing says a newer BioNetGen is needed
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 77/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- python
- Domain
- documentation
Research direction
Start with docs/user-guide/table-functions.md and loading-models.md, which the issue identifies as giving incomplete BioNetGen guidance. Clarify that BioNetGen 2.9.3 rejects tfun(...) in BNGL and explain the supported .net or Python API route; the issue suggests noting that BNGL use needs a newer BioNetGen. Done when both guides clearly state the version limitation and working alternatives.
Written by the indexing model from the issue text.
Description
docs/user-guide/table-functions.md reads as though BioNetGen writes a tfun() into the .net it generates. The released BioNetGen, 2.9.3, does not accept tfun(...) in a BNGL functions block at all. That is the BioNetGen the docs point to: loading-models.md names BNGPATH=/path/to/BioNetGen-2.9.3, and the bngl extra brings PyBioNetGen, which bundles 2.9.3. A user who declares a table function in BNGL with those tools gets a ModelError from Model.from_bngl. The failure is loud, and no number is wrong. What is missing is a sentence saying which BioNetGen is needed.
Found while checking a lead of #1532 (the one filed as #1657). Reproduced on bngsim 0.17.1 (the PyPI wheel, macOS arm64, Python 3.12) with BioNetGen 2.9.3.
What the guide says
- "The index may also be written as a call,
A_tot()ortime(), as BioNetGen writes it into the.netwhen the model does; it names the same thing." - "... so one
.tfunfile works across the spellings BNG accepts. This matches BioNetGen'sTfunReader.pm." Release 2.9.3 has noPerl2/TfunReader.pm.
The guide also gives the route that does work with the released tools: "In a .net file, it is parsed automatically", and "No change to BNG2.pl is required, so tfun() can be added to a .net file by hand or built through the Python API." It never shows a tfun in BNGL, and it never says that the released BioNetGen rejects one.
Repro (python repro.py; needs BNGPATH pointing at BioNetGen 2.9.3)
"""A tfun in a BNGL functions block, loaded with the released BioNetGen 2.9.3. Needs BNGPATH."""
import os
import tempfile
import bngsim
BNGL = """begin model
begin molecule types
A()
end molecule types
begin seed species
A() 0
end seed species
begin functions
F() = tfun([0,10,12,50],[0,5,0,0], time, method=>"step")
end functions
begin reaction rules
0 -> A() F()
end reaction rules
end model
"""
path = os.path.join(tempfile.mkdtemp(), "m.bngl")
with open(path, "w") as fh:
fh.write(BNGL)
try:
bngsim.Model.from_bngl(path)
print("loaded")
except Exception as exc:
lines = str(exc).splitlines()
print(type(exc).__name__ + ":", lines[0])
print("\n".join(line for line in lines if "ABORT" in line or "BioNetGen version" in line))
ModelError: BNG2.pl generated no network from m.bngl (exit 1). BNG2.pl said:
BioNetGen version 2.9.3
ABORT: Expecting operator argument in tfun([0,10,12,50],[0,5,0,0], time, method=>"step") at [0,10,12,50],[0,5,0,0], time, method=>"step")
In the check, the release aborted in the same way on each spelling the guide lists: inline data or a file, indexed by time, a parameter, an observable or a function. Its own older spelling, TFUN(Atot, 'dose.tfun'), aborts with "TFUN functions are not supported for non-NFsim simulators." A development BioNetGen accepted every file and wrote the tfun line into the .net. It prints the same version string, "BioNetGen version 2.9.3", so a user cannot tell the two apart by version.
What might be done
It may be best to say, near the top of the guide and in loading-models.md, that a tfun in BNGL needs a BioNetGen newer than release 2.9.3, and that with the released BioNetGen a table function is added to the .net by hand or through Model.add_table_function. Perhaps Model.from_bngl could also add a line to its error when BNG2.pl's abort names tfun(.
Not covered by
No open or closed issue. #709's body notes in passing that BNG2.pl 2.9.3 cannot parse tfun(...).
- Dominant language
- Python
- Stars
- 3
- Forks
- 5
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 361
Getting set up
- No Dockerfile or Docker Compose file
- No 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
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
net_to_sbml refuses a derived parameter that uses _pi() or _e(): BNG2.pl writes "k2 _pi()*k1" in the .net, and converting it raises "function call(s) '__bngsim_const_pi__' that net2sbml cannot translate to MathML"Possibly taken A pull request linked to this issue is open or already merged. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 68/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 1/5 1-3 hours Newbie friendliness 91/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
-
agents nolte-linux security skills
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nolte/claude-shared#732 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 2 days
-
[Bug] Source archive filter: dry run excludes SystemVerilog (.sv) files with no preflight warningOpen
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
FinanceFlash/unvibecode#906 ·
Maintainers usually reply within 1 day