Model.set_concentration needs the network's exact species name, where BNG2.pl's setConcentration finds the species by pattern
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 57/100
Research direction
Start by reading Model.set_concentration and Model._species_call, which the issue identifies as the lookup path. Compare their behavior with BNG2.pl’s pattern matching on network species, using the supplied model and names as reproduction cases. Done means reordered components and omitted empty parentheses resolve to the matching species, while unmatched names still raise ModelError.
Written by the indexing model from the issue text.
Description
Model.set_concentration says it implements BioNetGen's setConcentration("name", value) action. BNG2.pl's action finds the species by matching the name as a pattern, so A(y,x) finds the species the network writes as A(x,y), and B finds B(). bngsim accepts only the name exactly as the network file writes it, or that name without a fixed species' $. Anything else raises ModelError.
To reproduce, run BNG2.pl 2.9.3 on this model:
begin model
begin parameters
k 0.1
end parameters
begin molecule types
A(x,y)
B()
end molecule types
begin seed species
A(x,y) 100
B() 100
end seed species
begin observables
Molecules Atot A()
Molecules Btot B()
end observables
begin reaction rules
A() -> 0 k
B() -> 0 k
end reaction rules
end model
generate_network({overwrite=>1})
setConcentration("A(y,x)", 50)
setConcentration("B", 30)
writeNET({prefix=>"after"})
The network BNG2.pl writes after the two actions, after.net, has A(x,y) at 50 and B() at 30. Then, with the names.net that generate_network wrote:
import bngsim
model = bngsim.Model.from_net("names.net")
for name, value in [("A(x,y)", 50), ("A(y,x)", 50), ("B()", 30), ("B", 30)]:
try:
model.set_concentration(name, value)
print(f"{name!r}: set to {model.get_concentration(name)}")
except Exception as exc:
print(f"{name!r}: {type(exc).__name__}: {exc}")
prints
'A(x,y)': set to 50.0
'A(y,x)': ModelError: Species 'A(y,x)' not found in model
'B()': set to 30.0
'B': ModelError: Species 'B' not found in model
This was run on bngsim 0.17.0. Model._species_call on main does the same lookup.
This matters to any caller that replays a BNGL model's actions on bngsim. PyBNF hit it in 16 published models in its test corpora, including An_2009, the Mitra2019 JNK fits and egfr_path. Their setConcentration names a species with its components in another order, or without (). PyBNF used to log the error and skip the action, so these models ran from the wrong amounts. Since lanl/PyBNF#1053 it runs them on BNG2.pl instead.
A fix could find the species the way BNG2.pl does: match the name against the network's species, and refuse a name that matches none.
- 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