sparql-examples

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

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

019

Which are the orthologs of a gene that is expressed in the fruit fly's brain?

Use at

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

SELECT DISTINCT ?geneEnsembl ?proteinOrtholog ?geneOrthologEnsembl ?taxonOrtholog ?omaLinkOrtholog WHERE {
    {
        SELECT DISTINCT * {
            ?gene a orth:Gene ;
                genex:isExpressedIn/rdfs:label 'brain' ;
                orth:organism/obo:RO_0002162 ?taxonFly ;
                dcterms:identifier ?geneEnsembl .
            ?taxonFly up:commonName 'fruit fly' .
        } LIMIT 20
    }

    SERVICE <https://sparql.omabrowser.org/sparql/> {
        ?cluster a orth:OrthologsCluster ;
            orth:hasHomologousMember ?node1 ;
            orth:hasHomologousMember ?node2 .
        ?node1 orth:hasHomologousMember* ?protein1 .
        ?node2 orth:hasHomologousMember* ?proteinOrtholog .
        ?protein1 sio:SIO_010079 ?gene . # is encoded by
        ?proteinOrtholog rdfs:seeAlso ?omaLinkOrtholog ;
            orth:organism/obo:RO_0002162 ?taxonOrthologUri ;
            sio:SIO_010079 ?geneOrtholog . # is encoded by
        FILTER ( ?node1 != ?node2 )
    }
    ?taxonOrthologUri up:commonName ?taxonOrtholog .
    ?geneOrtholog dcterms:identifier ?geneOrthologEnsembl .
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v6("?cluster")
  v1("?gene")
  v3("?geneEnsembl"):::projected 
  v11("?geneOrtholog")
  v13("?geneOrthologEnsembl"):::projected 
  v4("?node1")
  v5("?node2")
  v9("?omaLinkOrtholog"):::projected 
  v7("?protein1")
  v8("?proteinOrtholog"):::projected 
  v2("?taxonFly")
  v12("?taxonOrtholog"):::projected 
  v10("?taxonOrthologUri")
  a1((" "))
  a2((" "))
  a3((" "))
  c10(["fruit fly"]):::literal 
  c12(["orth:OrthologsCluster"]):::iri 
  c2(["orth:Gene"]):::iri 
  c5(["brain"]):::literal 
  v1 --"a"-->  c2
  v1 --"genex:isExpressedIn"-->  a1
  a1 --"rdfs:label"-->  c5
  v1 --"orth:organism"-->  a2
  a2 --"obo:RO_0002162"-->  v2
  v1 --"dcterms:identifier"-->  v3
  v2 --"up:commonName"-->  c10
  subgraph s1["https://sparql.omabrowser.org/sparql/"]
    style s1 stroke-width:4px;
    f0[["?node1 != ?node2"]]
    f0 --> v4
    f0 --> v5
    v6 --"a"-->  c12
    v6 --"orth:hasHomologousMember"-->  v4
    v6 --"orth:hasHomologousMember"-->  v5
    v4 --"orth:hasHomologousMember"-->  v7
    v5 --"orth:hasHomologousMember"-->  v8
    v7 --"sio:SIO_010079"-->  v1
    v8 --"rdfs:seeAlso"-->  v9
    v8 --"orth:organism"-->  a3
    a3 --"obo:RO_0002162"-->  v10
    v8 --"sio:SIO_010079"-->  v11
  end
  v10 --"up:commonName"-->  v12
  v11 --"dcterms:identifier"-->  v13