Accessing Models from the database

This example describes how to access models from BioModels and JWS. Further databases could be easily added later on.

BioModels

[1]:
import sys
if '../..' not in sys.path:
    sys.path.append('../..')

import basico.biomodels as biomodels

the BioModels REST API allows searching for models, just as one would do in the web interface on http://biomodels.net. So one can search by pathway, species or reactions or submitter / author by just entering them.

[2]:
glycolysis_models = biomodels.search_for_model('glycolysis')
for model in glycolysis_models:
    print ('Id: %s' % model['id'])
    print ('Name: %s' % model['name'])
    print ('Format: %s' % model['format'])
    print ('')
Id: BIOMD0000000042
Name: Nielsen1998_Glycolysis
Format: SBML

Id: BIOMD0000000051
Name: Chassagnole2002_Carbon_Metabolism
Format: SBML

Id: BIOMD0000000054
Name: Ataullahkhanov1996_Adenylate
Format: SBML

Id: BIOMD0000000061
Name: Hynne2001_Glycolysis
Format: SBML

Id: BIOMD0000000064
Name: Teusink2000_Glycolysis
Format: SBML

Id: BIOMD0000000071
Name: Bakker2001_Glycolysis
Format: SBML

Id: BIOMD0000000172
Name: Pritchard2002_glycolysis
Format: SBML

Id: BIOMD0000000176
Name: Conant2007_WGD_glycolysis_2A3AB
Format: SBML

Id: BIOMD0000000177
Name: Conant2007_glycolysis_2C
Format: SBML

Id: BIOMD0000000206
Name: Wolf2000_Glycolytic_Oscillations
Format: SBML

to get more information about a particular model, the get_model_info function provides basic information. As all the runctions in this module they take either an integer or string biomodels id as parameter

[3]:
info = biomodels.get_model_info(206)
[4]:
print (info['name'])
print (info['description'])
Wolf2000_Glycolytic_Oscillations
<notes xmlns="http://www.sbml.org/sbml/level2/version3">
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>Model reproduces the dynamics of ATP and NADH as depicted in Fig 4 of the paper.  Model successfully tested on Jarnac and MathSBML.</p>
        <br />
        <p>To the extent possible under law, all copyright and related or neighbouring rights to this encoded model have been dedicated to the public domain worldwide. Please refer to      <a href="http://creativecommons.org/publicdomain/zero/1.0/" title="Creative Commons CC0">CC0 Public Domain Dedication</a>
          for more information.      </p>
      <p>In summary, you are entitled to use this encoded model in absolutely any manner you deem suitable, verbatim, or with modification, alone or embedded it in a larger context, redistribute it, commercially or not, in a restricted way or not.</p>
      <br />
      <p>To cite BioModels Database, please use:      <a href="http://www.ncbi.nlm.nih.gov/pubmed/20587024" target="_blank">Li C, Donizelli M, Rodriguez N, Dharuri H, Endler L, Chelliah V, Li L, He E, Henry A, Stefan MI, Snoep JL, Hucka M, Le Novère N, Laibe C (2010) BioModels Database: An enhanced, curated and annotated resource for published quantitative kinetic models. BMC Syst Biol., 4:92.</a>
  </p>
</body>
</notes>

the model information object also contains the list of file names associated with the entry. To just get that list the convenience function get_files_for_model exists. The main document is contained in a sublist called main. So the main entry can be retrieved using

[5]:
first_entry = info['files']['main'][0]
[6]:
print ("Main FileName is: '{0}' and has size {1} kb".format(first_entry['name'], first_entry['fileSize']))
Main FileName is: 'BIOMD0000000206_url.xml' and has size 27693 kb

to actually get hold of the model itself, you can use the get_content_for_model function, that takes a model id, as well as an optional filename. If the filename is not given, the first main content will be chosen automatically. So to download the model of biomodel #206, once could simply call:

[7]:
sbml = biomodels.get_content_for_model(206)
[8]:
print(sbml[:1000])  # just printing the first couple of lines
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<sbml xmlns="http://www.sbml.org/sbml/level2/version3" level="2" metaid="metaid_0000001" version="3">
  <model id="Wolf2000_Glycolytic_Oscillations" metaid="metaid_0000002" name="Wolf2000_Glycolytic_Oscillations">
    <notes>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>Model reproduces the dynamics of ATP and NADH as depicted in Fig 4 of the paper.  Model successfully tested on Jarnac and MathSBML.</p>
        <br/>
        <p>To the extent possible under law, all copyright and related or neighbouring rights to this encoded model have been dedicated to the public domain worldwide. Please refer to      <a href="http://creativecommons.org/publicdomain/zero/1.0/" title="Creative Commons CC0">CC0 Public Domain Dedication</a>
          for more information.      </p>
      <p>In summary, you are entitled to use this encoded model in absolutely any manner you deem suitable, verbatim, or with modification, alone or embedd

of course you can simply call load_biomodel(206) to load a biomodel into basico.

[9]:
biomodels.search_for_model('kummer2000')
[9]:
[{'format': 'SBML',
  'id': 'BIOMD0000000329',
  'lastModified': '2014-12-11T00:00:00Z',
  'name': 'Kummer2000 - Oscillations in Calcium Signalling',
  'submissionDate': '2014-12-11T00:00:00Z',
  'submitter': 'Vijayalakshmi Chelliah',
  'url': 'https://www.ebi.ac.uk/biomodels/BIOMD0000000329'}]

JWS Online

we also provide access to models from JWS online.

[10]:
import basico.jws_online as jws

with get_all_models you would get a list of all the models in JWS online. To search for models, you have 2 options. One is to search for models by species. For example to search for all models involving ‘atp’

[11]:
atp_models = jws.get_models_for_species('atp')
for model in atp_models:
    print(model['slug'])
achcar1
achcar10
achcar11
achcar12
achcar13
achcar14
achcar2
achcar3
achcar4
achcar5
achcar6
achcar7
achcar8
achcar9
albert1
arnold10
arnold10-2
arnold11
arnold6
arnold7
arnold8
arnold9
assmus
bali
bier2
bradshaw
bray2
bruggeman1
bulik1
bulik2
bulik3
chance1
chassagnole1
chassagnole3
conant1
conant2
curto1
dano1
dano2
dano3
dupreez1
dupreez2
dupreez3
dupreez4
dupreez5
dupreez6
dupreez7
fribourg1
fribourg2
fridlyand1
galazzo1
gustavsson1
gustavsson2
gustavsson3
gustavsson4
gustavsson5
hald
heinrich
hoefnagel1
hoefnagel2
hoefnagel_mixedacid
holzhutter
hynne
jamshidi
jiang1
kerkhovena
kerkhovenc
kolmeisky1
kongas1
kouril2
kouril3
kouril4
kouril6
kouril7
kouril8
kouril9
lambeth
levering1
levering2
maher1
marinhernandez1
marinhernandez2
marinhernandez3
mayya1
mosca1
mulquiney
mulquiney1
mulquiney2
nazaret1
neves1
nielsen
nishio1
olah
orth1
penkler1
penkler2
penkler2aa
poolman
pritchard1
proctor1
rohwer1
rovers1
saavedra
sengupta1
smallbone0
smallbone1
smallbone10
smallbone11
smallbone12
smallbone13
smallbone14
smallbone15
smallbone16
smallbone17
smallbone18
smallbone19
smallbone2
smallbone3
smallbone4
smallbone5
smallbone6
smallbone7
smallbone8
smallbone9
tang1
teusink2
uys
valero
vaneunen1
vanheerden1
vanheerden2
vanniekerk1
whillier4
wolf
wolf1

or you could get the models for a specific reaction for example, all models involving ‘pfk’ would be:

[12]:
pfk_models = jws.get_models_for_reaction('pfk')
for model in pfk_models:
    print(model['slug'])
achcar1
achcar10
achcar11
achcar12
achcar13
achcar14
achcar2
achcar3
achcar4
achcar5
achcar6
achcar7
achcar8
achcar9
albert1
chassagnole2
conant1
conant2
dupreez1
dupreez2
dupreez3
dupreez4
dupreez5
dupreez6
dupreez7
gustavsson1
gustavsson2
gustavsson3
gustavsson4
gustavsson5
hald
kerkhovena
kerkhovenc
levering1
levering2
machado1
marinhernandez1
marinhernandez2
marinhernandez3
mosca1
mulquiney
mulquiney1
mulquiney2
orth1
penkler1
penkler2
penkler2aa
pritchard1
ralser1
smallbone0
smallbone1
smallbone10
smallbone11
smallbone12
smallbone13
smallbone14
smallbone15
smallbone16
smallbone17
smallbone18
smallbone2
smallbone3
smallbone4
smallbone5
smallbone6
smallbone7
smallbone8
smallbone9
vanniekerk1

for each of these ids, you can get the manuscript, to find out what the model is all about, or the sbml model itself

[13]:
manuscript = jws.get_manuscript('wolf')
[14]:
print(manuscript['title'])
Transduction of intracellular and intercellular dynamics in yeast glycolytic oscillations.
[15]:
print(manuscript['abstract'])
Under certain well-defined conditions, a population of yeast cells exhibits glycolytic oscillations that synchronize through intercellular acetaldehyde. This implies that the dynamic phenomenon of the oscillation propagates within and between cells. We here develop a method to establish by which route dynamics propagate through a biological reaction network. Application of the method to yeast demonstrates how the oscillations and the synchronization signal can be transduced. That transduction is not so much through the backbone of glycolysis, as via the Gibbs energy and redox coenzyme couples (ATP/ADP, and NADH/NAD), and via both intra- and intercellular acetaldehyde.
[16]:
sbml = jws.get_sbml_model('wolf')
[17]:
print(sbml[:1000])
<?xml version="1.0" encoding="UTF-8"?>
<sbml xmlns="http://www.sbml.org/sbml/level3/version1/core" level="3" version="1">
  <model id="wolf" name="wolf">
    <listOfCompartments>
      <compartment metaid="metaid_0" sboTerm="SBO:0000410" id="default_compartment" spatialDimensions="3" size="1" constant="true"/>
    </listOfCompartments>
    <listOfSpecies>
      <species metaid="metaid_1" id="at" name="ATP" compartment="default_compartment" initialConcentration="2" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false">
        <annotation>
          <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:vCard="http://www.w3.org/2001/vcard-rdf/3.0#" xmlns:bqbiol="http://biomodels.net/biology-qualifiers/" xmlns:bqmodel="http://biomodels.net/model-qualifiers/">
            <rdf:Description rdf:about="#metaid_1">
              <bqbiol:is>
                <rdf:Bag>

[ ]:

[ ]: