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_09410

Check there are no entries with a PTM on a non-proteotypic peptide (excluding PTMs with evidence from UniProt)

Use at

PREFIX : <http://nextprot.org/rdf/>
PREFIX cv: <http://nextprot.org/rdf/terminology/>
PREFIX source: <http://nextprot.org/rdf/source/>

select distinct ?entry where {
    ?entry :isoform ?iso.
    ?iso :swissprotDisplayed true .
    ?iso :ptm ?ptm .
    ?ptm :start ?pos.
    filter not exists { ?ptm :evidence / :assignedBy source:Uniprot. } # <-added clause
    ?iso :peptideMapping ?pm .
    ?pm :proteotypic false ; :start ?p1 ; :end ?p2 .
    filter(?pos >= ?p1 && ?pos <= ?p2)
    filter not exists {
      ?iso :peptideMapping ?pm2 .
      ?pm2 :proteotypic true ; :start ?p21 ; :end ?p22 .
      filter(?pos >= ?p21 && ?pos <= ?p22)
      }
}
order by ?entry
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v1("?entry"):::projected 
  v5("?iso")
  v7("?p1")
  v8("?p2")
  v3("?p21")
  v4("?p22")
  v10("?pm")
  v6("?pm2")
  v2("?pos")
  v9("?ptm")
  a1((" "))
  c8([":source/Uniprot"]):::iri 
  c3(["true^^xsd:boolean"]):::literal 
  c12(["false^^xsd:boolean"]):::literal 
  f0[["not  "]]
  subgraph f0e0["Exists Clause"]
    e0f0[["?pos >= ?p21?pos <= ?p22"]]
    e0f0 --> e0v1
    e0f0 --> e0v2
    e0f0 --> e0v3
    e0v4 --":peptideMapping"-->  e0v5
    e0v5 --":proteotypic"-->  e0c3
    e0v5 --":start"-->  e0v2
    e0v5 --":end"-->  e0v3
    e0v4("?iso"):::projected 
    e0v2("?p21"):::projected 
    e0v3("?p22"):::projected 
    e0v5("?pm2"):::projected 
    e0v1("?pos"):::projected 
    e0c3(["true^^xsd:boolean"]):::literal 
  end
  f0--EXISTS--> f0e0
  f0 --> v2
  f0 --> v3
  f0 --> v4
  f0 --> v5
  f0 --> c1
  f0 --> v6
  f0 --> c2
  f0 --> c3
  f0 --> c4
  f0 --> c5
  f1[["?pos >= ?p21?pos <= ?p22"]]
  f1 --> v2
  f1 --> v3
  f1 --> v4
  v5 --":peptideMapping"-->  v6
  v6 --":proteotypic"-->  c3
  v6 --":start"-->  v3
  v6 --":end"-->  v4
  f2[["?pos >= ?p1?pos <= ?p2"]]
  f2 --> v2
  f2 --> v7
  f2 --> v8
  f3[["not  "]]
  subgraph f3e1["Exists Clause"]
    e1v1 --":evidence"-->  e1a1
    e1a1 --":assignedBy"-->  e1c3
    e1v1("?ptm"):::projected 
    e1a1((" ")):::projected 
    e1c3([":source/Uniprot"]):::iri 
  end
  f3--EXISTS--> f3e1
  f3 --> v9
  f3 --> c6
  f3 --> a1
  f3 --> c7
  f3 --> c8
  v9 --":evidence"-->  a1
  a1 --":assignedBy"-->  c8
  v1 --":isoform"-->  v5
  v5 --":swissprotDisplayed"-->  c3
  v5 --":ptm"-->  v9
  v9 --":start"-->  v2
  v5 --":peptideMapping"-->  v10
  v10 --":proteotypic"-->  c12
  v10 --":start"-->  v7
  v10 --":end"-->  v8