Skip to content
Python client for the Open Targets REST API at targetvalidation.org
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
opentargets
tests
.gitignore
.travis.yml
Dockerfile
LICENSE.txt
MANIFEST
README.md
readthedocs.yml
requirements.dev.txt
requirements.txt
setup.cfg
setup.py

README.md

opentargets-py

Python client for the Open Targets REST API at platform-api.opentargets.io Build Status Documentation Status

Why should you use this client instead of the REST API directly?

  • Include wrappers for all public methods, with query validation
  • Tools for the most common calls (E.g. get data for a target gene symbol even if you do not know its Ensembl Gene Id)
  • Supports automatic retrieval of paginated results with an iterator pattern
  • Easily save query results as JSON, CSV or Excel file
  • Handles Authentication
  • Handles fair usage limits transparently
  • Follows HTTP cache as set by the REST API
  • Experimental HTTP2 support for better performance (beware the client library is in alpha)
  • Support for advanced SSL and proxy configuration

This client is supported for Python 3.5 and upper. Works on pythoon 2.7 on a best effort basis.

Documentation is available on ReadTheDocs

QUICK START

from opentargets import OpenTargetsClient

ot = OpenTargetsClient()

search_result = ot.search('BRAF')
print(search_result[0])

a_for_target = ot.get_associations_for_target('BRAF')
for a in a_for_target:
    print(a['id'], a['association_score']['overall'])

a_for_disease = ot.get_associations_for_disease('cancer')

print(ot.get_association('ENSG00000157764-EFO_0005803')[0])

e_for_target = ot.get_evidence_for_target('BRAF')
print(e_for_target.to_json())

e_for_disease = ot.get_evidence_for_disease('medulloblastoma')

print(ot.get_evidence('5cf863da265c32d112ff4fc3bfc25ab3')[0])

print(ot.get_stats().info)

...

Contributing

To create a development environment:

git clone <this repo>
cd opentargets-py
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt

How to contribute:

  1. (if you are not part of the open targets team) fork the repo
  2. branch from master, always start with git checkout -b yourname-featureyouareadding
  3. code
  4. push your branch and submit a PR
  5. ask for reviews for your PR
  6. Travis tests have to pass
  7. Your PR is approved and merged

How to release

  1. Draft a new release https://github.com/opentargets/opentargets-py/releases/new
  2. add a tag using semantic versioning, pointing to master
  3. Press publish

Releases will automatically deploy to pypi (thanks to travis) once they are created in the github console.

You can’t perform that action at this time.