sparql-examples

A set of SPARQL examples that are used in different SIB resources

View the Project on GitHub sib-swiss/sparql-examples

16

Find statistics on translated sequence length for genes matching both IPR002117 and GO:0008219

Use at

PREFIX GO: <http://purl.obolibrary.org/obo/GO_>
PREFIX interpro: <http://www.ebi.ac.uk/interpro/entry/>
PREFIX : <http://purl.orthodb.org/>

SELECT
    (count(?gene) as ?count_genes)
    (min(?aa_seq_length) as ?min_aa_length)
    (avg(?aa_seq_length) as ?avg_aa_length)
    (max(?aa_seq_length) as ?max_aa_length)
WHERE {
    ?gene a :Gene; :geneTranslatedLength ?aa_seq_length.
    ?gene :xref [a :Xref; :xrefResource interpro:IPR002117].
    ?gene :xref [a :Xref; :xrefResource GO:0008219].
}

graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v2("?aa_seq_length"):::projected 
  v5("?avg_aa_length")
  v3("?count_genes")
  v1("?gene"):::projected 
  v6("?max_aa_length")
  v4("?min_aa_length")
  a1((" "))
  a2((" "))
  c4([":Xref"]):::iri 
  c6(["interpro:IPR002117"]):::iri 
  c8(["GO:0008219"]):::iri 
  c2([":Gene"]):::iri 
  v1 --"a"-->  c2
  v1 --":geneTranslatedLength"-->  v2
  a1 --"a"-->  c4
  a1 --":xrefResource"-->  c6
  v1 --":xref"-->  a1
  a2 --"a"-->  c4
  a2 --":xrefResource"-->  c8
  v1 --":xref"-->  a2
  bind4[/"count(?gene)"/]
  v1 --o bind4
  bind4 --as--o v3
  bind5[/"min(?aa_seq_length)"/]
  v2 --o bind5
  bind5 --as--o v4
  bind6[/"average(?aa_seq_length)"/]
  v2 --o bind6
  bind6 --as--o v5
  bind7[/"max(?aa_seq_length)"/]
  v2 --o bind7
  bind7 --as--o v6