
BioNetGen (BNG) VS Code Extension
A VS Code extension for the BioNetGen rule-based modeling platform. Write, validate, simulate, and visualize BioNetGen models without leaving the editor. See the starter guide for an introduction.
Features
- Syntax Highlighting: Scoping for all BNGL constructs, with dark, light, and high-contrast themes.
- Language Server: Real-time diagnostics (mismatched blocks, duplicate definitions, unused parameters), autocomplete for block types, actions, parameters, molecule types, and built-in functions, go-to-definition, find references, and hover information.
- Intelligent Folding: Fold
begin/end blocks and metadata sections.
- Simulation: Run BioNetGen simulations directly from the editor and monitor processes in a sidebar tree view.
- Network Visualization: Generate contact maps, rule visualizations, and regulatory graphs.
- Interactive Plotting: Plot
.gdat/.cdat/.scan results with a built-in viewer featuring variable selection, axis scale toggles, line style controls, and image export.
- Snippets: Expand block skeletons, line templates, action calls, and math functions with
Tab.
Usage
- Open or create a
.bngl file. Syntax highlighting and language server features activate automatically.
- Click the BioNetGen icon in the editor title bar to open the command menu. From the dropdown you can:
- Run Simulation (
Ctrl/Cmd+Shift+F1 on .bngl files)
- Visualize Network
- Open Plot / Viewer (
Ctrl/Cmd+Shift+F1 on .gdat/.cdat/.scan files)
- Install/Check PyBioNetGen
- Upgrade PyBioNetGen
- After a simulation completes, the resulting
.gdat file opens automatically. Click the BioNetGen icon to launch the interactive plot viewer.
- Use the sidebar controls in the plot viewer to toggle variables on/off, switch axis scales (linear/log), change line styles, toggle the legend, and export images.
Requirements
The editing features (highlighting, diagnostics, autocomplete, navigation) work out of the box. To run simulations and visualizations you also need:
Installation
The extension is available on the VS Code Marketplace: search for BioNetGen in the Extensions tab.
For installation from a VSIX package or running from source, see the installation guide.
Snippets
Type a prefix and press Tab to expand. All snippets are available in .bngl files.
Block Snippets
| Prefix |
Description |
begin model |
Full model skeleton with all standard blocks |
begin parameters |
Parameters block |
begin molecule types |
Molecule types block |
begin compartments |
Compartments block |
begin seed species |
Seed species block |
begin species |
Species block |
begin observables |
Observables block |
begin functions |
Functions block |
begin reaction rules |
Reaction rules block |
begin population maps |
Population maps block |
begin energy patterns |
Energy patterns block |
Line Snippets
| Prefix |
Description |
Molecule |
Molecule with component and state |
MoleculeType |
Molecule type definition with two states |
Species |
Species pattern with bond |
CompartmentLine |
Compartment definition |
ParameterLine |
Parameter name/value pair |
SpeciesLine |
Species with amount |
ObservableLine |
Observable (Molecules or Species) |
FunctionLine |
Function definition |
RuleLine |
Reaction rule with rate |
EnergyPatternLine |
Energy pattern with expression |
PopulationMapLine |
Population map rule |
Action Snippets
| Prefix |
Description |
generate_network |
Generate network action |
generate_hybrid_model |
Generate hybrid model action |
simulate |
Simulate with method, t_end, n_steps |
parameter_scan |
Parameter scan with all options |
bifurcate |
Bifurcation analysis |
readFile |
Read file action |
writeFile |
Write file (bngl/net/xml) |
writeModel |
Write model |
writeNetwork |
Write network |
writeXML |
Write XML |
writeSBML |
Write SBML |
writeMfile |
Write M-file |
writeMexfile |
Write MEX-file |
writeMDL |
Write MDL |
visualize |
Visualize action |
setConcentrations |
Set species concentration |
addConcentration |
Add to species concentration |
saveConcentrations |
Save current concentrations |
resetConcentrations |
Reset concentrations |
setParameter |
Set parameter value |
saveParameters |
Save current parameters |
resetParameters |
Reset parameters |
setModelName |
Set model name |
substanceUnits |
Set substance units |
version |
Set version |
setOption |
Set option |
quit |
Quit action |
Math Functions
abs, sin, cos, tan, exp, ln, log10, floor, ceil, sqrt, asin, acos, atan, sinh, cosh, tanh, asinh, acosh, atanh
Settings
| Setting |
Description |
Default |
bngl.general.auto_install |
Automatically install PyBioNetGen on activation |
true |
bngl.general.enable_terminal_runner |
Use the old terminal-based runner instead of spawning processes |
false |
bngl.general.auto_open |
Automatically open result files (e.g. .gdat) after a simulation run |
true |
bngl.general.result_folder |
Absolute path to a default results folder (used when no workspace is open) |
null |
bngl.plotting.legend |
Show the plot legend by default |
true |
bngl.plotting.max_series_count |
Maximum number of time series to display initially |
50 |
Development
See the developer guide for architecture details and build instructions. Quick start:
npm install
npm run watch # start build in watch mode
# Press F5 to launch the Extension Development Host
Please submit issues and feature requests at GitHub.
Resources
| |