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_00281

Protein pairs with at least 50 common interactors (excluding keratins)

Use at

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

SELECT DISTINCT ?entry ?gene ?entry2 ?gene2 ?commonitcnt ?sampleit WHERE {
 {
 SELECT DISTINCT ?entry (str(?gen) as ?gene) ?entry2 (str(?gen2) as ?gene2) (count (distinct ?commonpartner) as ?commonitcnt) (str(sample(?genit)) as ?sampleit) WHERE {
 ?entry :isoform / :interaction ?it1; :gene / :name / rdfs:label ?gen.
 ?it1 :quality :GOLD; :interactant ?commonpartner .
 ?entry2 :isoform / :interaction ?it2; :gene / :name / rdfs:label ?gen2.
 ?it2 :quality :GOLD;:interactant ?commonpartner .
 ?commonpartner :gene / :name / rdfs:label ?genit .
 filter(?entry != ?entry2)
 filter(!contains(?gen,"KRT") && !contains(?gen2,"KRT") && !contains(?genit,"KRT")) # remove sticky keratins
} group by ?entry ?gen ?entry2 ?gen2 having (count (distinct ?commonpartner) >= 50) 				}
filter(substr(str(?entry),34) < substr(str(?entry2),34)) # ensures only one row by it pair
}
order by desc(?commonitcnt)
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v10("?_anon_aaf95e3c346c4c97af230d5bcfeba8ab1799")
  v11("?_anon_aaf95e3c346c4c97af230d5bcfeba8ab1800")
  v14("?commonitcnt"):::projected 
  v8("?commonpartner")
  v2("?entry"):::projected 
  v3("?entry2"):::projected 
  v4("?gen")
  v5("?gen2")
  v12("?gene"):::projected 
  v13("?gene2"):::projected 
  v6("?genit")
  v7("?it1")
  v9("?it2")
  v14("?sampleit"):::projected 
  a2((" "))
  a3((" "))
  a4((" "))
  a5((" "))
  a6((" "))
  a7((" "))
  a8((" "))
  a9((" "))
  a1((" "))
  c10([":GOLD"]):::iri 
  f0[["substring(str(?entry),'34^^xsd:integer') < substring(str(?entry2),'34^^xsd:integer')"]]
  f0 --> v2
  f0 --> v3
  f1[[" >= '50^^xsd:integer'"]]
  f1 --> a1
  f2[["not contains(?gen,'KRT')not contains(?gen2,'KRT')not contains(?genit,'KRT')"]]
  f2 --> v4
  f2 --> v5
  f2 --> v6
  f3[["?entry != ?entry2"]]
  f3 --> v2
  f3 --> v3
  v2 --":isoform"-->  a2
  a2 --":interaction"-->  v7
  v2 --":gene"-->  a3
  a3 --":name"-->  a4
  a4 --"rdfs:label"-->  v4
  v7 --":quality"-->  c10
  v7 --":interactant"-->  v8
  v3 --":isoform"-->  a5
  a5 --":interaction"-->  v9
  v3 --":gene"-->  a6
  a6 --":name"-->  a7
  a7 --"rdfs:label"-->  v5
  v9 --":quality"-->  c10
  v9 --":interactant"-->  v8
  v8 --":gene"-->  a8
  a8 --":name"-->  a9
  a9 --"rdfs:label"-->  v6
  bind7[/"count(?commonpartner)"/]
  v8 --o bind7
  bind7 --as--o v10
  bind8[/"sample(?genit)"/]
  v6 --o bind8
  bind8 --as--o v11
  bind9[/"str(?gen)"/]
  v4 --o bind9
  bind9 --as--o v12
  bind10[/"str(?gen2)"/]
  v5 --o bind10
  bind10 --as--o v13
  bind11[/"count(?commonpartner)"/]
  v8 --o bind11
  bind11 --as--o v14
  bind12[/"str()"/]
  null --o bind12
  bind12 --as--o v14