SPARQL example query
◀
◀
14: Select all Rhea reactions that have a given ChEBI ID as reaction participant
PREFIX CHEBI: <http://purl.obolibrary.org/obo/CHEBI_> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rh: <http://rdf.rhea-db.org/> # Query 14 # Select all Rhea reactions that have CHEBI:29985 (L-glutamate) as reaction participant # # This query corresponds to the Rhea website query: # https://www.rhea-db.org/rhea?query=chebi:29985 SELECT distinct ?chebi ?rhea ?equation WHERE { ?rhea rdfs:subClassOf rh:Reaction . ?rhea rh:equation ?equation . ?rhea rh:side/rh:contains/rh:compound ?compound . # # the ChEBI can be used either as a small molecule, the reactive part of a macromolecule or as a polymer. # ?compound (rh:chebi|(rh:reactivePart/rh:chebi)|(rh:underlyingChebi/rh:chebi)) ?chebi . VALUES (?chebi) { (CHEBI:29985) } }Use15: Select all ChEBI compounds used in Rhea as reaction participant
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rh: <http://rdf.rhea-db.org/> PREFIX up: <http://purl.uniprot.org/core/> # Query 15 # Select all ChEBI compounds used in Rhea as reaction participant # # This query can not be expressed in the Rhea website SELECT ?chebi ?name (count(?rhea) as ?countRhea) WHERE { ?rhea rdfs:subClassOf rh:Reaction . ?rhea rh:side/rh:contains/rh:compound ?compound . # # the ChEBI can be used either as a small molecule, the reactive part of a macromolecule or as a polymer. # ?compound (rh:chebi|(rh:reactivePart/rh:chebi)|(rh:underlyingChebi/rh:chebi)) ?chebi . ?chebi up:name ?name . } GROUP BY ?chebi ?name ORDER BY DESC(?countRhea)Use16: Select all Rhea reactions that have a pair of ChEBI IDs as reaction participant and in opposite side
PREFIX CHEBI: <http://purl.obolibrary.org/obo/CHEBI_> PREFIX rh: <http://rdf.rhea-db.org/> PREFIX up: <http://purl.uniprot.org/core/> # Query 16 # Select all Rhea reactions that have a pair of ChEBI IDs as reaction participant and in opposite side # Return Rhea reactions that have CHEBI:29985 (L-glutamate) as reaction participant in one side # and CHEBI:58359 (L-glutamine) in the other side # # This query cannot be expressed in the Rhea website SELECT ?chebi1 ?name1 ?chebi2 ?name2 ?rhea ?equation WHERE { VALUES (?chebi1) { (CHEBI:29985) } ?chebi1 up:name ?name1 . ?rhea rh:side ?reactionSide1 . ?reactionSide1 rh:contains / rh:compound / rh:chebi ?chebi1 . VALUES (?chebi2) { (CHEBI:58359) } ?chebi2 up:name ?name2 . ?rhea rh:side ?reactionSide2 . ?reactionSide2 rh:contains / rh:compound / rh:chebi ?chebi2 . ?reactionSide1 rh:transformableTo ?reactionSide2 . ?rhea rh:equation ?equation . }Use17: Select all Rhea reactions that involve a lipid, i.e. children of CHEBI:18059 in the ChEBI hierarchy.
PREFIX CHEBI: <http://purl.obolibrary.org/obo/CHEBI_> PREFIX chebihash: <http://purl.obolibrary.org/obo/chebi#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rh: <http://rdf.rhea-db.org/> PREFIX up: <http://purl.uniprot.org/core/> # Query 17 # Select all Rhea reactions that involve a lipid, i.e. children of CHEBI:18059 in the ChEBI hierarchy. # # This query corresponds to the Rhea website query: # https://www.rhea-db.org/rhea?query=chebi:18059 # SELECT distinct ?chebi ?name ?rhea ?equation WHERE { ?rhea rdfs:subClassOf rh:Reaction . ?rhea rh:equation ?equation . ?rhea rh:side/rh:contains/rh:compound ?compound . # # the ChEBI can be used either as a small molecule, the reactive part of a macromolecule or as a polymer. # { ?chebi rdfs:subClassOf* CHEBI:18059 . # lipid ?compound (rh:chebi|(rh:reactivePart/rh:chebi)|(rh:underlyingChebi/rh:chebi)) ?chebi . } UNION { # add non-pH 7.3 species ?not7_3 rdfs:subClassOf* CHEBI:18059 . # lipid ?not7_3 rdfs:subClassOf ?chebiRestriction . ?chebiRestriction a owl:Restriction . ?chebiRestriction owl:onProperty chebihash:has_major_microspecies_at_pH_7_3 . ?chebiRestriction owl:someValuesFrom ?chebi . ?compound (rh:chebi|(rh:reactivePart/rh:chebi)|(rh:underlyingChebi/rh:chebi)) ?chebi . } ?chebi up:name ?name . }Use18: Use IDSM Sachem to find ChEBIs with a a Cholestane skeleton (in SMILES). Then match returned ChEBIs to Rhea undirected reactions.
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rh: <http://rdf.rhea-db.org/> PREFIX sachem: <http://bioinfo.uochb.cas.cz/rdf/v1.0/sachem#> SELECT ?rhea ?chebi WHERE { SERVICE <https://idsm.elixir-czech.cz/sparql/endpoint/chebi> { ?chebi sachem:substructureSearch [ sachem:query "[C@]12(CCC3CCCC[C@]3(C)[C@@]1([H])CC[C@]1(C)[C@@]([H])([C@@](C)([H])CCCC(C)C)CC[C@@]21[H])[H]" ]. } ?rhea rh:side/rh:contains/rh:compound/rdfs:subClassOf ?chebi . }Use