sparql-examples

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

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

neXtProt/NXQ_00251

Proteins with at least one proteotypic peptide 9aa+ not mapping on canonical isoform

Use at

PREFIX : <http://nextprot.org/rdf/>

select ?entry (sample(?isopos) as ?samplematch) WHERE {
 ?entry :isoform ?iso1, ?isononcano.
 ?iso1 :swissprotDisplayed true .
 ?isononcano :swissprotDisplayed false .
 ?isononcano :peptideMapping ?pm.
 ?pm :peptideName ?pepname.
 ?pm :proteotypic true.
 ?pm :start ?pos ; :end ?pos2 .
 filter(?pos2 - ?pos >= 8) # peptide length >= 9
 bind(strafter(str(?isononcano),"-") as ?isostr)
 bind(concat(concat(?isostr,"-"),?pos) as ?isopos)
 filter not exists {?iso1 :peptideMapping/ :peptideName ?pepname.}
 }
group by ?entry
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v5("?entry"):::projected 
  v1("?iso1")
  v6("?isononcano")
  v9("?isopos"):::projected 
  v8("?isostr")
  v2("?pepname")
  v7("?pm")
  v4("?pos")
  v3("?pos2")
  v10("?samplematch")
  a1((" "))
  c6(["true^^xsd:boolean"]):::literal 
  c7(["false^^xsd:boolean"]):::literal 
  f0[["not  "]]
  subgraph f0e0["Exists Clause"]
    e0v1 --":peptideMapping"-->  e0a1
    e0a1 --":peptideName"-->  e0v2
    e0v1("?iso1"):::projected 
    e0v2("?pepname"):::projected 
    e0a1((" ")):::projected 
  end
  f0--EXISTS--> f0e0
  f0 --> v1
  f0 --> c1
  f0 --> a1
  f0 --> c2
  f0 --> v2
  v1 --":peptideMapping"-->  a1
  a1 --":peptideName"-->  v2
  f1[["?pos2 - ?pos >= '8^^xsd:integer'"]]
  f1 --> v3
  f1 --> v4
  v5 --":isoform"-->  v1
  v5 --":isoform"-->  v6
  v1 --":swissprotDisplayed"-->  c6
  v6 --":swissprotDisplayed"-->  c7
  v6 --":peptideMapping"-->  v7
  v7 --":peptideName"-->  v2
  v7 --":proteotypic"-->  c6
  v7 --":start"-->  v4
  v7 --":end"-->  v3
  bind2[/"substring-after(str(?isononcano),'-')"/]
  v6 --o bind2
  bind2 --as--o v8
  bind3[/"concat(concat(?isostr,'-'),?pos)"/]
  v8 --o bind3
  v4 --o bind3
  bind3 --as--o v9
  bind5[/"sample(?isopos)"/]
  v9 --o bind5
  bind5 --as--o v10