Upload
thetravellingbard
View
249
Download
12
Tags:
Embed Size (px)
DESCRIPTION
Details of the Open PHACTS API. Description of the parameters. How to use the filters to fine tune your results. How to use the API and the OPS.js library in your own applications. An introduction to the Open PHACTS Biojs widgets.
Citation preview
Go to https://dev.openphacts.org
Sign up, sign in or use the app ID/app Keys available from:
http://goo.gl/z3rWwZ
Use the API from the documentation
View results in a browser
Write some code
What shall we do?
Anatomy of an API 1
Required elements with a single value
Optional elements with a single value
Optional elements with a single value or array
Anatomy of an API 2
URI identifying the item you are interested in
Application ID created at https://dev.openphacts.orgApplication Key for the application ID created at https://dev.openphacts.org
Compound Info
https://beta.openphacts.org/1.3/compound?uri=+http%3A%2F%2Fwww.conceptwiki.org%2Fconcept%2F38932552-111f-4a4e-a46a-4ed1d7bdf9d5&app_id=a921aad5&app_key=1be1aa775de4126dab09d54ef95e5832&_format=json
http://goo.gl/cjLiIZ
Compound Pharmacology
Count
https://beta.openphacts.org/1.3/compound/pharmacology/count?uri=http%3A%2F%2Fwww.conceptwiki.org%2Fconcept%2F38932552-111f-4a4e-a46a-4ed1d7bdf9d5&app_id=a921aad5&app_key=1be1aa775de4126dab09d54ef95e5832&_format=json
http://goo.gl/DNG4uA
Compound Pharmacology
List (page 1, 10 results)
https://beta.openphacts.org/1.3/compound/pharmacology/pages?uri=http%3A%2F%2Fwww.conceptwiki.org%2Fconcept%2F38932552-111f-4a4e-a46a-4ed1d7bdf9d5&app_id=a921aad5&app_key=1be1aa775de4126dab09d54ef95e5832&_format=json
http://goo.gl/nw4YFQ
Compound Pharmacology Filters
How many results are there with an IC50 less than or equal to 1500nM?
Compound Pharmacology Filters
Answer: 146https://beta.openphacts.org/1.3/compound/pharmacology/count?uri=http%3A%2F%2Fwww.conceptwiki.org%2Fconcept%2F38932552-111f-4a4e-a46a-4ed1d7bdf9d5&app_id=a921aad5&app_key=1be1aa775de4126dab09d54ef95e5832&activity_type=IC50&max-activity_value=1500&activity_unit=nanomolar&_format=json
activity_type=IC50
max-activity_value=1500
activity_unit=nanomolar
http://goo.gl/BbHmKN
First 30 results?
First 30 results?
https://beta.openphacts.org/1.3/compound/pharmacology/pages?uri=http%3A%2F%2Fwww.conceptwiki.org%2Fconcept%2F38932552-111f-4a4e-a46a-4ed1d7bdf9d5&app_id=a921aad5&app_key=1be1aa775de4126dab09d54ef95e5832&activity_type=IC50&max-activity_value=1500&activity_unit=nanomolar&_page=1&_pageSize=30&_format=json
activity_type=IC50
max-activity_value=1500
activity_unit=nanomolar
_page=1
_pageSize=30
http://goo.gl/LQmDLz
Write some code
Open up zip (available from http://goo.gl/NaN5BJ)
Start with an empty HTML page– Open compound.html in your browser (file:///….)
Not much to see here– Loads OPS.js and jQuery
Write some code
Open the HTML in your favourite text editor
Add some magic (http://goo.gl/JvE4mt) inside the JavaScript code block
appID = "a921aad5";appKey = "1be1aa775de4126dab09d54ef95e5832";var searcher = new Openphacts.CompoundSearch("https://beta.openphacts.org/1.3", appID, appKey);var callback = function(success, status, response) { var compoundResult = searcher.parseCompoundResponse(response); $("#compound-info").append("I am " + compoundResult.prefLabel + " with molecular weight " + compoundResult.fullMWT); };searcher.fetchCompound('http://www.conceptwiki.org/concept/38932552-111f-4a4e-a46a-4ed1d7bdf9d5', null, callback);
Refresh your browser
Open PHACTS widgets
Collaboration with Biojs
http://openphacts.github.io/ops-html-widgets/
https://github.com/biojs/biojs
Useful links
https://dev.openphacts.org/docs/1.3
https://explorer.openphacts.org
http://jupiter.cs.man.ac.uk
https://github.com/openphacts/ops.js
https://github.com/biojs/biojs
http://goo.gl/JvE4mt (OPS.js code example)