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_00268

Large regions of PE1 proteins that have no associated peptide, and their positional annotations

Use at

PREFIX : <http://nextprot.org/rdf/>
PREFIX cv: <http://nextprot.org/rdf/terminology/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

select distinct ?entry (str(?gen) AS ?gene) ?spos ?annot_type (str(?txt) AS ?txt1) where {
?entry :isoform ?iso .
  ?entry :gene / :name / rdfs:label ?gen .
  ?iso :swissprotDisplayed true .
  ?iso :positionalAnnotation ?statement .
  ?statement a ?annot_type .
  filter not exists {?statement a :Variant }
  filter not exists {?statement a :SrmPeptideMapping }
  filter not exists {?statement a :SequenceConflict }
  optional {?statement rdfs:comment ?txt .}
  ?statement :start ?spos; :end ?epos .
  filter(?spos > ?len/2) # or filter(?spos < ?len/2) no nter
  ?iso :peptideMapping ?pm .
  ?pm :proteotypic true .
  ?pm  :peptideName ?pep.
 ?iso :sequence / :length ?len.
  filter(?len > 250)
 filter not exists {?iso :peptideMapping ?pm2.
                    ?pm2 :start ?pos21 .
                     filter(?pos21 > ?len/2) # no cter pep, or filter(?pos21 < ?len/2) no nter
                    }
  } group by ?entry ?gen ?spos ?annot_type ?txt having(count(distinct ?pep) > 6)
order by ?entry ?spos
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v14("?_anon_aaf95e3c346c4c97af230d5bcfeba8ab1349")
  v9("?annot_type"):::projected 
  v1("?entry"):::projected 
  v11("?epos")
  v8("?gen"):::projected 
  v15("?gene")
  v5("?iso")
  v4("?len")
  v13("?pep")
  v12("?pm")
  v6("?pm2")
  v3("?pos21")
  v2("?spos"):::projected 
  v7("?statement")
  v10("?txt"):::projected 
  v16("?txt1")
  a2((" "))
  a3((" "))
  a4((" "))
  a1((" "))
  c7([":SequenceConflict"]):::iri 
  c8([":SrmPeptideMapping"]):::iri 
  c9([":Variant"]):::iri 
  c15(["true^^xsd:boolean"]):::literal 
  f0[[" > '6^^xsd:integer'"]]
  f0 --> a1
  f1[["not  "]]
  subgraph f1e0["Exists Clause"]
    e0f0[["?pos21 > ?len / '2^^xsd:integer'"]]
    e0f0 --> e0v1
    e0f0 --> e0v2
    e0v3 --":peptideMapping"-->  e0v4
    e0v4 --":start"-->  e0v1
    e0v3("?iso"):::projected 
    e0v2("?len"):::projected 
    e0v4("?pm2"):::projected 
    e0v1("?pos21"):::projected 
  end
  f1--EXISTS--> f1e0
  f1 --> v3
  f1 --> v4
  f1 --> v5
  f1 --> c3
  f1 --> v6
  f1 --> c4
  f2[["?pos21 > ?len / '2^^xsd:integer'"]]
  f2 --> v3
  f2 --> v4
  v5 --":peptideMapping"-->  v6
  v6 --":start"-->  v3
  f3[["?len > '250^^xsd:integer'"]]
  f3 --> v4
  f4[["?spos > ?len / '2^^xsd:integer'"]]
  f4 --> v2
  f4 --> v4
  f5[["not  "]]
  subgraph f5e1["Exists Clause"]
    e1v1 --"a"-->  e1c2
    e1v1("?statement"):::projected 
    e1c2([":SequenceConflict"]):::iri 
  end
  f5--EXISTS--> f5e1
  f5 --> v7
  f5 --> c6
  f5 --> c7
  v7 --"a"-->  c7
  f6[["not  "]]
  subgraph f6e2["Exists Clause"]
    e2v1 --"a"-->  e2c2
    e2v1("?statement"):::projected 
    e2c2([":SrmPeptideMapping"]):::iri 
  end
  f6--EXISTS--> f6e2
  f6 --> v7
  f6 --> c6
  f6 --> c8
  v7 --"a"-->  c8
  f7[["not  "]]
  subgraph f7e3["Exists Clause"]
    e3v1 --"a"-->  e3c2
    e3v1("?statement"):::projected 
    e3c2([":Variant"]):::iri 
  end
  f7--EXISTS--> f7e3
  f7 --> v7
  f7 --> c6
  f7 --> c9
  v7 --"a"-->  c9
  v1 --":isoform"-->  v5
  v1 --":gene"-->  a2
  a2 --":name"-->  a3
  a3 --"rdfs:label"-->  v8
  v5 --":swissprotDisplayed"-->  c15
  v5 --":positionalAnnotation"-->  v7
  v7 --"a"-->  v9
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    v7 -."rdfs:comment".->  v10
  end
  v7 --":start"-->  v2
  v7 --":end"-->  v11
  v5 --":peptideMapping"-->  v12
  v12 --":proteotypic"-->  c15
  v12 --":peptideName"-->  v13
  v5 --":sequence"-->  a4
  a4 --":length"-->  v4
  bind9[/"count(?pep)"/]
  v13 --o bind9
  bind9 --as--o v14
  bind10[/"str(?gen)"/]
  v8 --o bind10
  bind10 --as--o v15
  bind11[/"str(?txt)"/]
  v10 --o bind11
  bind11 --as--o v16