188_batch_gene_symbol_to_uniprot_and_ensembl
- Ensembl
- batch lookup
- gene symbol
- federation
Given a batch of human gene symbols (TP53, BRCA1, EGFR), resolve each to its Ensembl gene ID and reviewed UniProt accession in one federated query - the closest direct analogue to biomaRt's getBM() across two live SPARQL endpoints instead of one local database. Gene symbols and the Ensembl gene resource itself only exist in Ensembl's own RDF, so the symbol-to-gene match happens inside the SERVICE clause; restricting to human (RO_0002162, in-taxon) avoids matching the same symbol used for orthologous genes in other species, and the up:reviewed true filter (evaluated locally, since ?protein is already bound to a UniProt IRI) keeps one canonical accession per gene rather than every isoform
Use at
PREFIX up: <http://purl.uniprot.org/core/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ensembl: <http://rdf.ebi.ac.uk/terms/ensembl/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX obo: <http://purl.obolibrary.org/obo/>
SELECT DISTINCT
?symbol
?ensemblGeneId
?protein
WHERE {
SERVICE <https://rdfportal.org/ebi/sparql> {
VALUES ?symbol { "TP53" "BRCA1" "EGFR" }
?gene a ensembl:EnsemblGene ;
rdfs:label ?symbol ;
dcterms:identifier ?ensemblGeneId ;
obo:RO_0002162 <http://identifiers.org/taxonomy/9606> ;
rdfs:seeAlso ?protein .
FILTER(STRSTARTS(STR(?protein), "http://purl.uniprot.org/uniprot/"))
}
?protein up:reviewed true .
}
ORDER BY ?symbol
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?ensemblGeneId"):::projected
v3("?gene")
v2("?protein"):::projected
v3("?symbol"):::projected
c8([http://identifiers.org/taxonomy/9606]):::iri
c11(["true^^xsd:boolean"]):::literal
c4([http://rdf.ebi.ac.uk/terms/ensembl/EnsemblGene]):::iri
subgraph s1["https://rdfportal.org/ebi/sparql"]
style s1 stroke-width:4px;
f0[["starts-with(str(?protein),'http://purl.uniprot.org/uniprot/')"]]
f0 --> v2
bind1[/VALUES ?symbol/]
bind1-->v3
bind10(["TP53"])
bind10 --> bind1
bind11(["BRCA1"])
bind11 --> bind1
bind12(["EGFR"])
bind12 --> bind1
v3 --"a"--> c4
v3 --"rdfs:label"--> v3
v3 --"dcterms:identifier"--> v4
v3 --"obo:RO_0002162"--> c8
v3 --"rdfs:seeAlso"--> v2
end
v2 --"up:reviewed"--> c11