sparql-examples

A set of SPARQL examples that are used in different SIB resources

View the Project on GitHub sib-swiss/sparql-examples

8

Retrieve all genes per species that are orthologous to Rabbit's APOCI or APOC1 gene and their cross-reference links to OMA and Uniprot including the corresponding Ensembl gene identifier.

Use at

PREFIX dc: <http://purl.org/dc/terms/>
PREFIX lscr: <http://purl.org/lscr#>
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX orth: <http://purl.org/net/orth#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX sio: <http://semanticscience.org/resource/>
PREFIX up: <http://purl.uniprot.org/core/>

SELECT ?protein1 ?protein2 ?geneName2 ?species2 ?Prot2_uniprot ?prot2_ensemblGeneId
WHERE {
    ?cluster a orth:OrthologsCluster ;
        orth:hasHomologousMember ?node1 ;
        orth:hasHomologousMember ?node2 .
    ?node2 orth:hasHomologousMember* ?protein2 .
    ?node1 orth:hasHomologousMember* ?protein1 .
    ?protein1 a orth:Protein ;
        orth:organism/obo:RO_0002162/up:scientificName 'Oryctolagus cuniculus';
        rdfs:label 'APOCI' .
    ?protein2 a orth:Protein ;
        lscr:xrefUniprot ?Prot2_uniprot ;
        sio:SIO_010079/lscr:xrefEnsemblGene/dc:identifier ?prot2_ensemblGeneId ;
        rdfs:label ?geneName2 ;
        orth:organism/obo:RO_0002162/up:scientificName ?species2.
    FILTER(?node1 != ?node2)
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v6("?Prot2_uniprot"):::projected 
  v3("?cluster")
  v8("?geneName2"):::projected 
  v1("?node1")
  v2("?node2")
  v7("?prot2_ensemblGeneId"):::projected 
  v5("?protein1"):::projected 
  v4("?protein2"):::projected 
  v9("?species2"):::projected 
  a1((" "))
  a2((" "))
  a3((" "))
  a4((" "))
  a5((" "))
  a6((" "))
  c2(["orth:OrthologsCluster"]):::iri 
  c4(["orth:Protein"]):::iri 
  c8(["Oryctolagus cuniculus"]):::literal 
  c10(["APOCI"]):::literal 
  f0[["?node1 != ?node2"]]
  f0 --> v1
  f0 --> v2
  v3 --"a"-->  c2
  v3 --"orth:hasHomologousMember"-->  v1
  v3 --"orth:hasHomologousMember"-->  v2
  v2 --"orth:hasHomologousMember"-->  v4
  v1 --"orth:hasHomologousMember"-->  v5
  v5 --"a"-->  c4
  v5 --"orth:organism"-->  a1
  a1 --"obo:RO_0002162"-->  a2
  a2 --"up:scientificName"-->  c8
  v5 --"rdfs:label"-->  c10
  v4 --"a"-->  c4
  v4 --"lscr:xrefUniprot"-->  v6
  v4 --"sio:SIO_010079"-->  a3
  a3 --"lscr:xrefEnsemblGene"-->  a4
  a4 --"dc:identifier"-->  v7
  v4 --"rdfs:label"-->  v8
  v4 --"orth:organism"-->  a5
  a5 --"obo:RO_0002162"-->  a6
  a6 --"up:scientificName"-->  v9