sparql-examples

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

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

neXtProt/NXQ_00249

GO_MF terms associated with proteins binding estradiol and/or similar molecules (substructure search with SMILES)

Use at

PREFIX : <http://nextprot.org/rdf/>
PREFIX cv: <http://nextprot.org/rdf/terminology/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

PREFIX sachem: <http://bioinfo.uochb.cas.cz/rdf/v1.0/sachem#>
PREFIX idsm: <https://idsm.elixir-czech.cz/sparql/endpoint/>
PREFIX chembl: <http://rdf.ebi.ac.uk/terms/chembl#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>

SELECT distinct ?gomf ?gomflab (count(distinct ?entry) as ?ecnt) WHERE
{
  {
    SELECT ?compound ?UNIPROT WHERE {
      SERVICE <https://www.ebi.ac.uk/rdf/services/sparql/> {
        SERVICE idsm:chembl {
          ?compound sachem:substructureSearch [
              sachem:query "CC12CCC3C(C1CCC2O)CCC4=C3C=CC(=C4)O"] . # smiles chain for estradiol
        }

        ?ACTIVITY rdf:type chembl:Activity;
          chembl:hasMolecule ?compound;
          chembl:hasAssay ?ASSAY.
        ?ASSAY chembl:hasTarget ?TARGET.
        ?TARGET chembl:hasTargetComponent ?COMPONENT.
        ?TARGET chembl:taxonomy <http://identifiers.org/taxonomy/9606> . # human protein target
        ?COMPONENT chembl:targetCmptXref ?UNIPROT.
        ?UNIPROT rdf:type chembl:UniprotRef.
      }
    }
  }

  ?entry skos:exactMatch ?UNIPROT.
  ?entry :isoform ?iso.
  ?iso :goMolecularFunction / :term ?gomf .
  ?gomf rdfs:label ?gomflab .
} group by ?gomf ?gomflab having(count (distinct ?entry) > 4)
order by desc(?ecnt)
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v3("?ACTIVITY")
  v4("?ASSAY")
  v6("?COMPONENT")
  v5("?TARGET")
  v7("?UNIPROT")
  v12("?_anon_aaf95e3c346c4c97af230d5bcfeba8ab4235")
  v2("?compound")
  v13("?ecnt")
  v8("?entry"):::projected 
  v10("?gomf"):::projected 
  v11("?gomflab"):::projected 
  v9("?iso")
  a2((" "))
  a3((" "))
  a1((" "))
  c5(["CC12CCC3C(C1CCC2O)CCC4=C3C=CC(=C4)O"]):::literal 
  c16([http://rdf.ebi.ac.uk/terms/chembl#UniprotRef]):::iri 
  c14([http://identifiers.org/taxonomy/9606]):::iri 
  c8([http://rdf.ebi.ac.uk/terms/chembl#Activity]):::iri 
  f0[[" > '4^^xsd:integer'"]]
  f0 --> a1
  subgraph s1["https://www.ebi.ac.uk/rdf/services/sparql/"]
    style s1 stroke-width:4px;
    subgraph s2["https://idsm.elixir-czech.cz/sparql/endpoint/chembl"]
      style s2 stroke-width:4px;
      a2 --"sachem:query"-->  c5
      v2 --"sachem:substructureSearch"-->  a2
    end
    v3 --"a"-->  c8
    v3 --http://rdf.ebi.ac.uk/terms/chembl#hasMolecule-->  v2
    v3 --http://rdf.ebi.ac.uk/terms/chembl#hasAssay-->  v4
    v4 --http://rdf.ebi.ac.uk/terms/chembl#hasTarget-->  v5
    v5 --http://rdf.ebi.ac.uk/terms/chembl#hasTargetComponent-->  v6
    v5 --http://rdf.ebi.ac.uk/terms/chembl#taxonomy-->  c14
    v6 --http://rdf.ebi.ac.uk/terms/chembl#targetCmptXref-->  v7
    v7 --"a"-->  c16
  end
  v8 --"skos:exactMatch"-->  v7
  v8 --":isoform"-->  v9
  v9 --":goMolecularFunction"-->  a3
  a3 --":term"-->  v10
  v10 --"rdfs:label"-->  v11
  bind3[/"count(?entry)"/]
  v8 --o bind3
  bind3 --as--o v12
  bind4[/"count(?entry)"/]
  v8 --o bind4
  bind4 --as--o v13