sparql-examples

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

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

016

Which are the genes in Human associated to a disease that are orthologous to a gene expressed in the rat's brain?

Use at

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX genex: <http://purl.org/genex#>
PREFIX lscr: <http://purl.org/lscr#>
PREFIX orth: <http://purl.org/net/orth#>
PREFIX up: <http://purl.uniprot.org/core/>
PREFIX taxon: <http://purl.uniprot.org/taxonomy/>
PREFIX sio: <http://semanticscience.org/resource/>

SELECT ?gene ?omaLink ?uniprot ?diseaseLabel ?annotationText WHERE {
    {
        SELECT ?gene {
            ?anat rdfs:label 'brain' .
            ?gene genex:isExpressedIn ?anat ;
                orth:organism/obo:RO_0002162 ?taxonRat .
            ?taxonRat up:commonName 'rat' .
        } LIMIT 20
    }
    SERVICE <https://sparql.uniprot.org/sparql> {
        ?taxonHuman up:commonName 'Human' .
    }
    SERVICE <https://sparql.omabrowser.org/sparql/> {
        ?cluster a orth:OrthologsCluster ;
            orth:hasHomologousMember ?node1 ;
            orth:hasHomologousMember ?node2 .
        ?node2 orth:hasHomologousMember* ?protein2 .
        ?node1 orth:hasHomologousMember* ?protein1 .
        ?protein1 a orth:Protein ;
            sio:SIO_010079 ?gene . # encoded by
        ?protein2 a orth:Protein ;
            rdfs:seeAlso ?omaLink ;
            orth:organism/obo:RO_0002162 ?taxonHuman ;
            lscr:xrefUniprot ?uniprot .
        FILTER(?node1 != ?node2)
    }
    SERVICE <https://sparql.uniprot.org/sparql> {
        ?uniprot up:annotation ?annotation .
        ?annotation a up:Disease_Annotation ;
            rdfs:comment ?annotationText ;
            up:disease ?disease .
        ?disease skos:prefLabel ?diseaseLabel .
    }
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v1("?anat")
  v12("?annotation")
  v13("?annotationText"):::projected 
  v7("?cluster")
  v14("?disease")
  v15("?diseaseLabel"):::projected 
  v2("?gene"):::projected 
  v5("?node1")
  v6("?node2")
  v10("?omaLink"):::projected 
  v9("?protein1")
  v8("?protein2")
  v4("?taxonHuman")
  v3("?taxonRat")
  v11("?uniprot"):::projected 
  a1((" "))
  a2((" "))
  c9(["Human"]):::literal 
  c7(["rat"]):::literal 
  c19(["up:Disease_Annotation"]):::iri 
  c12(["orth:OrthologsCluster"]):::iri 
  c2(["brain"]):::literal 
  c14(["orth:Protein"]):::iri 
  v1 --"rdfs:label"-->  c2
  v2 --"genex:isExpressedIn"-->  v1
  v2 --"orth:organism"-->  a1
  a1 --"obo:RO_0002162"-->  v3
  v3 --"up:commonName"-->  c7
  subgraph s1["https://sparql.uniprot.org/sparql"]
    style s1 stroke-width:4px;
    v4 --"up:commonName"-->  c9
  end
  subgraph s2["https://sparql.omabrowser.org/sparql/"]
    style s2 stroke-width:4px;
    f0[["?node1 != ?node2"]]
    f0 --> v5
    f0 --> v6
    v7 --"a"-->  c12
    v7 --"orth:hasHomologousMember"-->  v5
    v7 --"orth:hasHomologousMember"-->  v6
    v6 --"orth:hasHomologousMember"-->  v8
    v5 --"orth:hasHomologousMember"-->  v9
    v9 --"a"-->  c14
    v9 --"sio:SIO_010079"-->  v2
    v8 --"a"-->  c14
    v8 --"rdfs:seeAlso"-->  v10
    v8 --"orth:organism"-->  a2
    a2 --"obo:RO_0002162"-->  v4
    v8 --"lscr:xrefUniprot"-->  v11
  end
  subgraph s1["https://sparql.uniprot.org/sparql"]
    style s1 stroke-width:4px;
    v11 --"up:annotation"-->  v12
    v12 --"a"-->  c19
    v12 --"rdfs:comment"-->  v13
    v12 --"up:disease"-->  v14
    v14 --"skos:prefLabel"-->  v15
  end