ibl / icgc

client JS library to use ICGC's API (https://dcc.icgc.org/docs/)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IBL/icgc

====

All you need is

<script src="https://ibl.github.io/icgc/icgc.js"></script>

Live at: http://ibl.github.io/icgc/


Experimenting with the possibility of having the Web API of the International Cancer Genome Consortium as a client side JavaScript library. Since the API is not CORS enabled, a Google Script was implemented as a middle layer. The basic idea is to mimic the query syntax with objects constructed as

icgc.\( callbackFunction , { argumenti : valuei , ... } );

Many thanks to ICGC's Portal team - this is a great public service !


As detailed in ICGC (API documentation)[https://dcc.icgc.org/docs/], the operation of the portal web service is described by two elements, 1) a command and 2) a set of parameters, which are composed as a URL call:

	<base URL> / <API version> / <COMMAND> ? <PARAMETERS>

	for example, for the list of pathways involving P53 this would be

	https://dcc.icgc.org:443/api/v1/genes/ENSG00000141510?field=pathways

.get

The icgc.js client object mediates this exchange by processing an object where the information is defined by a .path attribute and all other attributes describe the parameters, for example

	icgc.get({path:"genes/ENSG00000141510",field:"pathways"})

	or illustrating the use of a filter

	icgc.get({path:"genes/ENSG00000141510",filters:{"mutation":{"functionalImpact":{is:["High"]}},"donor":{"projectId":{is:["MALY-DE"]}}, "tumourStageAtDiagnosis":{"is":["III"]}}})

.portal

A careful inspection of ICGC's (API documentation)[https://dcc.icgc.org/docs/] and the (example queries)[https://dcc.icgc.org/] will identfy a query syntax hat uses JSON.stringify for the values of the attrubutes of the input object. The resulting string can also be passed to the portal, for example,

	icgc.portal({path:"genes/ENSG00000141510",filters:{"mutation":{"functionalImpact":{is:["High"]}},"donor":{"projectId":{is:["MALY-DE"]}}, "tumourStageAtDiagnosis":{"is":["III"]}}})

	note however that the portal search is only reacting to the filters. Accordingly, this command will generate the same result as

	icgc.portal({filters:{"mutation":{"functionalImpact":{is:["High"]}},"donor":{"projectId":{is:["MALY-DE"]}}, "tumourStageAtDiagnosis":{"is":["III"]}}})

About

client JS library to use ICGC's API (https://dcc.icgc.org/docs/)


Languages

Language:JavaScript 100.0%