Automatic exact reduction for the stochastic semantics of Chemical Reaction Networks


SaMBa is a Java tool for the automatic reduction of chemical reaction networks (CRN).

It exploits a novel reduction technique, the Syntactic Markovian Bisimulation for CRNs (SMB), bringing to the chemical context well-established reduction techniques for models of computation based on the notion of bisimulation.

The tool supports the discrete-state semantics of CRNs based on the law of mass action, providing a continuous time Markov chain (CTMC) for any given initial population (also known as the Chemical Master Equation of the CRN). An SMB is an equivalence among species of a CRN inducing an ordinary lumpable partition of its underlying CTMC, for any initial population of its species: two states of the CTMC are related if and only if they contain the same number of SMB-equivalent species.

An SMB-reduced CRN can be automatically computed, containing a species per block of SMB-equivalent species of the original CRN. The underlying CTMC of such reduced CRN is an aggregated, or lumped, version of the one of the original CRN.

The tool supports CRNs given in the .net format generated with the well-established tool BioNetGen version 2.2.5-stable. This allowed us to validate our bisimulation against a wide set of existing models in the literature.



The current version of the tool can be found here: SaMBa.


Currently, the tool has to be intended only as accompanying material for the recently submitted draft presenting our syntactic Markovian bisimulation: Luca Cardelli, Mirco Tribastone, Max Tschaikowski, and Andrea Vandin, Syntactic Markovian Bisimulation for Chemical Reaction Networks. The prototype will be soon be integrated in ERODE, offering a modern integrated development environment.

For the sake of reproducibility, SaMBa comes with all the models treated in the draft, stored in the folder “BNGNetworks”.

Our syntactic Markovian bisimulation can be applied by just running the following command

  java -Xmx4068M -jar SaMBa.jar -c reduceMODEL.crn

where MODEL can be any of the models discussed in the paper (M1, M2, M3, S1, S2, M5, M6, M7, S3).

The initial partition is always the trivial one containing one block only. The tool will create an SMB-reducion of MODEL, stored in the folder SMBBNGNetworks. The reduced model will also contain information about the computed partition of species, preceding each species with a comment listing all the species of the corresponding block.

Example: reducing S3

java -Xmx4068M -cp SaMBa.jar -jar SaMBa.jar -c reduceS3.crn

Importing: reduceS3.crn
No model defined in the input file. 

Importing: BNGNetworks/
Read parameters: 52, read species: 143, read reactions: 284. 

SMB partitioning BNGNetworks/ completed in 0.052 (s).
 From 143 species to 72 blocks (50.35% of original size).

Creating reduced model... completed in 0.016 (s).
Original model: BNGNetworks/
 284 reactions, 143 species. 
SMB reduced model: S3smb.
 142 reactions, 72 species. 

The current model is updated with the reduced one.

Writing to file SMBBNGNetworks/ ... completed

Where the first two reduced species in SMBBNGNetworks/ are (where # denotes comments)

begin species
#Representative of block (with 1 species):
 # S(A~0,E~0,F~0,Y~10P)

 1 S(A~0,E~0,F~0,Y~10P) 0.0
#Representative of block (with 2 species):
 # S(A~0,E~1,F~0,Y~U)
 # S(A~0,E~0,F~1,Y~20P)

 2 S(A~0,E~1,F~0,Y~U) 0.0

end species

Notes on supported input file formats: .net format

As discussed, the tool currently supports CRNs given in the .net format automatically generated from a BNGL file by the well-established tool BioNetGen version 2.2.5-stable. Such .net format is very compact, but not human readable. The following is a commented example of a simple .net file with 5 species and 4 reactions:

#Optional list of parameters. Each parameter is given in a line of this form:
 # id
 # name
 # value
#For example, the first parameter has id 1, name "a", and value 2.0
begin parameters
 1 a 2.0
 2 b 3.0
end parameters

#List of species. Each species is given in a line of this form
 # species id
 # name
 # initialConcentration
#For example, the first species has id 1, name "xA", and initial concentration 1.0
begin species
 1 xA 1.0
 2 xC 1.0
 3 xE 1.0
 4 xB 1.0
 5 xD 1.0
end species

#List of reactions. Each reaction is given in a line of this form
 # reaction id
 # comma separated list of reagents
 # comma separated list of products
 # rate (arithmetic expression of parameters and numbers)
#For example, the reaction has id 1, and can be written as "xA+xC -2.0-> xC+xE"
begin reactions
 1 1,2 2,3 a
 2 2,4 2,3 a
 3 2 1 b
 4 5 4 b
end reactions


For suggestions, remarks, bugs or requests please do not hesitate to contact any of us.