<commit_before>[![Build Status](https://travis-ci.org/sorgerlab/indra.svg?branch=travis_ci)](https://travis-ci.org/sorgerlab/indra)

INDRA
=====
INDRA (Integrated Dynamical Reasoning Assembler) generates executable models of 
pathway dynamics from natural language (using the TRIPS parser), BioPAX and BEL 
sources (including the PathwayCommons database and NDEx).

Installing INDRA
----------------
INDRA works with Python 2.7.x (tested with 2.7.3 and higher). Python 3 is 
currently not supported. When installing INDRA and its dependencies, make 
sure that the correct version of Python is used.

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

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

INDRA also uses a package called pyjnius
(https://github.com/kivy/pyjnius) 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 requires cython and needs JRE and JDK 1.8 to be 
installed.

Using INDRA
-----------
In this example INDRA assembles a PySB model from the natural language description 
of a mechanism via the [TRIPS parser web service](http://trips.ihmc.us/parser/cgi/drum). 

```python
from indra.pysb_assembler import PysbAssembler
from indra.trips import trips_api
pa = PysbAssembler()
# Process a natural language description of a mechanism
trips_processor = trips_api.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')
```

The next example shows querying the [BEL large corpus](http://public.ndexbio.org/#/network/9ea3c170-01ad-11e5-ac0f-000c29cb28fb) network thorugh [NDEx](http://ndexbio.org) for a neighborhood of a given list of proteins using their HGNC gene names. 

```python
from indra.bel import bel_api
# Process the neighborhood of BRAF and MAP2K1
bel_processor = bel_api.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](http://pathwaycommons.org) for paths between two lists of proteins. 
```python
from indra.biopax import biopax_api<commit_msg>Add jnius install notes in README.md<commit_after>[![Build Status](https://travis-ci.org/sorgerlab/indra.svg?branch=travis_ci)](https://travis-ci.org/sorgerlab/indra)

INDRA
=====
INDRA (Integrated Dynamical Reasoning Assembler) generates executable models of 
pathway dynamics from natural language (using the TRIPS parser), BioPAX and BEL 
sources (including the PathwayCommons database and NDEx).

Installing INDRA
----------------
INDRA works with Python 2.7.x (tested with 2.7.3 and higher). Python 3 is 
currently not supported. When installing INDRA and its dependencies, make 
sure that the correct version of Python is used.

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

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

INDRA also uses a package called [pyjnius](https://github.com/kivy/pyjnius) 
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 requires cython and needs JRE and JDK 1.8 to be 
installed. On Mac, install both [Java for OS X](http://support.apple.com/kb/DL1572) 
and JDK and JRE from [Oracle](http://www.oracle.com/technetwork/java/javase/downloads/index.html). 
Then set JAVA\_HOME to your JDK home directory, for instance

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

Using INDRA
-----------
In this example INDRA assembles a PySB model from the natural language description 
of a mechanism via the [TRIPS parser web service](http://trips.ihmc.us/parser/cgi/drum). 

```python
from indra.pysb_assembler import PysbAssembler
from indra.trips import trips_api
pa = PysbAssembler()
# Process a natural language description of a mechanism
trips_processor = trips_api.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')
```

The next example shows querying the [BEL large corpus](http://public.ndexbio.org/#/network/9ea3c170-01ad-11e5-ac0f-000c29cb28fb) network thorugh [NDEx](http://ndexbio.org) for a neighborhood of a given list of proteins using their HGNC gene names. 

```python
from indra.bel import bel_api
# Process the neighborhood of BRAF and MAP2K1
bel_processor = bel_api.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](http://pathwaycommons.org) for paths between two lists of proteins. 
```python
from indra.biopax import biopax_api
{'fraction_non_alphanumeric': 0.0903701042040963, 'fraction_numerical': 0.015271289974847287, 'mean_word_length': 4.539303482587065, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 10, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6211674', 'n_tokens_mistral': 1847, 'n_tokens_neox': 1721, 'n_words': 631}