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
from opentargets import OpenTargetsClient ot = OpenTargetsClient() search_result = ot.search('BRAF') print(search_result) 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')) 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')) print(ot.get_stats().info) ...
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:
- (if you are not part of the open targets team) fork the repo
- branch from master, always start with
git checkout -b yourname-featureyouareadding
- push your branch and submit a PR
- ask for reviews for your PR
- Travis tests have to pass
- Your PR is approved and merged
How to release
- Draft a new release https://github.com/opentargets/opentargets-py/releases/new
- add a tag using semantic versioning, pointing to
- Press publish
Releases will automatically deploy to pypi (thanks to travis) once they are created in the github console.