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_00225

Proteins with high proline content

Use at

PREFIX : <http://nextprot.org/rdf/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT DISTINCT ?entry ?AAcnt ?seqlen ?AAdensity WHERE {
 ?entry :isoform ?iso.
 ?iso :swissprotDisplayed true .
 ?iso :sequence / :chain ?seq .
 ?iso :sequence / :length ?seqlen .
 bind( strlen( replace( str(?seq), "[^P]", "")) as ?AAcnt) # replace all non-Proline by empty string
 bind(xsd:float(?AAcnt)/xsd:float(?seqlen) as ?AAdensity)
 filter(?AAcnt > 10)
}
order by desc(?AAdensity)
limit 100 # will bring-up the 100 most relevant cases
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v7("?AAcnt"):::projected 
  v7("?AAdensity"):::projected 
  v3("?entry"):::projected 
  v4("?iso")
  v5("?seq")
  v6("?seqlen"):::projected 
  a1((" "))
  a2((" "))
  c4(["true^^xsd:boolean"]):::literal 
  f0[["?AAcnt > '10^^xsd:integer'"]]
  f0 --> v7
  v3 --":isoform"-->  v4
  v4 --":swissprotDisplayed"-->  c4
  v4 --":sequence"-->  a1
  a1 --":chain"-->  v5
  v4 --":sequence"-->  a2
  a2 --":length"-->  v6
  bind1[/"string-length(replace(str(?seq),'#91;^P#93;',''))"/]
  v5 --o bind1
  bind1 --as--o v7
  bind2[/"http://www.w3.org/2001/XMLSchema#float(?AAcnt) / http://www.w3.org/2001/XMLSchema#float(?seqlen)"/]
  v7 --o bind2
  v6 --o bind2
  bind2 --as--o v7