Skip to content

Sample query: Find GO cellular components in which human proteins are located

bill-baumgartner edited this page Jun 23, 2019 · 3 revisions
# find GO cellular components in which human proteins are located

PREFIX franzOption_chunkProcessingAllowed: <franz:yes>
PREFIX franzOption_clauseReorderer: <franz:identity>
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX ccp: <http://ccp.ucdenver.edu/obo/ext/>
PREFIX kice: <http://ccp.ucdenver.edu/kabob/ice/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT DISTINCT ?protein_name ?GOcc_name WHERE {
  
   values ?protein_id {
      kice:UNIPROT_O43699
      kice:UNIPROT_P15884
   }

   # each uniprot identifier denotes a protein, so get a reference to the protein here
   ?protein_id obo:IAO_0000219 ?protein . # IAO_0000219 = IAO:denotes
   ?protein rdfs:label ?protein_name .

   # restriction - the proteins must be human
   ?protein rdfs:subClassOf ?only_in_taxon_r .
   ?only_in_taxon_r owl:onProperty ?only_in_taxon .
   kice:RO_0002160 obo:IAO_0000219 ?only_in_taxon .
   filter (?only_in_taxon != obo:RO_0002160) . # RO:only_in_taxon
  
   # find all OWL restrictions using the only_in_taxon relation
   ?only_in_taxon_r owl:someValuesFrom ?taxon .

   # constrain the taxon to be human - don't have to subclass taxon bc the class is at the highest level
   kice:NCBITaxon_9606 obo:IAO_0000219 ?taxon .
  
   # create a subclass of the protein that will participate in a restriction
   ?bioentity_sc rdfs:subClassOf ?protein .

   # create a transports or maintains localization of restriction that the protein is the object of
   ?trans_restriction owl:someValuesFrom ?bioentity_sc .
   ?trans_restriction rdf:type owl:Restriction .
   ?trans_restriction owl:onProperty ?transports .
   kice:RO_0002313 obo:IAO_0000219 ?transports . # RO_0000057 = RO:transports; IAO_0000219 = IAO:denotes

   # create a subclass of localization that is constrained by the transports_or_maintains_localization_of restriction above
   ?localization_sc rdfs:subClassOf ?trans_restriction .
   ?localization_sc rdfs:subClassOf ?localization .
   kice:GO_0051179 obo:IAO_0000219 ?localization . # GO_0051179 = GO:localization; IAO_0000219 = IAO:denotes
  
   # add a has target end location restriction to the localization process
   ?localization_sc rdfs:subClassOf ?target_restriction .
   ?target_restriction rdf:type owl:Restriction .
   ?target_restriction owl:onProperty ?targets .
   kice:RO_0002339 obo:IAO_0000219 ?targets . # RO_0000057 = RO:transports; IAO_0000219 = IAO:denotes
   ?target_restriction owl:someValuesFrom ?specCC .

   # get target of the localization and constrain it to be a GO cellular component
   ?specCC rdfs:subClassOf ?GOcc .
   ?GOcc rdfs:subClassOf* ?cc .
   kice:GO_0005575 obo:IAO_0000219 ?cc . # GO_0005575 = GO:cellular component; IAO_0000219 = IAO:denotes
   filter (?cc != obo:GO_0005575) # GO_0005575 = GO:cellular component
   ?GOcc rdfs:label ?GOcc_name .
                                                                         
}