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_00282

Proteins with an interaction mapping encompassing a coiled coil or bZip region

Use at

PREFIX : <http://nextprot.org/rdf/>
PREFIX nextprot_cv: <http://nextprot.org/rdf/terminology/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT DISTINCT ?entry (str(?gen) as ?gene) ?itlen ?coilen (str(?gen2) as ?partnergene) WHERE {
 ?entry :isoform ?iso; :gene / :recommendedName / rdfs:label ?gen .
 ?iso :swissprotDisplayed true; :interactionMapping ?itmap .
 ?itmap :interactant ?entry2; :start ?its; :end ?ite .
 bind(?ite - ?its + 1 as ?itlen)
 ?entry2 :isoform? ?iso2; :gene / :recommendedName / rdfs:label ?gen2.
 ?iso2 :swissprotDisplayed true.
 {?iso :coiledCoilRegion ?coil . }
 union
 {?iso :region ?coil .
 ?coil :term nextprot_cv:DO-00078 # bzip
 }
 ?coil :start ?cs; :end ?ce .
 bind(?ce - ?cs + 1 as ?coilen)
 filter (?cs >= ?its -15 && ?ce <= ?ite + 15) # overlap
 filter(xsd:float(?itlen) / xsd:float(?coilen) < 2.0) # itlen no more than 2 coilen
} order by ?entry
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v6("?ce")
  v14("?coil")
  v15("?coilen"):::projected 
  v4("?cs")
  v1("?entry"):::projected 
  v11("?entry2")
  v9("?gen"):::projected 
  v13("?gen2"):::projected 
  v15("?gene")
  v8("?iso")
  v12("?iso2")
  v7("?ite")
  v12("?itlen"):::projected 
  v10("?itmap")
  v5("?its")
  v16("?partnergene")
  a1((" "))
  a2((" "))
  a3((" "))
  a4((" "))
  c17([":terminology/DO-00078"]):::iri 
  c9(["true^^xsd:boolean"]):::literal 
  f0[["http://www.w3.org/2001/XMLSchema#float(?itlen) / http://www.w3.org/2001/XMLSchema#float(?coilen) < '2.0^^xsd:decimal'"]]
  f0 --> v12
  f0 --> v15
  f1[["?cs >= ?its + '-15^^xsd:integer'?ce <= ?ite + '15^^xsd:integer'"]]
  f1 --> v4
  f1 --> v5
  f1 --> v6
  f1 --> v7
  v1 --":isoform"-->  v8
  v1 --":gene"-->  a1
  a1 --":recommendedName"-->  a2
  a2 --"rdfs:label"-->  v9
  v8 --":swissprotDisplayed"-->  c9
  v8 --":interactionMapping"-->  v10
  v10 --":interactant"-->  v11
  v10 --":start"-->  v5
  v10 --":end"-->  v7
  bind2[/"?ite - ?its + '1^^xsd:integer'"/]
  v7 --o bind2
  v5 --o bind2
  bind2 --as--o v12
  subgraph union0[" Union "]
  subgraph union0l[" "]
    style union0l fill:#abf,stroke-dasharray: 3 3;
    v11 --":isoform"-->  v12
  end
  subgraph union0r[" "]
    style union0r fill:#abf,stroke-dasharray: 3 3;
  end
  union0r <== or ==> union0l
  end
  v11 --":gene"-->  a3
  a3 --":recommendedName"-->  a4
  a4 --"rdfs:label"-->  v13
  v12 --":swissprotDisplayed"-->  c9
  subgraph union1[" Union "]
  subgraph union1l[" "]
    style union1l fill:#abf,stroke-dasharray: 3 3;
    v8 --":region"-->  v14
    v14 --":term"-->  c17
  end
  subgraph union1r[" "]
    style union1r fill:#abf,stroke-dasharray: 3 3;
    v8 --":coiledCoilRegion"-->  v14
  end
  union1r <== or ==> union1l
  end
  v14 --":start"-->  v4
  v14 --":end"-->  v6
  bind3[/"?ce - ?cs + '1^^xsd:integer'"/]
  v6 --o bind3
  v4 --o bind3
  bind3 --as--o v15
  bind4[/"str(?gen)"/]
  v9 --o bind4
  bind4 --as--o v15
  bind5[/"str(?gen2)"/]
  v13 --o bind5
  bind5 --as--o v16