Rule-Based Models: BioNetGen and Kappa
Position in the vault
Rule-based models replace opaque species (the places of Petri nets, the atoms of the sequent baseline) with structured agents with sites. They replace reactions with rewrite rules over site graphs. A rule is a resource-sensitive inference schema, closer to a first-order rule with pattern matching than to a propositional axiom. ← Dashboard
1. Theoretical Foundations & Syntax
Core primitives.
- Agents (molecules) with typed sites. Each site may carry an internal state (e.g. phosphorylation
u/p) and a binding state (free, or bound to another site). - Site graphs: mixtures of agents connected by bonds between sites. A complex is a connected component.
- Rules: graph-rewrite rules (with a rate constant) that may change internal states, create or break bonds, and create or delete agents.
- “Don’t care, don’t write”: sites not mentioned in are irrelevant to the rule. A single rule therefore stands for a potentially huge (even infinite) family of reactions between fully specified species.
- Semantics: the stochastic semantics is a CTMC over mixtures, where a rule’s propensity is its rate times the number of embeddings (matches) of into the mixture. BioNetGen can also expand rules into a reaction network and integrate ODEs. Kappa’s formal semantics is given as graph rewriting (Danos & Laneve, 2004, introduced the κ-calculus; later work uses a categorical, sesqui-pushout-style formulation).
Biochemical representation.
| Biochemistry | Rule-based representation |
|---|---|
| Protein with domains and residues | Agent with sites, e.g. EGFR(l, Y1068{u p}) |
| Phosphorylation state | Internal state of a site |
| Complex | Connected site graph (bond labels [1] in Kappa, !1 in BNGL) |
| Reaction class | Rule, with context left unspecified |
| Mass-action rate | Rate constant attached to a rule |
Syntax. Kappa uses A(x[.]) for a free site, A(x[1]), B(y[1]) for a bond and x{p} for an internal state. BNGL uses A(x) for a free site, A(x!1).B(y!1) for a bond and x~p for an internal state.
2. Applications in Biochemical Pathway Analysis
- Signalling cascades with combinatorial complexity: receptor tyrosine kinases (EGFR, FcεRI), scaffold proteins, multi-site phosphorylation, where the number of possible species grows exponentially with the number of sites.
- Signal transduction and immunology: early BioNetGen models of immunoreceptor signalling motivated the “rules for signal transduction” programme (Hlavacek et al., 2006).
- Polymerisation and aggregation, where the species set is unbounded and only rules can give a finite description.
Analysis techniques.
- Network generation (BioNetGen) followed by ODE, SSA or PLA simulation, when the generated network is finite and manageable.
- Network-free simulation (KaSim, NFsim): stochastic simulation directly on the agent graph, which avoids enumerating species.
- Static analysis (KaSa): contact maps (which sites can bind which), influence maps (which rules can enable or inhibit which), and reachable-local-state abstraction by abstract interpretation.
- Causal analysis: extraction and compression of causal stories, the minimal causally ordered sets of rule applications leading to an observable event (Danos et al., 2007).
- Model reduction: fragment-based exact ODE reduction.
Tools. BioNetGen (BNGL, with RuleBender as GUI), NFsim, the Kappa platform (KaSim simulator, KaSa static analyser, KaStor story extraction, web UI) (Boutillier et al., 2018), PySB (Python model building that exports to BNG and Kappa), and MCell / Smoldyn for spatial variants.
3. Comparison with Gentzen-Style Sequent Calculus
Structural & Conceptual Similarities
- Rules as inference schemas. A Kappa or BNGL rule is like a schematic inference rule with metavariables: it applies to every context that matches . Matching an embedding corresponds to instantiating a rule schema, much as first-order sequent rules are instantiated with terms.
- Context preservation. “Don’t care, don’t write” corresponds to the passive context in a left rule . The rest of the mixture is untouched (compare the frame rule of separation logic, itself a substructural logic).
- Resource sensitivity. Agents are conserved unless explicitly created or deleted, and a site can hold at most one bond. A matched pattern is consumed and rewritten, with no contraction or weakening of agents.
- Causal stories ≈ proofs modulo permutation. A story abstracts the interleaving of a trace to its causal partial order, much as proof nets or permutation-equivalence classes abstract sequent derivations from the order of independent rule applications.
- Static analysis ≈ meta-theory. Contact and influence maps are global, sound over-approximations about all derivations, analogous to meta-theorems such as subformula-like invariants on proofs.
Advantages over Gentzen-style Calculus
- Handles combinatorial complexity. A handful of rules can represent networks with millions of species. An atom-per-species sequent encoding is infeasible there.
- First-class kinetics. Rate constants, a CTMC semantics, ODE generation and stochastic simulation, none of which a sequent calculus offers.
- Scalable network-free simulation, whose cost depends on the number of agents rather than the number of possible species.
- Explanatory causal traces that biologists can read, the analogue of proof objects but automatically compressed.
- Mature toolchains (BioNetGen, KaSim/KaSa, PySB) and SBML export.
Disadvantages & Limitations vs. Gentzen-style Calculus
- No logical connectives. Rules are rewrite steps, not formulas. There is no implication, choice or negation to state goals or hypotheses inside the formalism, so queries are external (observables, temporal properties).
- No cut-elimination or subformula property. Composition of sub-pathways is not a primitive. Causal stories are extracted a posteriori from simulations rather than produced by an analytic proof search.
- Reachability is mainly checked by simulation, which is not exhaustive and gives no proof of non-reachability. Static analysis gives only over-approximations.
- Graph matching cost. Embedding search is a subgraph-isomorphism problem, NP-hard in general (tractable in practice thanks to Kappa’s rigid connected patterns).
- Correspondence to linear logic is informal. There is no standard theorem identifying Kappa reachability with provability in a named sequent calculus, which is why the score is “Medium” rather than “High”.
4. Concrete Biochemical Example
Model the product as the substrate in a modified state (x{p}), so becomes binding, unbinding and modification.
Kappa (KaSim 4 syntax)
%agent: E(s)
%agent: S(e x{u p})
%var: 'k_on' 1.0E-3
%var: 'k_off' 0.1
%var: 'k_cat' 1.0
'bind/unbind' E(s[.]), S(e[.] x{u}) <-> E(s[1]), S(e[1] x{u}) @ 'k_on', 'k_off'
'catalysis' E(s[1]), S(e[1] x{u}) -> E(s[.]), S(e[.] x{p}) @ 'k_cat'
%init: 100 E()
%init: 1000 S(x{u})
%obs: 'Product' |S(x{p})|BioNetGen (BNGL)
begin parameters
kon 1e-3
koff 0.1
kcat 1.0
end parameters
begin molecule types
E(s)
S(e,x~u~p)
end molecule types
begin seed species
E(s) 100
S(e,x~u) 1000
end seed species
begin reaction rules
E(s) + S(e,x~u) <-> E(s!1).S(e!1,x~u) kon, koff
E(s!1).S(e!1,x~u) -> E(s) + S(e,x~p) kcat
end reaction rules
begin observables
Molecules Product S(x~p)
end observablesSite-graph notation. This is the usual mathematical notation of the Kappa literature:
- A superscript is a bond label, so means site is bound via bond .
- A subscript is an internal state, so means site is in state .
- A bare site is free.
The two KaSim rules above read:
The complex is the connected site graph , i.e. two agents joined by bond . The product is the free, modified agent .
Gentzen-style contrast. In the sequent encoding, is an opaque atom and the reactions are left rules (read bottom-up as forward reactions):
The rule-based version uses structured atoms: agents with sites, states and bond names. Read each site-graph pattern as a first-order atom, with the bond label as a variable. The Kappa rules then become schematic sequent rules:
What the schematic reading shows:
- Fresh bonds. The side condition on is the analogue of the eigenvariable condition: a newly created bond must not clash with any bond already in the mixture .
- Linear bonds. Each bond label occurs exactly twice, once per endpoint, so bonds are resources too.
- “Don’t care, don’t write”. The agents’ unmentioned sites live inside the passive context .
| Aspect | Kappa / BNGL | Sequent calculus |
|---|---|---|
| Species | Site graph; complex structure visible | Atom ; opaque |
| Rule scope | Any context matching the pattern | Exactly the formulas named in the rule; passive |
| Bond identity | Bond label [1] / !1 | Would need fresh names (eigenvariable-like), compare in π-calculus |
| Kinetics | @ 'k_on', CTMC/ODE | none |
| Witness | Trace or causal story | Proof tree |
If had independent phosphosites, the sequent and Petri encodings would need up to atoms or places, while the rule-based model still needs only one rule per site.
5. Key Literature & References
Mandatory core references
- Danos, V., & Laneve, C. (2004). “Formal molecular biology.” Theoretical Computer Science, 325(1), 69–110.
- Introduces the κ-calculus, the formal foundation of Kappa, giving a rewriting semantics to protein–protein interactions with sites and bonds.
- Faeder, J. R., Blinov, M. L., & Hlavacek, W. S. (2009). “Rule-based modeling of biochemical systems with BioNetGen.” Systems Biology (Methods in Molecular Biology), 500, 113–167.
- The standard tutorial and reference for BNGL syntax, network generation and simulation in BioNetGen.
- Danos, V., Feret, J., Fontana, W., Harmer, R., & Krivine, J. (2007). “Rule-based modelling of cellular signalling.” CONCUR 2007 – Concurrency Theory, LNCS 4703, 17–41.
- Presents Kappa-based modelling of signalling with causal analysis (“stories”), the closest rule-based analogue of proof objects.
- Boutillier, P., Maasha, M., Li, X., Medina-Abarca, H. F., Krivine, J., Feret, J., Cristescu, I., Forbes, A. G., & Fontana, W. (2018). “The Kappa platform for rule-based modeling.” Bioinformatics, 34(13), i583–i592.
- Describes the current Kappa toolchain (KaSim, KaSa, causal analysis, UI) used for simulation and static analysis.
Additional references
- Hlavacek, W. S., Faeder, J. R., Blinov, M. L., Posner, R. G., Hucka, M., & Fontana, W. (2006). “Rules for modeling signal-transduction systems.” Science’s STKE, 2006(344), re6.
- The programmatic paper arguing that combinatorial complexity in signalling requires rule-based, rather than species-based, modelling.
- Sneddon, M. W., Faeder, J. R., & Emonet, T. (2011). “Efficient modeling, simulation and coarse-graining of biological complexity with NFsim.” Nature Methods, 8(2), 177–183.
- Introduces network-free simulation for BNGL models, the main scalability advantage over enumerative (and proof-search) approaches.
Related: Gentzen_Style_Calculus · Petri_Nets_and_Linear_Logic (flat species) · Linear_Logic_and_Rewriting_Logic_Zsyntax (term rewriting) · Process_Calculi_Pi_Calculus_BioPEPA_BIOCHAM (names as bonds) · Boolean_Networks · 00_Dashboard_and_Comparison