SWITCHES_example

# Using the SWITCHES database¶

This example does the following:

1. Downloads a bistable model from the SWITCHES database.
2. Describes how a model is written in SWITCHES format.
3. Describes how bistable parameters are extracted for the database using Latin Hypercube Sampling and by finding steady-states using MOOSE.
4. Demonstrates deterministic and stochastic time-course simulation in MOOSE to visualize bistability.
In [1]:
import warnings
warnings.filterwarnings("ignore")
warnings.simplefilter("ignore")

import requests
import moose
import matplotlib
%matplotlib notebook
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from string import ascii_lowercase as al
import numpy as np
import lhsmdu


### 1.5 Save the CSPACE (or SBML) file for further use.¶

This page displays the model structure on top with selected bistable model parameters and solutions. On top, you can see the chemical reaction on the left with corresponding chemical reaction network in the SBGN format on the right.

### 1.6 Alternatively, get the CSPACE file directly from Python¶

In [2]:
url = 'https://switches.ncbs.res.in/file/M3x3.113.62.cspace'
r = requests.get(url, allow_redirects=True)
open('M3x3.113.62.cspace', 'wb').write(r.content)


In [3]:
modelName = "M3x3.113.62.cspace"


## 2. SWITCHES format¶

In [4]:
def parseTopology(model):
elements = modelData[0].split(' ')
modelName, modelString, reactionPars = elements[0][:-1], elements[1], elements[2:]
return modelName, modelString, reactionPars

In [5]:
def findNumReacs(modelString, reactionPars):
''' Finds the number of molecules and reactions in the topology '''
reactionList = modelString.split('|')
reactionDim = len(reactionList)-2 ## To get rid of the first and the last empty list and each reaction has 2 rates
return reactionDim


### 2.1 SWITCHES format is a compact representation of a chemical reaction network.¶

It has three parts, model ID, model string, and the reaction parameters.

In [6]:
modelID, modelString, reactionPars = parseTopology(modelName)

In [7]:
print(modelID)

M3x3.113.62


### 2.2 Model ID is a hierarchical description of the model.¶

Level 1: M3x3 : Describes that the model has 3 reactants and 3 reactions respectively.

Level 2: 113 : Uniquely identifies the model string or the reaction network without the parameters.

Level 3: 62 : Uniquely identifies the reaction parameters of this reaction network.

In [8]:
print(modelString)

|AabX|DabX|Jbca|