BioNetGen Rule-Based Biochemical Networks (.bngl)
@modelscript/bngl (languages/bngl) provides native WebAssembly GLR parsing, rule-based site-specific biochemical network expansion, observable pattern aggregation, 4th-order Runge-Kutta ODE integration, DAEBuilder lowering, and SBML / Modelica projections for BioNetGen Language (BNGL) multiprotein signaling, receptor oligomerization, and post-translational modification models.
Supported Extensions & Standards
| Extension | Format | Description |
|---|---|---|
.bngl | BioNetGen Model | Block-structured rule-based biochemical specification (parameters, molecule types, seed species, observables, reaction rules, actions) |
Key Capabilities
1. Site-Specific Molecule Types & Bond Graphs
- Parses structured BNGL blocks:
molecule types: Multi-component proteins with internal phosphorylation/conformational states (e.g.,EGFR(L,CR1,Y1068~U~P)).seed species: Initial molecular complexes with explicit site bonds (!1,!+,!?,!.).observables:MoleculesandSpeciespattern queries aggregating phosphorylated or bound sub-complexes.reaction rules: Unidirectional (->) and bidirectional (<->) site-transformation and binding rules without combinatorial manual enumeration.
2. Automated Network Expansion & ODE Simulation
- Iteratively applies reaction rules to seed species to generate the reachable species and elementary reaction network (
generateNetwork/solveBngl). - Integrates species concentration trajectories and observable outputs, and lowers the expanded network into
@modelscript/runtime'sDAEBuilderarena, SBML (bnglToSbml), and Modelica 3.x (bnglToModelica).
Pre-Flight Diagnostics
10 rules8 error2 warning
| Code | Rule | Severity | Message |
|---|---|---|---|
M9051 | molecule-type-undeclared | error | Molecule type '<moleculeName>' referenced in '<context>' is not declared in 'molecule types'. |
M9052 | component-site-undeclared | error | Component site '<siteName>' is not declared on molecule type '<moleculeName>'. |
M9053 | invalid-internal-state | error | Internal state '~<stateName>' is not allowed for component '<siteName>' of molecule type '<moleculeName>'. |
M9054 | dangling-bond-label | error | Bond label '!<bondLabel>' in complex pattern '<patternText>' appears '<count>' times; each bond must connect exactly 2 sites. |
M9055 | undefined-rate-parameter | warning | Reaction rule '<ruleId>' references undeclared rate parameter '<parameterName>'. |
M9056 | reversible-rule-missing-reverse-rate | error | Reversible reaction rule '<ruleId>' ('<->') is missing a reverse rate constant. |
M9057 | negative-seed-concentration | error | Seed species '<speciesPattern>' has negative initial concentration '<concentration>'. |
M9058 | empty-bionetgen-model | error | BioNetGen model '<modelName>' contains no molecule types, seed species, or reaction rules. |
M9059 | duplicate-observable-name | error | Observable '<observableName>' is defined multiple times in 'observables'. |
M9060 | unbounded-polymerization-rule | warning | Reaction rule '<ruleId>' forms intermolecular bonds on multi-site molecule '<moleculeName>' that can cause unbounded polymerization. |
Generated from languages/bngl/src/errors.ts. All languages →
CLI Usage
bash
# Validate molecule site states, bond indices, and reaction rate constants
msx lint EgfrSignaling.bngl
# Parse and inspect BioNetGen blocks
msx parse EgfrSignaling.bngl
