BioNetGen Quickstart
This quickstart gets you from installation to your first successful model run. If you are brand new to BioNetGen, start here.
Prerequisites
Complete the installation steps in Installation.
Confirm the CLI is available:
bionetgen -h
If this command fails, revisit Installation before continuing.
Run your first model
Create a file named SIR.bngl with the following content:
begin model
begin parameters
N 1.0e2
I0 1
R0 2.5
g 0.33
b g*R0/N
end parameters
begin species
S() N-I0
I() I0
end species
begin observables
Molecules S S()
Molecules I I()
Molecules R R()
end observables
begin reaction rules
R1: S + I -> I + I b
R2: I -> R g
end reaction rules
end model
# Actions
generate_network({overwrite=>1})
simulate({method=>"ode",t_end=>30,n_steps=>200})
Run the model:
bionetgen run -i SIR.bngl -o sir_output
You should now have an output folder sir_output containing simulation results.
What to check
Verify the run completed without errors in terminal output.
Open files in
sir_outputand confirm time-course data was generated.Re-run after changing parameters (for example
R0) and compare results.
Run from VS Code
If you prefer the VS Code extension workflow:
Open
SIR.bnglin VS Code.Use the extension run controls or command palette actions to execute the model.
Use the built-in graphing and visualization features for quick inspection.
Where to go next
For PyBioNetGen CLI details, see Command Line Interface.
For Python library usage, see Library.
For step-by-step tutorials, see Tutorials.