Examples

Example 1: Model selection with ABC SMC – SIR models using ODEs

We illustrate an example of the ABC SMC algorithm for model selection using a range of simple models that describe the epidemiology of infections diseases. This example reproduces the ndings of Toni et al. (2009). As described by Toni et al., SIR models describe the spread of such disease in a population of susceptible (S), infected (I) and recovered (R) individuals (Anderson & May, 1991). The three models used for this example use systems of ordinary differential equations (ODEs) to describe the change in the number of S, I and R indivuduals over time (See manual for details).
SIR1 SIR2 SIR3

 

 

 

The package abc-sysbio is primarily written to handle SBML models. The BioModels Database (Le Novere et al., 2006), a database of SBML models, contains mathematical models of biological interest. These SIR models, however, are not available from the BioModels database, so SBML models have been constructed for the purpose of this example. To construct the models, we make use of SBML shorthand and its conversion tools (Gillespie et al., 2006), and construct the three SIR models, SIRmodel1.xml, SIRmodel2.xml and SIRmodel3.xml.

Requires: scipy, libsbml, numpy, matplotlib
First change into the Example1 directory
cd Example1
To run:
python -u run-abc-sysbio --infile input_file_SIR.xml -f -of=res --timing
To run inferring initial conditions:
python -u run-abc-sysbio --infile input_file_SIR_x0.xml -f -of=res_x0 --timing
To run inferring initial conditions using component-wise normal kernels:
python -u run-abc-sysbio --infile input_file_SIR_x0_normk.xml -f -of=res_x0_normk --timing
To run using the automated epsilon scheduling:
python -u run-abc-sysbio --infile input_file_SIR_auto.xml -f -of=res_auto --timing

SIR posterior model 1

 

Particle scatter plots for Model 1 as the algorithm progresses for the fixed epsilon schedule

 

 

 

 

 

 

 

 

SIR model posterior

 

Model posterior as the algorithm progresses for the fixed epsilon schedule

 

 

 

 

 

 

 

 

 

Example 2: Linear growth model using SDEs

In this section we perform ABC SMC for parameter inference in a stochastic linear growth model. This model is an instance when the exibility of the package is useful. The noise terms in the Python representation of the model automatically generated by the program are too large for the model to be simulated efficiently. In this example the Python file has been edited to reduce the magnitude of the noise terms.

Requires: numpy, matplotlib
First change into the Example2 directory
cd Example2
To run:
python -u run-abc-sysbio --infile input_file_lingrow.xml -f -of=res --timing --localcode
To run with component-wise normal kernels:
python -u run-abc-sysbio --infile input_file_lingrow_normk.xml -f -of=res_normk --timing --localcode

Growth timeseriesGrowth P1 posteriorGrowth P2 posterior
Posterior parameter distribution

 

Growth fitted timeseries

 

 

Simulated data with parameters from the posterior distribution (lines) and the data (dots)

 

 

 

 

 

 

Example 3: Dimerisation reaction using Markov jump process and Gillespie algorithm

In an even simpler case than that described in Example 2, specifying a single epsilon will return a single population of accepted parameters, e ectively implementing the ABC rejection algorithm (Pritchard et al., 1999). We give an example using the dimerisation model of Wilkinson (2006). This model has been written with appropriate rate laws for a discreet stochastic simulation using Gillespie’s direct method (Gillespie, 1977).

The procedure for using abc-sysbio to implement the ABC rejection algorithm follows that of the use of the package to implement ABC SMC. By specifying a single epsilon together with a size for the population of accepted particles, a single population of accepted parameters is returned.

Requires: libsbml, numpy, matplotlib
First change into the Example3 directory
cd Example3
To run:
python -u run-abc-sysbio --infile input_file_dimerisation.xml -f -of=res --timing
To run using automated epsilon schedule:
python -u run-abc-sysbio --infile input_file_dimerisation_auto.xml -f -of=res_auto --timing

Dimerisation P1 posteriorDimerisation P2 posterior
Posterior parameter distributions for the 2 parameters of the dimerisation model

 

 

Dimerisation fitted timeseries
Simulated data with parameters from the posterior distribution (lines) and the data (dots)

 

 

 

 

 

Example 4: Stochastic immigration-death and logistic growth model selection

In this example some data has been simulated under a stochastic immigration-death model. We then perform model selection using a stochastic immigration death model and a stochastic logistic growth model.

Requires: libsbml, scipy, numpy, matplotlib
First change into the Example4 directory
cd Example4
To run using MJP modelling:
python -u run-abc-sysbio --infile input_file_pop_mjp.xml -f -of=res_mjp --timing
To run using SDE modelling:
python -u run-abc-sysbio --infile input_file_pop_sde.xml -f -of=res_sde --timing
To run using ODE modelling:
python -u run-abc-sysbio --infile input_file_pop_ode.xml -f -of=res_ode --timing

Pop timeseries MJPPop timeseries SDE

Pop timeseries ODE
Simulated data with parameters from the posterior distribution (lines) and the data (dots) for the immigration death model assuming a MJP, SDE and ODE.

 

 

 

 

 

Example 5: Repressilator model using ODEs

This is an other example to do parameter inference using ABC SMC. The aim is to infer the 4 parameter of the repressilator model (M.B. Elowitz and S. Leibler, 2000 ). Note that running in python mode produces warnings from odeint in scipy that cannot be switched off so we recommend running in c++ mode.

Requires: scipy, numpy, matplotlib
First change into the Example5 directory
cd Example5
To run:
python -u run-abc-sysbio --infile input_file_repressilator.xml -f -of=res --c++
To run using automated epsilon schedule:
python -u run-abc-sysbio --infile input_file_repressilator_auto.xml -f -of=res_auto --c++

Repressilator posterior
Posterior parameter distributions for the repressilator