Using the SWITCHES database¶This example does the following:
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. Downloading a CSPACE file from the SWITCHES database¶1.1 Click on the "Bistable Models" in the left menu bar from the website homepage at http://switches.ncbs.res.in.¶1.2 Select a model configuration size. In this example, we select 3x3 i.e. 3 reactions between 3 reactants.¶1.3 Select a Model ID from this list. Here we pick M3x3.113.¶1.4 You can also search by configuration size or other parameters using the basic and advanced search functionality on the left menu bar.¶1.5 Save the CSPACE (or SBML) file for further use.¶
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):
readModel = open(model,'r')
modelData = readModel.readlines()
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)
2.2 Model ID is a hierarchical description of the model.¶
In [8]:
print(modelString)
2.3 Model string describes all the reactant and reactions in the reaction network.¶ |