Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARQL] Rhea's RDF #95

Open
6 tasks
egonw opened this issue Nov 21, 2020 · 4 comments
Open
6 tasks

[SPARQL] Rhea's RDF #95

egonw opened this issue Nov 21, 2020 · 4 comments
Assignees

Comments

@egonw
Copy link
Member

egonw commented Nov 21, 2020

Reduce need for rewriting IRIs

  • shares IRIs for genes
    Not possible, genes are not part of Rhea RDF --. Use "wp:bdbUniprot https://identifiers.org/uniprot/Q99424 " from WPRDF; what to do with "unreviewed" IDs?
  • shares IRIs for proteins
    Also not directly possible, Rhea documentation: "The cross-references to UniProt protein entries are not part of the rhea.rdf
    distribution. They are available from the uniprot.rdf distribution." --> See below for examples on federated queries combining Rhea and Uniprot (either through EC, or UniprotID).
  • shares IRIs for metabolites
    See two examples (InChIKey and ChEBI) below
  • shares IRIs for complexes
    @DeniseSl22 didn't find an example for this yet....
  • shares IRIs for publications
PREFIX rh:<http://rdf.rhea-db.org/>
PREFIX pubmed:<http://rdf.ncbi.nlm.nih.gov/pubmed/>
SELECT ?reaction ?reactionEquation WHERE {
 ?reaction rdfs:subClassOf rh:Reaction .
 ?reaction rh:status rh:Approved .
 ?reaction rh:equation ?reactionEquation .
 ?reaction rh:citation ?cit .
 filter (?cit=pubmed:2460092)
}

Write up examples SPARQL query

@DeniseSl22
Copy link
Contributor

DeniseSl22 commented May 7, 2021

Rhea RDF documentation

  • Link to (exact) InchiKey is also possible through Rhea
PREFIX rh:<http://rdf.rhea-db.org/>
PREFIX ch:<http://purl.obolibrary.org/obo/>
PREFIX ch3:<http://purl.obolibrary.org/obo/chebi/>
SELECT ?reaction ?reactionEquation WHERE {
  ?reaction rdfs:subClassOf rh:Reaction .
  ?reaction rh:status rh:Approved .
  ?reaction rh:equation ?reactionEquation .
  ?reaction rh:side ?reactionSide .
  ?reactionSide rh:contains ?participant .
  ?participant rh:compound ?compound .
  ?compound rh:chebi ?chebi .
  ?chebi ch3:inchikey 'WHUUTDBJXJRKMK-VKHMYHEASA-M' .
}
  • Link through ChEBI ontology (note ChEBI IDs are written as CHEBI_ID):
PREFIX rh:<http://rdf.rhea-db.org/>
PREFIX ch:<http://purl.obolibrary.org/obo/>
PREFIX ch2:<http://purl.obolibrary.org/obo/chebi#>
SELECT count(distinct ?reaction) as ?reactionCount WHERE {
  ?reaction rdfs:subClassOf rh:Reaction .
  ?reaction rh:status rh:Approved .
  ?reaction rh:side ?reactionSide .
  ?reactionSide rh:contains ?participant .
  ?participant rh:compound ?compound .
  {
    ?compound rh:chebi ?chebi .
    ?chebi rdfs:subClassOf+ ch:CHEBI_18059 .
  }
  UNION
  {
    ?compound rh:chebi ?chebi .
    ?chebi2 rdfs:subClassOf ?chebiRestriction .
    ?chebiRestriction a owl:Restriction .
    ?chebiRestriction owl:onProperty ch2:has_major_microspecies_at_pH_7_3 .
    ?chebiRestriction owl:someValuesFrom ?chebi .
    ?chebi2 rdfs:subClassOf+ ch:CHEBI_18059 .
  } 
}

@DeniseSl22
Copy link
Contributor

And for MIM-translocation:

PREFIX rh:<http://rdf.rhea-db.org/>
SELECT ?reaction ?reactionEquation WHERE {
  ?reaction rdfs:subClassOf rh:Reaction .
  ?reaction rh:status rh:Approved .
  ?reaction rh:equation ?reactionEquation .
  ?reaction rh:isTransport ?isTransport
  FILTER (?isTransport=true)
}
ORDER BY ?reaction

@DeniseSl22
Copy link
Contributor

@egonw : what's the status of getting our cross-refs to WP into Rhea? I believe you discussed this with Alan Bridge
Example:

PREFIX rh:<http://rdf.rhea-db.org/>
SELECT ?reaction ?xref WHERE {
  ?reaction rdfs:subClassOf rh:Reaction .
  ?reaction rh:directionalReaction ?directionalReaction .
  OPTIONAL { ?directionalReaction rdfs:seeAlso ?xref . }
  ?reaction rh:bidirectionalReaction ?bidirectionalReaction .
  OPTIONAL { ?bidirectionalReaction rdfs:seeAlso ?xref . }
  FILTER (?reaction=rh:11932)
}

@DeniseSl22
Copy link
Contributor

DeniseSl22 commented May 7, 2021

Rhea federated to Uniprot example (EC-numbers):

PREFIX rh:<http://rdf.rhea-db.org/>
PREFIX ec:<http://purl.uniprot.org/enzyme/>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
SELECT ?ecClass (str(?ecName) as ?ecClassName) (count(?reaction) as ?reactionCount) WHERE {
  SERVICE <http://sparql.uniprot.org/sparql> {
    ?ecNumber rdfs:subClassOf ?ecClass .
    ?ecClass skos:prefLabel ?ecName .
    VALUES (?ecClass) { (ec:1.-.-.-)(ec:2.-.-.-)(ec:3.-.-.-)(ec:4.-.-.-)(ec:5.-.-.-)(ec:6.-.-.-)(ec:7.-.-.-) }
  }
  ?reaction rdfs:subClassOf rh:Reaction .
  ?reaction rh:ec ?ecNumber .
}

And example with Uniprot ID:

PREFIX rh:<http://rdf.rhea-db.org/>
PREFIX ch:<http://purl.obolibrary.org/obo/>
PREFIX up:<http://purl.uniprot.org/core/>
PREFIX uniprotkb:<http://purl.uniprot.org/uniprot/>
SELECT ?chebi
       ?reaction
       ?equation
WHERE {
  SERVICE <http://sparql.uniprot.org/sparql> {
    	?protein up:reviewed true .
        ?protein up:annotation ?a .
        ?a a up:Cofactor_Annotation .
        ?a up:cofactor ?chebi .
        VALUES (?protein) {(uniprotkb:P15877)} .
   }
  ?reaction rdfs:subClassOf rh:Reaction .
  ?reaction rh:status rh:Approved .
  ?reaction rh:equation ?equation .
  ?reaction rh:side ?reactionSide .
  ?reactionSide rh:contains ?participant .
  ?participant rh:compound ?compound .
  ?compound rh:chebi ?chebi .
}
order by ?chebi

From Uniprot Endpoint (how to match reviewed protein IDs only):

PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX up: <http://purl.uniprot.org/core/>
SELECT ?protein ?name
WHERE
{
        ?protein a up:Protein .
        ?protein up:reviewed true .
        ?protein up:recommendedName ?recommended .
        ?recommended up:fullName ?name .
        ?protein up:encodedBy ?gene .
        ?gene skos:prefLabel ?text .
        FILTER CONTAINS(?text, 'DNA')
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants