sparql-examples

A set of SPARQL examples that are used in different SIB resources

View the Project on GitHub sib-swiss/sparql-examples

10

Select all human UniProtKB entries with a sequence variant that leads to a tyrosine to phenylalanine substitution

Use at

PREFIX faldo: <http://biohackathon.org/resource/faldo#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX taxon: <http://purl.uniprot.org/taxonomy/>
PREFIX up: <http://purl.uniprot.org/core/>

SELECT ?protein ?annotation ?begin ?text
WHERE
{
        ?protein a up:Protein ;
            up:organism taxon:9606 ; 
            up:annotation ?annotation .
        ?annotation a up:Natural_Variant_Annotation ;
            rdfs:comment ?text ;
            up:substitution ?substitution ;
            up:range/faldo:begin
                [ faldo:position ?begin ;
                  faldo:reference ?sequence ] .
        ?sequence rdf:value ?value .
        BIND (substr(?value, ?begin, 1) as ?original) .
        FILTER(?original = 'Y' && ?substitution = 'F') .
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v4("?annotation"):::projected 
  v6("?begin"):::projected 
  v9("?original")
  v3("?protein"):::projected 
  v7("?sequence")
  v2("?substitution")
  v5("?text"):::projected 
  v8("?value")
  a2((" "))
  a1((" "))
  c6(["taxon:9606"]):::iri 
  c8(["up:Natural_Variant_Annotation"]):::iri 
  c4(["up:Protein"]):::iri 
  f0[["?original = 'Y'?substitution = 'F'"]]
  f0 --> v9
  f0 --> v2
  v3 --"a"-->  c4
  v3 --"up:organism"-->  c6
  v3 --"up:annotation"-->  v4
  v4 --"a"-->  c8
  v4 --"rdfs:comment"-->  v5
  v4 --"up:substitution"-->  v2
  a1 --"faldo:position"-->  v6
  a1 --"faldo:reference"-->  v7
  v4 --"up:range"-->  a2
  a2 --"faldo:begin"-->  a1
  v7 --"rdf:value"-->  v8
  bind1[/"substring(?value,?begin,'1^^xsd:integer')"/]
  v8 --o bind1
  v6 --o bind1
  bind1 --as--o v9