Converting BioPAX to BEL

Author: Charles Tapley Hoyt

Estimated Run Time: 5 seconds

This notebook shows how a WikiPathways entry, distributed as BioPAX, can be loaded into PyBEL using INDRA.

Imports


In [1]:
import pkg_resources
import sys
import os
import time
from urllib.request import urlretrieve

import indra.util.get_version
import indra.java_vm # make sure INDRA is in charge of the JVM
import pybel
import pybel_tools
from pybel_tools.visualization import to_jupyter

Environment


In [2]:
%%bash
java -showversion 2>&1 | head -n 4


java version "1.8.0_152"
Java(TM) SE Runtime Environment (build 1.8.0_152-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)


In [3]:
%%bash
locale


LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL="en_US.UTF-8"

In [4]:
print(sys.version)


3.6.3 (default, Oct  9 2017, 09:47:56) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)]

In [5]:
print(time.asctime())


Mon Mar 19 17:00:12 2018

In [6]:
os.environ['CLASSPATH']


Out[6]:
'/Users/cthoyt/dev/indra/indra/sources/biopax/jars/paxtools.jar:~/dev/jars/reach-82631d-biores-e9ee36.jar:'

Dependencies


In [7]:
pybel.utils.get_version()


Out[7]:
'0.11.2-dev'

In [8]:
pybel_tools.utils.get_version()


Out[8]:
'0.5.2-dev'

In [9]:
pkg_resources.get_distribution("jnius-indra").version


Out[9]:
'1.1.dev5'

In [10]:
indra.util.get_version.get_version()


Out[10]:
"1.5.0-b'9a51f433adb9a9c16966bac93c4208c88983e942'"

Data

The apoptosis pathway is downloaded from WikiPathways to the current user's downloads folder.


In [11]:
apoptosis_url = 'https://www.wikipathways.org//wpi/wpi.php?action=downloadFile&type=owl&pwTitle=Pathway:WP254&oldid=95107'

In [12]:
apoptosis_path = os.path.join(os.path.expanduser('~'), 'Downloads', 'WP254_95107.owl')

In [13]:
if not os.path.exists(apoptosis_path):
    urlretrieve(apoptosis_url, apoptosis_path)

Conversion

A file path is given to pybel.from_biopax, which wraps indra.sources.biopax.biopax_api.process_owl.


In [14]:
graph = pybel.from_biopax(apoptosis_path)


ERROR: [2018-03-19 17:00:15] indra/biopax - Could not open data file /Users/cthoyt/Downloads/WP254_95107.owl
---------------------------------------------------------------------------
JavaException                             Traceback (most recent call last)
<ipython-input-14-521428bb8621> in <module>()
----> 1 graph = pybel.from_biopax(apoptosis_path)

/Users/cthoyt/dev/pybel/src/pybel/io/indra.py in from_biopax(path, name, version, description)
    115     from indra.sources.biopax.biopax_api import process_owl
    116 
--> 117     model = process_owl(path)
    118 
    119     return from_indra_statements(

/Users/cthoyt/dev/indra/indra/sources/biopax/biopax_api.py in process_owl(owl_filename)
    158     """
    159     model = pcc.owl_to_model(owl_filename)
--> 160     return process_model(model)
    161 
    162 

/Users/cthoyt/dev/indra/indra/sources/biopax/biopax_api.py in process_model(model)
    175     """
    176     bp = BiopaxProcessor(model)
--> 177     bp.get_modifications()
    178     bp.get_regulate_activities()
    179     bp.get_regulate_amounts()

/Users/cthoyt/dev/indra/indra/sources/biopax/processor.py in get_modifications(self)
    107             if modtype == 'modification':
    108                 continue
--> 109             stmts = self._get_generic_modification(modclass)
    110             self.statements += stmts
    111 

/Users/cthoyt/dev/indra/indra/sources/biopax/processor.py in _get_generic_modification(self, mod_class)
    635         mod_filter = mod_type[:5]
    636         # Start with a generic modification pattern
--> 637         p = BiopaxProcessor._construct_modification_pattern()
    638         p.add(mcc(mod_gain_const, mod_filter),
    639                   "input simple PE", "output simple PE")

/Users/cthoyt/dev/indra/indra/sources/biopax/processor.py in _construct_modification_pattern()
    773                             'controller PE')
    774         # Getting the control itself
--> 775         p.add(cb.peToControl(), "controller PE", "Control")
    776         # Link the control to the conversion that it controls
    777         p.add(cb.controlToConv(), "Control", "Conversion")

jnius/jnius_export_class.pxi in jnius.JavaMultipleMethod.__call__()

jnius/jnius_export_class.pxi in jnius.JavaMethod.__call__()

jnius/jnius_export_class.pxi in jnius.JavaMethod.call_method()

jnius/jnius_utils.pxi in jnius.check_exception()

JavaException: JVM exception occurred: Label neither found, nor generated: controller PE

In [ ]:
to_jupyter(graph)