Skip to content

jmuhlich/indra

 
 

Repository files navigation

Build Status Documentation Status

INDRA

INDRA (Integrated Network and Dynamical Reasoning Assembler) generates executable models of pathway dynamics from natural language (using the TRIPS and REACH parsers), and BioPAX and BEL sources (including the Pathway Commons database and NDEx.

Documentation

Documentation is available at http://indra.readthedocs.io.

Installing INDRA

INDRA works with both Python 2 and 3 (tested with 2.7 and 3.5). You can install INDRA by cloning this repository and running setup.py from the terminal as

$ git clone https://github.com/sorgerlab/indra.git
$ cd indra
$ python setup.py install

Releases of INDRA are also available via pip, you can install the latest release as

$ pip install indra

INDRA depends on a few standard Python packages (e.g. rdflib, requests) and also PySB (for more information on PySB, see http://pysb.org). These packages are installed by setup.py.

For using BioPAX, an additional package called pyjnius is needed to allow using Java classes from Python. This is used only in the BioPAX API and the rest of INDRA will work without pyjnius. Pyjnius needs JRE and JDK 1.8 to be installed. On Mac, install both Java for OS X and JDK and JRE from Oracle. Then set JAVA_HOME to your JDK home directory, for instance

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home

Then first install cython (tested with version 0.23.5) followed by jnius-indra

$ pip install cython==0.23.5
$ pip install jnius-indra

Using INDRA

In this example INDRA assembles a PySB model from the natural language description of a mechanism via the TRIPS parser web service.

from indra.assemblers import PysbAssembler
from indra import trips
pa = PysbAssembler()
# Process a natural language description of a mechanism
trips_processor = trips.process_text('MEK2 phosphorylates ERK1 at Thr-202 and Tyr-204')
# Collect extracted mechanisms in PysbAssembler
pa.add_statements(trips_processor.statements)
# Assemble the model
model = pa.make_model(policies='two_step')

INDRA also provides an interface for the REACH natural language parser. In this example, a full paper from PubMed Central is processed. The paper's PMC ID is PMC3717945.

from indra import reach
# Process the neighborhood of BRAF and MAP2K1
reach_processor = reach.process_pmc('3717945')
# At this point, reach_processor.statements contains a list of INDRA statements
# extracted from the PMC paper.

Next we look at an example of reading the 10 most recent PubMed abstracts on BRAF and collecting the results in INDRA statements.

from indra import reach
from indra.literature import pubmed_client
# Search for 10 most recent abstracts in PubMed on 'BRAF'
pmids = pubmed_client.get_ids('BRAF', retmax=10)
all_statements = []
for pmid in pmids:
    abs = pubmed_client.get_abstract(pmid)
    if abs is not None:
        reach_processor = reach.process_text(abs)
        if reach_processor is not None:
            all_statements += reach_processor.statements
# At this point, the all_statements list contains all the statements
# extracted from the 10 abstracts.

The next example shows querying the BEL large corpus network through NDEx for a neighborhood of a given list of proteins using their HGNC gene names.

from indra import bel
# Process the neighborhood of BRAF and MAP2K1
bel_processor = bel.process_ndex_neighborhood(['BRAF', 'MAP2K1'])
# At this point, bel_processor.statements contains a list of INDRA statements
# extracted from the neihborhood query.

Next, we look at an example of querying the Pathway Commons database for paths between two lists of proteins. Note: see installation notes above for installing jnius, which is required for using the BioPAX API of INDRA.

from indra import biopax
# Process the neighborhood of BRAF and MAP2K1
biopax_processor = biopax.process_pc_pathsfromto(['BRAF', 'RAF1'], ['MAP2K1', 'MAP2K2'])
# Query the resulting BioPAX object model for phosphorylation
biopax_processor.get_phosphorylation()
# At this point, biopax_processor.statements contains a list of INDRA 
# Phosphorylation statements extracted from the paths-from-to query.

About

Integrated Network and Dynamical Reasoning Assembler

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 89.8%
  • Jupyter Notebook 9.1%
  • Other 1.1%