Skip to content

From GSMN to RDF and back

mpagni12 edited this page Dec 11, 2018 · 8 revisions

For each uniprot entry of the mouse proteome find the catalyzed rhea reactions. Given those reactions retrieve the ChEBI that are involved in those reactions.

PREFIX up:<http://purl.uniprot.org/core/> 
PREFIX taxon:<http://purl.uniprot.org/taxonomy/> 
PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX rh:<http://rdf.rhea-db.org/>
SELECT 
  ?protein 
  ?rhea
  ?rheaEquation
WHERE
{
  ?protein up:organism taxon:10090 ;
           up:reviewed true ;
           up:annotation/up:catalyticActivity/up:catalyzedReaction ?rhea .
  SERVICE <https://sparql.rhea-db.org/sparql> {
  	?rhea ?x ?rheaEquation .  
  }
}

PREFIX up:<http://purl.uniprot.org/core/> 
PREFIX taxon:<http://purl.uniprot.org/taxonomy/> 
PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX rh:<http://rdf.rhea-db.org/>
SELECT 
  ?protein 
  ?rhea
  (GROUP_CONCAT(?chebi ; separator=',') AS ?chebis)
WHERE
{
  ?protein up:organism taxon:10090 ;
           up:reviewed true ;
           up:annotation/up:catalyticActivity/up:catalyzedReaction ?rhea .
  SERVICE <https://sparql.rhea-db.org/sparql> {
  	?rhea rh:status ?rheaStatus ;
          rh:equation ?rheaEquation ;
          rh:side ?reactionSide .
    ?reactionSide rh:contains ?participant .
    ?participant rh:compound ?compound .
    ?compound rh:chebi ?chebi
  }
} GROUP BY ?protein ?rhea

This adds the coefficient (stoichemistry) to the query result. This is important to balance flux.

PREFIX up:<http://purl.uniprot.org/core/> 
PREFIX taxon:<http://purl.uniprot.org/taxonomy/> 
PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX rh:<http://rdf.rhea-db.org/>
SELECT 
  ?protein 
  ?rhea
  ?chebi
  ?reactionSide
  ?coefficient
WHERE
{
  <http://purl.uniprot.org/uniprot/P27786> up:organism taxon:10090 ;
           up:reviewed true ;
           up:annotation/up:catalyticActivity/up:catalyzedReaction ?rhea .
  SERVICE <https://sparql.rhea-db.org/sparql> {
  	?rhea rh:status ?rheaStatus ;
          rh:equation ?rheaEquation ;
          rh:side ?reactionSide .
    ?reactionSide ?contains ?participant .
    ?contains rdfs:subPropertyOf rh:contains ;
          rh:coefficient ?coefficient .
    
    ?participant rh:compound ?compound .
                
    ?compound rh:chebi ?chebi .
  }
}

To be run from the UniProt website:

PREFIX up:<http://purl.uniprot.org/core/> 
PREFIX taxon:<http://purl.uniprot.org/taxonomy/> 
PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX rh:<http://rdf.rhea-db.org/>
SELECT 
    ?protein 
    ?rhea
    ?reactionSide
    ?chebi
    ?coefficient
    ?location
WHERE{
    ?protein up:organism        taxon:10090 ;
             up:reviewed        true ;
             up:annotation/up:catalyticActivity/up:catalyzedReaction ?rhea .
    SERVICE <https://sparql.rhea-db.org/sparql> {
       ?rhea         rh:status          ?rheaStatus ;
                     rh:equation        ?rheaEquation ;
                     rh:side            ?reactionSide .
       ?reactionSide ?contains          ?participant .
       ?contains     rdfs:subPropertyOf rh:contains ;
                     rh:coefficient     ?coefficient .
       ?participant  rh:compound        ?compound .
       OPTIONAL{ ?participant rh:location        ?location . }
       ?compound     rh:chebi           ?chebi .
    }
}

Clone this wiki locally