cbsa

A Python package to simulate biochemical systems using the Constraint-Based Simulation Algorithm


License
MIT
Install
pip install cbsa==0.1.0

Documentation

Constraint-Based Simulation Algorithm (CBSA)

CBSA is a Python package for simulation of biochemical systems using the Constraint-Based Simulation Algorithm.

PyPI PyPI - License PyPI - Python Version

Table of contents

Installation

CBSA can be installed on your computer using pip.

Just run the following command:

python3 -m pip install cbsa --user --upgrade

Usage

CBSA

Simple reaction example

Consider the following reaction system:

equation

Using the Constrain-Based Modeling, the Stoichiometric matrix becomes:

equation

A sample code to simulate this system is:

from cbsa import ReactionSystem
import matplotlib.pyplot as plt
import numpy as np

S = [[-1, 1, 0],
     [ 1,-1,-1],
     [ 0, 0, 1]]

R = [[0,0,0],
     [0,0,0],
     [0,0,0]]

x0 = [50,0,0]
k = [0.5,0.1,0.8]
max_dt = 0.1
alpha=0.5
total_sim_time = 10

cbsa = ReactionSystem(S,R)

cbsa.setup()
cbsa.set_x(x0)
cbsa.set_k(k)

cbsa.setup_simulation(use_opencl=False,alpha=alpha,max_dt=max_dt)
cbsa.compute_simulation(total_sim_time)
cbsa_data = np.array(cbsa.simulation_data)

plt.plot(cbsa_data[:,0],cbsa_data[:,1],label="A")
plt.plot(cbsa_data[:,0],cbsa_data[:,2],label="B")
plt.plot(cbsa_data[:,0],cbsa_data[:,3],label="C")
plt.legend()
plt.show()

example 1 image

To run the algorithm using your GPU, set use_opencl=True. It will require the python package pyopencl.

License

CBSA is licensed under the MIT License. Please see the file LICENCE for more information.