Stochastic simulation of Boolean network with MaBoSS

Stochastic simulation of Boolean network with MaBoSS#

This notebook show the basic features of the maboss Python module by reproducing part of the official MaBoSS tutorial at https://maboss.curie.fr/pub/TutorialMaBoSS_2_0.pdf

import maboss
import ginsim

Model#

The input model is a simple Boolean network created with GINsim. We download it from MaBoSS website and display its regulatory graph using the ginsim Python module:

lrg = ginsim.load("https://maboss.curie.fr/pub/example.zginml")

Downloading https://maboss.curie.fr/pub/example.zginml

ginsim.show(lrg)

Building the Simulation object#

A GINsim model can be converted to MaBoSS using the to_maboss function:

masim = ginsim.to_maboss(lrg)

MaBoSS allows to specify some nodes as “internal”: the value of internal nodes is hidden in the output of simulations. By default, (if the network was built from scratch or if the .cfg file did not contain the information for a given node), all nodes have the attribute is_internal set to False. This can be changed within the script

masim.network['DNAdam'].is_internal = True

You can change other MaBoSS parameters with the function update_parameters:

masim.update_parameters(time_tick=0.1, max_time=4)

Once all the parameters are set, you can run the simulation. The following line will create two temporary files that contains everything MaBoSS needs to know to run properly. The result of the simulation are stored in a Result object.

To run the simulation, use the command below. This command can be quickly written by going to MaBoSS -> Simulation -> run.

Performing simulations#

The run method of the simulation object will call MaBoSS to perfom the requested simulations. A result object is then returned.

res = masim.run()

Result visualizations#

The result object provides access to the simulation output, and provides simple plotting functions.

The plot_trajectory method displays the mean probability of each state (composed of non-internal nodes) along time:

res.plot_trajectory()
../../_images/e50f3f8112fcf28b6682a3021f192f9f6f0dfb11cb30f556a844bbff90475e72.png

The plot_piechart method displays the proportion of states in which each simulation ended, providing an approximation of the probability to reach the different attractors.

res.plot_piechart(autopct=True)
../../_images/792989b510f9eac0691366218239099fc6cfdf9afc1241801df724fd7603ba0f.png

Simulating mutations#

The maboss Python module allow to modify a network model to perform the mutation of a node, that is forcing its value to be always 1 (“ON”) or always 0 (“OFF”).

In the following cell, we copy the initial model and configure a gain of function mutant for the node Mdm2nuc:

mutsim = masim.copy()
mutsim.mutate("Mdm2nuc", "ON")

The resulting model can then be simulated:

mutres = mutsim.run()
mutres.plot_piechart()
../../_images/43956d1f505c04c1cbfac70e11ad9dedfc8432913b8364cb7d454d29da3e2a2e.png