sparql-examples

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

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

118_biosodafrontend_rat_brain_human_cancer

rq turtle/ttl

What are the Homo sapiens genes associated with cancer and their orthologs expressed in the Rattus norvegicus brain?

Use at

PREFIX up:<http://purl.uniprot.org/core/>
PREFIX taxon:<http://purl.uniprot.org/taxonomy/>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX orth:<http://purl.org/net/orth#>
PREFIX dcterms:<http://purl.org/dc/terms/>
PREFIX obo:<http://purl.obolibrary.org/obo/>
PREFIX lscr:<http://purl.org/lscr#>
PREFIX genex:<http://purl.org/genex#>
PREFIX sio: <http://semanticscience.org/resource/>
SELECT ?gene ?orthologous_protein2 WHERE {
  {
    SELECT ?protein1 WHERE {
      ?protein1 a up:Protein;
        up:organism/up:scientificName 'Homo sapiens' ;
        up:annotation ?annotation .
      ?annotation rdfs:comment ?annotation_text.
      ?annotation a up:Disease_Annotation .
      FILTER CONTAINS (?annotation_text, "cancer")
    }
  }
  SERVICE <https://sparql.omabrowser.org/sparql/> {
    SELECT ?orthologous_protein2 ?protein1 ?gene WHERE {
      ?protein_OMA a orth:Protein .
      ?orthologous_protein2 a orth:Protein .
      ?cluster a orth:OrthologsCluster .
      ?cluster orth:hasHomologousMember ?node1 .
      ?cluster orth:hasHomologousMember ?node2 .
      ?node2 orth:hasHomologousMember* ?protein_OMA .
      ?node1 orth:hasHomologousMember* ?orthologous_protein2 
      .?orthologous_protein2 orth:organism/obo:RO_0002162/up:scientificName 'Rattus norvegicus' .
      ?orthologous_protein2 sio:SIO_010079 ?gene .
      ?protein_OMA lscr:xrefUniprot ?protein1 .
      FILTER(?node1 != ?node2)
    }
  }
  SERVICE <https://www.bgee.org/sparql/> {
    ?gene genex:isExpressedIn ?anatEntity .
    ?anatEntity rdfs:label 'brain' .
    ?gene orth:organism ?org . 
    ?org obo:RO_0002162 taxon:10116 .
  }
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v10("?anatEntity")
  v3("?annotation")
  v1("?annotation_text")
  v8("?cluster")
  v9("?gene"):::projected 
  v4("?node1")
  v5("?node2")
  v11("?org")
  v7("?orthologous_protein2"):::projected 
  v2("?protein1")
  v6("?protein_OMA")
  a1((" "))
  a2((" "))
  a3((" "))
  c9(["up:Disease_Annotation"]):::iri 
  c12(["orth:OrthologsCluster"]):::iri 
  c16(["Rattus norvegicus"]):::literal 
  c6(["Homo sapiens"]):::literal 
  c22(["brain"]):::literal 
  c11(["orth:Protein"]):::iri 
  c23(["taxon:10116"]):::iri 
  c3(["up:Protein"]):::iri 
  f0[["contains(?annotation_text,'cancer')"]]
  f0 --> v1
  v2 --"a"-->  c3
  v2 --"up:organism"-->  a1
  a1 --"up:scientificName"-->  c6
  v2 --"up:annotation"-->  v3
  v3 --"rdfs:comment"-->  v1
  v3 --"a"-->  c9
  subgraph s1["https://sparql.omabrowser.org/sparql/"]
    style s1 stroke-width:4px;
    f1[["?node1 != ?node2"]]
    f1 --> v4
    f1 --> v5
    v6 --"a"-->  c11
    v7 --"a"-->  c11
    v8 --"a"-->  c12
    v8 --"orth:hasHomologousMember"-->  v4
    v8 --"orth:hasHomologousMember"-->  v5
    v5 --"orth:hasHomologousMember"-->  v6
    v4 --"orth:hasHomologousMember"-->  v7
    v7 --"orth:organism"-->  a2
    a2 --"obo:RO_0002162"-->  a3
    a3 --"up:scientificName"-->  c16
    v7 --"sio:SIO_010079"-->  v9
    v6 --"lscr:xrefUniprot"-->  v2
  end
  subgraph s2["https://www.bgee.org/sparql/"]
    style s2 stroke-width:4px;
    v9 --"genex:isExpressedIn"-->  v10
    v10 --"rdfs:label"-->  c22
    v9 --"orth:organism"-->  v11
    v11 --"obo:RO_0002162"-->  c23
  end