Skip to content

Instantly share code, notes, and snippets.

@jonasalmeida
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonasalmeida/8d78513101d499422216 to your computer and use it in GitHub Desktop.
Save jonasalmeida/8d78513101d499422216 to your computer and use it in GitHub Desktop.
retrieving URLs for TCGA tissue images from SPARQL endpoint
// SPARQL query composition at http://agalpha.mathbiol.org/repositories/tcga#query/r/TCGA-CM-4743-01A-01_URL
label='TCGA-CM-4743-01A-0' // example of a label
url = 'http://agalpha.mathbiol.org/download?file=query.json&accept=application%2Fsparql-results%2Bjson&path=%2Frepositories%2Ftcga%3Fquery%3Dselect%2520distinct%2520%253Fo%2520%253Fu%250Awhere%2520%257B%250A%2509%253Ft%2520a%2520%253Chttp%253A%252F%252Fpurl.org%252Ftcga%252Fcore%2523platform%253E.%250A%2520%2520%2509%253Ft%2520%253Chttp%253A%252F%252Fwww.w3.org%252F2000%252F01%252Frdf-schema%2523label%253E%2520%2522tissue_images%2522.%250A%2520%2520%2509%253Fo%2520%253Chttp%253A%252F%252Fpurl.org%252Ftcga%252Fcore%2523platform%253E%2520%253Ft.%250A%2520%2520%2509%253Fo%2520rdfs%253Alabel%2520%253FL.%250A%2520%2520%2509filter%2520REGEX(%253FL%252C%72'+label+'1%27)%250A%2520%2520%2520%2520%253Fo%2520tcga%253Aurl%2520%253Fu%250A%257D%26infer%3Dfalse'
$.getJSON(url,function(x){
y=x.results.bindings.map(function(xi){return xi.u.value});
console.log('done:',y)
})