## Stochastic Pi Machine (SPiM)

** Category** Cross-Omics>Agent-Based Modeling/Simulation/Tools

** Abstract** The Stochastic Pi Machine (SPiM) is a programming language for designing and simulating computer models of biological processes.

The language is based on a mathematical formalism known as the Pi-calculus (see below...), and the simulation algorithm is based on standard kinetic theory of physical chemistry.

The language features a simple graphical notation for modeling a range of biological systems, and can be used to model large systems incrementally, by directly composing simpler models of subsystems.

*Pi-calculus –-*

Basically, Pi-calculus is a model of computation for concurrent systems whose configuration may change during the computation in which “everything is a process” and all computation proceeds by communication on channels.

The syntax of Pi-calculus lets you represent parallel processes, synchronous communication between processes through channels, and non-determinism.

A process is an abstraction of independent threads. A channel is an abstraction of the communication between two (2) processes. Processes interact with each other by sending and receiving messages over channels.

The content of messages is also channels. As a result of such a communication event, the recipient process may now use the received channel for further communication.

This feature, called 'mobility', allows the network wiring to change with interaction. Stochastic Pi-calculus is an elegant approach to simulating the populations of biological molecules.

A system is defined by a flow chart that gives the rates of transitions between states, for example the rate of protein production. The simulator chooses among the possibilities at random simulation.

SPiM is a programming language for designing and simulating computer models of biological processes (as stated above...).

The language is based on Pi-calculus formalism and the simulation algorithm is based on chemical kinetics theory. The language can be used to model large systems incrementally by directly composing simpler models of subsystems.

*Historical facts in the development of Pi-calculus and SPiM --*

Pi-calculus has been used to describe many different kinds of concurrent systems from ‘mobile nets’ to business applications. Aviv Regev and Ehud Shapiro used stochastic Pi-calculus for a representation and simulation of ‘molecular pathways’ in computational biology (Priami et al., 2001).

Various Pi-calculus languages with particular formal syntaxes and semantics, as well as simulators for parallel processes were developed; the stochastic Pi-calculus was originally proposed by Corrado Priami in 1995, while Andrew Phillips and Luca Cardelli developed the SPiM language and designed a ‘stochastic simulator’ (Stochastic Pi-Machine, SPiM - see below...) that performed a Gillespie algorithm (Gillespie, 1977).

The machine has been formally specified and approved for the stochastic Pi-calculus; -- see [Phillips A (2009) An Abstract Machine for the Stochastic Bioambient calculus; *Electronic Notes in Theoretical Computer Science* 227: 143-159].

The SPiM simulator is available for free distribution on different platforms (Linux, MacOS X, and Windows).

SPiM Player, a graphical user interface (GUI) to SPiM was written by James Margetson and co-workers in F# language.

Molecular systems were described via these tools as collectives of interacting automata in artificial chemistry (Cardelli, 2009).

Recently, the SPiM calculus was promoted as a formal visual programming language for biology -- see -- [Phillips A (2009) *A Visual Process Calculus for Biology, Symbolic Systems Biology: Theory and Methods.* Jones and Bartlett Publishers in Press;

Available from Microsoft Research under Publications: Books.

This chapter presents a visual process calculus for designing and simulating computer models of biological systems. The calculus is based on a graphical variant of stochastic pi-calculus extended with mobile compartments, and the simulation algorithm is based on standard kinetic theory of physical chemistry.

The calculus forms the basis of a formal visual programming language for biology (SPiM). The basic primitives of the calculus are first introduced by a series of examples involving genes and proteins.

More complex features of the calculus are then illustrated by examples involving gene networks, cell differentiation, and immune system response.

The main benefit of the calculus is its ability to model large systems incrementally, by directly composing simpler models of subsystems.

The formal nature of the calculus also facilitates mathematical analysis of models, which in the future could help provide insight into some of the underlying properties of biological systems.

*The Stochastic Pi-Machine (SPiM) --*

The Stochastic Pi-Machine (SPiM) is a formal description of how a Stochastic Pi-calculus process can be executed. The machine is inspired by recent work on abstract machines for process calculi and uses list syntax, which is close to an implementation language.

The SPi-Machine executes a given process P by first encoding P into a list of summations with a number of top-level private names.

The machine then uses a stochastic selection algorithm based on [Gillespie, D. T., Exact stochastic simulation of coupled chemical reactions, *J. Phys. Chem.* 81 (1977), pp. 2340–2361.] to choose a particular channel X on which to perform a communication.

The procedure is repeated until No more communications are possible.

*Correctness of the Stochastic Pi-Machine --*

The correctness of the SPi-Machine is expressed in terms of five (5) main properties: Safety, Soundness, Completeness, Termination, and Duration.

1) Safety ensures that the machine does Not produce any run-time errors; and

2) Soundness ensures that the machine can only perform valid execution steps;

3) Completeness is a much stronger property, which ensures that the machine can accurately execute all possible behaviors of the calculus;

4) Termination ensures that the machine does Not loop forever unnecessarily; and

5) Duration ensures that each reduction in the machine takes the same length of time as the corresponding reduction in the calculus, and vice-versa.

*Manufacturer's Documentation on SPiM --*

1) An introductory chapter on SPiM.

2) Introductory slides on SPiM.

3) Basic SPiM examples and simulation results.

4) Coupled chemical reactions in SPiM.

5) The SPiM language definition.

6) Some 3D videos of SPiM simulations: Repressilator, Mapk and MHCI.

*Manufacturer's additional Links to tools --*

1) A tool for translating text narrative to SPiM, developed by Ozan Kahramanogullari;

PIM - SPiM - A Programming Interface for Modeling with SPiM.

*Note: PIM - SPiM is a tool which aims at making life easy while building models of biological systems.*

If you are interested in building a stochastic model of a (considerably large) biological system, you might like to describe the interactions of the species of the considered system as a model by writing down English sentences. Then you can use this tool to ‘translate’ these sentences into a SPiM program to run simulations on the model.

2) A tool for translating chemical reactions to SPiM, developed by Ozan Kahramanogullari.

3) A tool for translating Systems Biology Markup Language (SBML) to SPiM, developed by Claudio Eccher.

*System Requirements*

The SPiM simulator is available for free distribution on different platforms (Linux, MacOS X, and Windows).

*Manufacturer*

- Microsoft Research
- 7 JJ Thomson Avenue
- CB3 0FB Cambridge UK

** Manufacturer Web Site**
Stochastic Pi Machine (SPiM)

** Price** Contact manufacturer.

** G6G Abstract Number** 20600

** G6G Manufacturer Number** 101785