Other modelling languages
As well as models in the PRISM language, PRISM can work with models written in two other languages: the stochastic process algebra PEPA, and SBML, the Systems Biology Markup Language.
PEPA
For CTMCs, PRISM also accepts model descriptions in the stochastic process algebra PEPA [Hil96]. The tool compiles such descriptions into the PRISM language and then constructs the model as normal. The language accepted by the PEPA to PRISM compiler is actually a subset of PEPA. The restrictions applied to the language are firstly that component identifiers can only be bound to sequential components (formed using prefix and choice and references to other sequential components only). Secondly, each local state of a sequential component must be named. For example, we would rewrite:
P = (a,r).(b,s).P;
as:
P = (a,r).P';
P' = (b,s).P;
Finally, active/active synchronisations are not allowed since the PRISM
definition of these differs from the PEPA definition. Every PEPA
synchronisation must have exactly one active component.
Some examples of PEPA model descriptions which can be imported into PRISM
can be found in the prism-examples/pepa directory.
From the command-line version of PRISM, add the -importpepa switch and the model will be treated as a PEPA description.
From the GUI, select "Model | Open model" and then choose "PEPA models"
on the "Files of type" drop-down menu.
Alternatively, select "Model | New | PEPA model" and either type a description from scratch
or paste in an existing one from elsewhere.
Once the PEPA model has been successfully parsed by PRISM,
you can view the corresponding PRISM code (as generated by the PEPA-to-PRISM compiler)
by selecting menu option "Model | View | Parsed PRISM model".
SBML
PRISM includes a (prototype) tool to translate specifications in SBML (Systems Biology Markup Language) to model descriptions in the PRISM language. SBML is an XML-based format for representing models of biochemical reaction networks. The translator works with Level 2 SBML files (it was written for Level 2 Version 1); see the SBML specifications.
Since PRISM is a tool for analysing discrete-state systems, the translator is designed for SBML files intended for discrete stochastic simulation. A useful set of such files can be found in the CaliBayes Discrete Stochastic Model Test Suite. There are also many more SBML files available in the BioModels.
We first give a simple example of an SBML file and its PRISM translation. We then give some more precise details of the translation process.
Example
An SBML file comprises a set of species and a set of reactions which they undergo. Below is the SBML file for the simple reversible reaction: Na + Cl ↔ Na+ + Cl-, where there are initially 100 Na and Cl atoms and no ions, and the base rates for the forwards and backwards reactions are 100 and 10, respectively.
<?xml version="1.0" encoding="UTF-8"?>
<sbml xmlns="http://www.sbml.org/sbml/level2" metaid="_000000" level="2" version="1">
<model id="nacl" name="Na+Cl">
<listOfCompartments>
<compartment id="compartment"/>
</listOfCompartments>
<listOfSpecies>
<species id="na" initialAmount="100" hasOnlySubstanceUnits="true"/>
<species id="cl" initialAmount="100" hasOnlySubstanceUnits="true"/>
<species id="na_plus" initialAmount="0" hasOnlySubstanceUnits="true"/>
<species id="cl_minus" initialAmount="0" hasOnlySubstanceUnits="true"/>
</listOfSpecies>
<listOfReactions>
<reaction id="forwards" reversible="false">
<listOfReactants>
<speciesReference species="na"/>
<speciesReference species="cl"/>
</listOfReactants>
<listOfProducts>
<speciesReference species="na_plus"/>
<speciesReference species="cl_minus"/>
</listOfProducts>
<kineticLaw>
<math xmlns="http://www.w3.org/1998/Math/MathML">
<apply><times/><ci>forwards_rate</ci>
<apply><times/><ci>na</ci><ci>cl</ci></apply></apply>
</math>
<listOfParameters>
<parameter id="forwards_rate" value="100"/>
</listOfParameters>
</kineticLaw>
</reaction>
<reaction id="backwards" reversible="false">
<listOfReactants>
<speciesReference species="na_plus"/>
<speciesReference species="cl_minus"/>
</listOfReactants>
<listOfProducts>
<speciesReference species="na"/>
<speciesReference species="cl"/>
</listOfProducts>
<kineticLaw>
<math xmlns="http://www.w3.org/1998/Math/MathML">
<apply><times/><ci>backwards_rate</ci>
<apply><times/><ci>na_plus</ci><ci>cl_minus</ci></apply></apply>
</math>
<listOfParameters>
<parameter id="backwards_rate" value="10"/>
</listOfParameters>
</kineticLaw>
</reaction>
</listOfReactions>
</model>
</sbml>
And here is the resulting PRISM code:
// File generated by automatic SBML-to-PRISM conversion
// Original SBML file: nacl.xml
ctmc
const int MAX_AMOUNT = 100;
// Parameters for reaction forwards
const double forwards_rate = 100; // forwards_rate
// Parameters for reaction backwards
const double backwards_rate = 10; // backwards_rate
// Species na
const int na_MAX = MAX_AMOUNT;
module na
na : [0..na_MAX] init 100; // Initial amount 100
// forwards
[forwards] na > 0 -> (na'=na-1);
// backwards
[backwards] na <= na_MAX-1 -> (na'=na+1);
endmodule
// Species cl
const int cl_MAX = MAX_AMOUNT;
module cl
cl : [0..cl_MAX] init 100; // Initial amount 100
// forwards
[forwards] cl > 0 -> (cl'=cl-1);
// backwards
[backwards] cl <= cl_MAX-1 -> (cl'=cl+1);
endmodule
// Species na_plus
const int na_plus_MAX = MAX_AMOUNT;
module na_plus
na_plus : [0..na_plus_MAX] init 0; // Initial amount 0
// forwards
[forwards] na_plus <= na_plus_MAX-1 -> (na_plus'=na_plus+1);
// backwards
[backwards] na_plus > 0 -> (na_plus'=na_plus-1);
endmodule
// Species cl_minus
const int cl_minus_MAX = MAX_AMOUNT;
module cl_minus
cl_minus : [0..cl_minus_MAX] init 0; // Initial amount 0
// forwards
[forwards] cl_minus <= cl_minus_MAX-1 -> (cl_minus'=cl_minus+1);
// backwards
[backwards] cl_minus > 0 -> (cl_minus'=cl_minus-1);
endmodule
// Reaction rates
module reaction_rates
// forwards
[forwards] (forwards_rate*(na*cl)) > 0 -> (forwards_rate*(na*cl)) : true;
// backwards
[backwards] (backwards_rate*(na_plus*cl_minus)) > 0 -> (backwards_rate*(na_plus*cl_minus)) : true;
endmodule
// Reward structures (one per species)
// 1
rewards "na" true : na; endrewards
// 2
rewards "cl" true : cl; endrewards
// 3
rewards "na_plus" true : na_plus; endrewards
// 4
rewards "cl_minus" true : cl_minus; endrewards
From the latter, we can use PRISM to generate a simple plot of the expected amount of Na and Na+ over time (using both model checking and a single random trace from the simulator):

Using the translator
The SBML-to-PRISM translator is included in the PRISM code-base, but not integrated into the application itself.
cd prism
java -cp classes prism.SBML2Prism sbml_file.xml > prism_file.prism
If you are using a binary (rather than source code) distribution of PRISM, replace classes with lib/prism.jar in the above.
Alternatively (on Linux or macOS), ensure prism is in your path and then save the script below as an executable file called sbml2prism:
#!/bin/sh
# Startup script for SBML-to-PRISM translator
# Launch using main PRISM script
PRISM_MAINCLASS="prism.SBML2Prism"
export PRISM_MAINCLASS
prism "$@"
Then use:
sbml2prism sbml_file.xml > prism_file.prism
The following PRISM properties file will also be useful:
const double T;
const int c;
R{c}=? [I=T]
This contains a single property which, based on the reward structures in the PRISM model generated by the translator, means "the expected amount of species c at time T". The constant c is an integer index which can range between 1 and N, where N is the number of species in the model. To view the expected amount of each species over time, create an experiment in PRISM which varies c from 1 to N and T over the desired time range.
Details of the translation
The basic structure of the translation process is as follows:
-
Each species in the SBML file is represented by a module in the resulting PRISM file. This module, which (where possible) retains the SBML species id as its name, contains a single variable whose value represents the amount of the species present. A corresponding reward structure for computing the expected amount of the species at a given time instant is also created. Species for which the
boundaryConditionflag is set totruein the SBML file do not have a corresponding module. -
Each reaction in the SBML file is associated with a unique synchronisation action label. The module for each species which takes part in the reaction will include a synchronous command to represent this. An additional PRISM module called
reaction_ratesstores the expression representing the rate of each reaction (from the correspondingkineticLawsection in the SBML file). Reaction stoichiometry information is respected but must be provided in the scalarstoichiometryfield of aspeciesReferenceelement, not in a separateStoichiometryMathelement. -
Each parameter in the SBML file, either global to the file or specific to a reaction, becomes a constant in the PRISM file. If a value for this parameter is given, it is used. If not, the constant is left as undefined.
As described above, this translation process is designed for discrete systems and so the amount of each species in the model is represented by an integer variable. It is therefore assumed that the initial amount for each species specified in the SBML file is also given as an integer. If this is not the case, then the values will need to be scaled accordingly first.
Furthermore, since PRISM is primarily a model checking (rather than simulation) tool, it is important that the amount of each species also has an upper bound (to ensure a finite state space). When model checking, the efficiency (or even feasibility) of the process is likely to be very sensitive to the upper bound(s) chosen. When using the discrete-event simulation functionality of PRISM, this is not the case and the bounds can be set much higher. By default the translator uses an upper bound of 100 (which is increased if the initial amount exceeds this). A different value can be specified through a second command-line argument as follows:
cd prism
java -cp classes prism.SBML2Prism sbml_file.xml 1000 > prism_file.prism
Alternatively, upper bounds can be modified manually after the translation process.
Finally, the following aspects of SBML files are not supported and are ignored during the translation process:
- compartments
- events/triggers