Skip to content

Commit

Permalink
updated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrea Pierleoni committed Oct 14, 2016
1 parent 330f0a7 commit 1ee4103
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 9 deletions.
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ Python client for the Open Targets REST API at targetvalidation.org

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)
- Supports automatic retrieval of paginated results with an iterator pattern
- Include wrappers for public methods
- 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)
- Easily save query results as JSON, CSV or Excel file

This client is supported for Python 3.5 and upper.
Works on lower version (including python 2) on a best effort basis.
Expand All @@ -40,8 +40,7 @@ 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')
for e in e_for_target:
print(e.to_json())
print(e_for_target.to_json())

e_for_disease = ot.get_evidence_for_disease('medulloblastoma')

Expand Down
8 changes: 8 additions & 0 deletions docs/source/history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
Changelog
=========

1.2.0b1
---------------------

- Added option to export data as JSON, csv, excel or pandas dataframe. (optional dependency for pandas and xlwt)
- Fixed post calls and qutomatically switch to post for a large request



1.2.0a2
---------------------

Expand Down
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Main advantages of using the client versus querying 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
Expand Down
20 changes: 17 additions & 3 deletions docs/source/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@ get an association by id:
get evidence for a target:
::

from opentargets.conn import result_to_json
e_for_target = ot.get_evidence_for_target('BRAF')
for e in e_for_target:
print(result_to_json(e))
print(e_for_target.to_json())

get evidence for a disease:
::
Expand Down Expand Up @@ -96,3 +94,19 @@ use incremental filter:
10 ENSG00000157764-EFO_1000249 0.5555555555555556 Extramammary Paget Disease
11 ENSG00000157764-Orphanet_774 0.21793721666666668 Hereditary hemorrhagic telangiectasia


export a table with association score for each datasource into an excel file:
::

>>> from opentargets import OpenTargetsClient
>>> client = OpenTargetsClient()
>>> response = client.get_associations_for_target('BRAF',
... fields=['association_score.datasource*',
... 'association_score.overall',
... 'target.gene_info.symbol',
... 'disease.efo_info.*']
... )
>>> response
865 Results found | parameters: {'target': 'ENSG00000157764', 'fields': ['association_score.datasource*', 'association_score.overall', 'target.gene_info.symbol', 'disease.efo_info.label']}
>>> response.to_excel('BRAF_associated_diseases_by_datasource.xls')
>>>

0 comments on commit 1ee4103

Please sign in to comment.