sparql-examples

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

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

11

The percentage of proteins in Drosophila melanogaster that has at least one paralogous sequence (protein).

Use at

PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX orth: <http://purl.org/net/orth#>
PREFIX up: <http://purl.uniprot.org/core/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT (((xsd:float(?num_paralogy)*100)/xsd:float(?total)) as ?result)
WHERE {
    {
        SELECT (count(distinct ?PROTEIN) as ?num_paralogy )
        WHERE {
            ?cluster a orth:ParalogsCluster.
            ?cluster orth:hasHomologousMember ?node1.
            ?cluster orth:hasHomologousMember ?node2.
            ?node2 orth:hasHomologousMember* ?PROTEIN.
            ?node1 orth:hasHomologousMember* ?IS_PARALOGOUS_TO_PROTEIN.
            ?PROTEIN a orth:Protein.
            ?PROTEIN orth:organism/obo:RO_0002162/up:scientificName ?species.
            ?IS_PARALOGOUS_TO_PROTEIN a orth:Protein.
            ?IS_PARALOGOUS_TO_PROTEIN orth:organism/obo:RO_0002162/up:scientificName ?species .
            values(?species ){( 'Drosophila melanogaster' )}
            filter(?node1 != ?node2)
        }
    }
    {
        SELECT (count(distinct ?protein_total) as ?total)
            WHERE {
               ?protein_total a orth:Protein .
               ?protein_total orth:organism/obo:RO_0002162/up:scientificName ?species .
               values(?species ){( 'Drosophila melanogaster' )}
            }
    }
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v5("?IS_PARALOGOUS_TO_PROTEIN")
  v4("?PROTEIN")
  v3("?cluster")
  v1("?node1")
  v2("?node2")
  v7("?num_paralogy"):::projected 
  v8("?protein_total")
  v10("?result")
  v9("?species")
  v9("?total"):::projected 
  a1((" "))
  a2((" "))
  a3((" "))
  a4((" "))
  a5((" "))
  a6((" "))
  c4(["orth:Protein"]):::iri 
  c2(["orth:ParalogsCluster"]):::iri 
  f0[["?node1 != ?node2"]]
  f0 --> v1
  f0 --> v2
  v3 --"a"-->  c2
  v3 --"orth:hasHomologousMember"-->  v1
  v3 --"orth:hasHomologousMember"-->  v2
  v2 --"orth:hasHomologousMember"-->  v4
  v1 --"orth:hasHomologousMember"-->  v5
  v4 --"a"-->  c4
  v4 --"orth:organism"-->  a1
  a1 --"obo:RO_0002162"-->  a2
  a2 --"up:scientificName"-->  v9
  v5 --"a"-->  c4
  v5 --"orth:organism"-->  a3
  a3 --"obo:RO_0002162"-->  a4
  a4 --"up:scientificName"-->  v9
  bind1[/VALUES ?species/]
  bind1-->v9
  bind10(["Drosophila melanogaster"])
  bind10 --> bind1
  bind3[/"count(?PROTEIN)"/]
  v4 --o bind3
  bind3 --as--o v7
  v8 --"a"-->  c4
  v8 --"orth:organism"-->  a5
  a5 --"obo:RO_0002162"-->  a6
  a6 --"up:scientificName"-->  v9
  bind4[/VALUES ?species/]
  bind4-->v9
  bind40(["Drosophila melanogaster"])
  bind40 --> bind4
  bind6[/"count(?protein_total)"/]
  v8 --o bind6
  bind6 --as--o v9
  bind7[/"http://www.w3.org/2001/XMLSchema#float(?num_paralogy) * '100^^xsd:integer' / http://www.w3.org/2001/XMLSchema#float(?total)"/]
  v7 --o bind7
  v9 --o bind7
  bind7 --as--o v10