Community-curated SPARQL example queries for multiple life-science endpoints.
A federated query that maps the subcellular-compartment coverage of the IDR image collection onto UniProt. For every protein annotated with a UniProt ID in IDR it joins to UniProt's curated Subcellular Location Annotation and groups the results by cellular component, returning for each location the number of distinct imaged proteins, the number of IDR images, and an example image URL.
PREFIX ome: <https://ld.openmicroscopy.org/core/>
PREFIX omekg: <https://ld.openmicroscopy.org/omekg#>
PREFIX up: <http://purl.uniprot.org/core/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT ?location ?locationLabel
(COUNT(DISTINCT ?acc) AS ?nProteins)
(COUNT(DISTINCT ?img) AS ?nImages)
(SAMPLE(?imgUrl) AS ?exampleImage)
WHERE {
{
SELECT DISTINCT ?acc ?location ?locationLabel WHERE {
{ SELECT DISTINCT ?acc WHERE { ?e0 ome:key "UniProt ID" ; ome:value ?acc } }
BIND(IRI(CONCAT("http://purl.uniprot.org/uniprot/", ?acc)) AS ?protein)
SERVICE <https://sparql.uniprot.org/sparql> {
?protein up:annotation ?scl .
?scl a up:Subcellular_Location_Annotation ; up:locatedIn ?loc .
?loc up:cellularComponent ?location .
?location skos:prefLabel ?locationLabel .
}
}
}
?e ome:key "UniProt ID" ; ome:value ?acc .
?ann ome:mapEntry ?e .
?img ome:hasAnnotation ?ann ; omekg:ome_details ?imgUrl .
}
GROUP BY ?location ?locationLabel
ORDER BY DESC(?nImages)
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?acc"):::projected
v10("?ann")
v9("?e")
v2("?e0")
v14("?exampleImage")
v11("?img"):::projected
v12("?imgUrl"):::projected
v6("?loc")
v7("?location"):::projected
v8("?locationLabel"):::projected
v14("?nImages")
v13("?nProteins")
v4("?protein")
v5("?scl")
c2(["UniProt ID"]):::literal
c7(["up:Subcellular_Location_Annotation"]):::iri
v2 --https://ld.openmicroscopy.org/core/key--> c2
v2 --https://ld.openmicroscopy.org/core/value--> v3
bind0[/"concat('http://purl.uniprot.org/uniprot/',?acc)"/]
v3 --o bind0
bind0 --as--o v4
subgraph s1["https://sparql.uniprot.org/sparql"]
style s1 stroke-width:4px;
v4 --"up:annotation"--> v5
v5 --"a"--> c7
v5 --"up:locatedIn"--> v6
v6 --"up:cellularComponent"--> v7
v7 --"skos:prefLabel"--> v8
end
v9 --https://ld.openmicroscopy.org/core/key--> c2
v9 --https://ld.openmicroscopy.org/core/value--> v3
v10 --https://ld.openmicroscopy.org/core/mapEntry--> v9
v11 --https://ld.openmicroscopy.org/core/hasAnnotation--> v10
v11 --https://ld.openmicroscopy.org/omekg#ome_details--> v12
bind4[/"count(?acc)"/]
v3 --o bind4
bind4 --as--o v13
bind5[/"count(?img)"/]
v11 --o bind5
bind5 --as--o v14
bind6[/"sample(?imgUrl)"/]
v12 --o bind6
bind6 --as--o v14