Reading and Writing Boolean-Based Models

Cell Collective supports reading models in SBML qual file format and exporting them into SBML qual, Boolean Expressions, Truth Tables, Interaction Matrix and GML Expressions.

ccapi also ships with some test models.

Let’s try importing the Signal Transduction in Fibroblasts model.

image0

Begin by importing the ccapi module into your workspace.

[1]:
import ccapi

Now, let’s try creating a client object in order to interact with services provided by Cell Collective.

[2]:
client = ccapi.Client()

Authenticate your client using a *password flow type authentication* scheme.

NOTE: Before you can authenticate using ccapi, you must first register an application of the appropriate type on `Cell Collective <https://cellcollective.org>`__. If you do not require a user context, it is read only.

[3]:
client.auth(email = "test@cellcollective.org", password = "test")

You can also view user details of your authenticated client as follows:

[4]:
user = client.me()
user
[4]:
ID 10887
Name Achilles Test
Memory Address 0x07f08117ef588
First Name Achilles
Last Name Test
Email Address test@cellcollective.org
Institution University of Nebraska-Lincoln

SBML

The Systems Biology Markup Language is an XML-based standard format for distributing models. Reading SBML files is as easy as using the read function provided by the client object.

ccapi comes shipped with test models for testing purposes.

[5]:
model = ccapi.load_model("fibroblasts", client = client)
model.save()
[5]:
ID 90999
Name Unnamed Model
Memory Address 0x07f08117ef128
Number of Versions 1
Versions [<BooleanModel 90999 at 0x07f08101a8898>]

Cell Collective has a native support for reading and writing in SBML qual.

[6]:
boolean = model.default_version
boolean
[6]:
ID 90999
Version 1
Name
Memory Address 0x07f08101a8898
Number of Components 139
Components ExtPump, alpha_1213L, alpha_iL, alpha_sL, alpha_qL, IL1_TNF, ECM, Stress, EGF, Palpha_iR, Cbp, EGFR, PIP2_45, TAK1, Ga_1213, Ras, alpha_qR, ARF, PTPPEST, Talin, p38, Raf, Akt, PLC_g, Mekk4, PLD, p115RhoGEF, Graf, AC, TAO_12, PKC_primed, ASK1, PAK, IP3, DAG, Raf_Loc, Erk, Tiam, PIP2_34, RhoK, Cas, PTPa, Crk, MKK3, Shc, SHP2, Mekk2, cAMP, Sos, Gbg_1213, Raf_Rest, PI4K, PKC, alpha_sR, Csk, Sek1, MLK1, PDE4, PLA2, Ral, RasGRF_GRP, AND_34, PTP1b, DOCK180, NIK, Pix_Cool, B_Parvin, RKIP, WASP, MKK6, Cdc42, MKK7, PIP3_345, GRK, MLK3, Actin, Fak, Ca, B_Arrestin, Gbg_q, alpha_1213R, CaM, Arp_23, Gas, Gbg_i, Palpha_qR, RGS, p120RasGAP, Mekk1, PDK1, PA, Trafs, PKA, RalGDS, SAPK, Gab1, IP3R1, AA, PI3K, p90RSK, PLC_B, p190RhoGAP, Grb2, MLCP, RalBP1, Mekk3, PTEN, PIP_4, Myosin, Gai, Palpha_sR, ILK, Integrins, Mek, CaMKK, Vinc, Nck, IL1_TNFR, RhoGDI, MKPs, MLK2, Rac, DGK, PI5K, alpha_iR, Src, Palpha_1213R, Tab_12, Tpl2, Gaq, Rho, MLCK, PP2A, CaMK, Rap1, Raf_DeP, GCK, Trx, Gbg_s

Visualize a Boolean Model using the draw function provided.

Writing Models

Boolean-Based Models can be exported into the following formats.

  1. SBML
  2. Boolean Expressions
  3. Truth Tables
  4. Interaction Matrix
  5. GML

Exporting Boolean-Based Models can be done using ccapi using the Boolean.write function with the file type as the parameter. By default, Boolean.write exports a model into SBML qual format. A list of other formats can be found from ccapi.constant.BOOLEAN_MODEL_EXPORT_TYPE. You can also pass the path to where it should be downloaded.

[7]:
from ccapi._compat import iterkeys
list(iterkeys(ccapi.constant.BOOLEAN_MODEL_EXPORT_TYPE))
[7]:
['sbml', 'tt', 'expr', 'matrix', 'gml']

SBML

Use the sbml type to download a BooleanModel into an SBML qual file format.

[8]:
boolean.write("_data/model/boolean/%s/%s.sbml" % (boolean.id, boolean.version), type = "sbml")
[8]:
'_data/model/boolean/90999/1.sbml'

Boolean Expressions

Use the type expr to export a BooleanModel containing Boolean Expressions for all components.

[9]:
boolean.write("_data/model/boolean/%s/%s.expr.zip" % (boolean.id, boolean.version), type = "expr")
[9]:
'_data/model/boolean/90999/1.expr.zip'

Truth Tables

Use the type tt to export a BooleanModel containing Truth Tables.

[10]:
boolean.write("_data/model/boolean/%s/%s.tt.zip" % (boolean.id, boolean.version), type = "tt")
[10]:
'_data/model/boolean/90999/1.tt.zip'

Interaction Matrix

Use the type matrix to export a BooleanModel containing Interaction Matrices.

[11]:
boolean.write("_data/model/boolean/%s/%s.matrix.zip" % (boolean.id, boolean.version), type = "matrix")
[11]:
'_data/model/boolean/90999/1.matrix.zip'

GML

Use the type gml to export a BooleanModel containing GML.

[12]:
boolean.write("_data/model/boolean/%s/%s.gml.zip" % (boolean.id, boolean.version), type = "gml")
[12]:
'_data/model/boolean/90999/1.gml.zip'