candYgene / queries

SPARQL queries for Web API
Apache License 2.0
0 stars 0 forks source link

Improve/add SPARQL queries #1

Closed arnikz closed 5 years ago

arnikz commented 6 years ago
gurnoor1990 commented 6 years ago

Get gene annotations from Uniprot given a gene ID

Not working due to \^ \<http://rdf.ebi.ac.uk/terms/ensembl/CHECKSUM > ?ensembl_prot_id .

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX uniprot: <http://purl.uniprot.org/core/>
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX so: <http://purl.obolibrary.org/obo/so#>
PREFIX go: <http://www.geneontology.org/formats/oboInOwl#>

SELECT
   DISTINCT
   ?gene_name
   ?sgngene_id
   ?uniprot_acc
   ?uniprot_id
   ?uniprot_des
WHERE {
   GRAPH <http://www.uniprot.org/proteomes/Solanum_lycopersicum> {
      ?prot uniprot:encodedBy/skos:prefLabel ?gene_name
   }
   GRAPH <http://plants.ensembl.org/Solanum_lycopersicum> {
      ?prot dc:identifier ?uniprot_acc ;
          rdfs:label ?uniprot_id ;
          dc:description ?uniprot_des ;
          ^<http://rdf.ebi.ac.uk/terms/ensembl/CHECKSUM> ?ensembl_prot_id .
       ?ensembl_transcript_id so:translates_to ?ensembl_prot_id ;
          so:transcribed_from/dc:identifier ?sgngene_id .
          BIND(bif:strcontains(?sgngene_id, "Solyc07g049530.2") AS ?match)
          FILTER(?match = 1)
   }

}
arnikz commented 6 years ago

I updated some of the queries (see https://github.com/candYgene/queries/commit/ad88b31797a49b23b038e7017de3aa1b2a257f4f) including their names (using camelCase). Please consider these as examples in future dev.