sparql-examples

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

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

20

Find single-copy phyletic profile at all orthologous levels of STRING-anotated well known interacting genes pertinent to mouse gene/s from the OrthoDB orthologous group annotated with GO MF GO:0005164 (tumor necrosis factor receptor binding) and GO BP GO:0045739 (positive regulation of DNA repair)

Use at

PREFIX up: <http://purl.uniprot.org/core/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX GO: <http://purl.obolibrary.org/obo/GO_>
PREFIX : <http://purl.orthodb.org/>
PREFIX ip_highest: <http://string-db.org/rdf/interaction/physical-highest-confidence-cutoff>

SELECT ?gene_m ?gene_m_name ?partner_m ?string_partner_genename ?level ?percent_single_copy
WHERE {
    ?gene_m a :Gene .
    ?gene_m up:organism/a [up:scientificName "Mus musculus"] .
    ?gene_m :name ?gene_m_name .
    ?gene_m :memberOf ?og .
    ?og a :OrthoGroup ;
        :name ?og_description ;
        :ogBuiltAt [up:scientificName "Mammalia"] .
    ?og :xref [a :Xref; :xrefResource GO:0005164], [a :Xref; :xrefResource GO:0045739] .
    ?gene_m :xref [a :Xref; :xrefResource ?xref_m] .
    ?xref_m a :Entrezgene.

    SERVICE <https://sparql.string-db.org/sparql> {
        ?string_gene_m rdfs:seeAlso ?xref_m ;
            ip_highest: ?partner_m .
        ?partner_m rdfs:label ?string_partner_genename ;
            rdfs:comment ?string_partner_description .
    }

    ?gene_m2 a :Gene ;
        up:organism/a [up:scientificName "Mus musculus"] ;
        :name ?string_partner_genename ;
        :memberOf ?og2 .
    ?og2 a :OrthoGroup ;
        :ogBuiltAt/up:scientificName ?level ;
        :ogPercentSingleCopy ?percent_single_copy .
}

graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v1("?gene_m"):::projected 
  v10("?gene_m2")
  v2("?gene_m_name"):::projected 
  v12("?level"):::projected 
  v3("?og")
  v11("?og2")
  v4("?og_description")
  v7("?partner_m"):::projected 
  v13("?percent_single_copy"):::projected 
  v6("?string_gene_m")
  v9("?string_partner_description")
  v8("?string_partner_genename"):::projected 
  v5("?xref_m")
  a2((" "))
  a1((" "))
  a3((" "))
  a4((" "))
  a5((" "))
  a6((" "))
  a8((" "))
  a7((" "))
  a9((" "))
  c4(["Mus musculus"]):::literal 
  c11([":Xref"]):::iri 
  c2([":Gene"]):::iri 
  c8([":OrthoGroup"]):::iri 
  c13(["GO:0005164"]):::iri 
  c9(["Mammalia"]):::literal 
  c14(["GO:0045739"]):::iri 
  c16([":Entrezgene"]):::iri 
  v1 --"a"-->  c2
  a1 --"up:scientificName"-->  c4
  v1 --"up:organism"-->  a2
  a2 --"a"-->  a1
  v1 --":name"-->  v2
  v1 --":memberOf"-->  v3
  v3 --"a"-->  c8
  v3 --":name"-->  v4
  a3 --"up:scientificName"-->  c9
  v3 --":ogBuiltAt"-->  a3
  a4 --"a"-->  c11
  a4 --":xrefResource"-->  c13
  a5 --"a"-->  c11
  a5 --":xrefResource"-->  c14
  v3 --":xref"-->  a4
  v3 --":xref"-->  a5
  a6 --"a"-->  c11
  a6 --":xrefResource"-->  v5
  v1 --":xref"-->  a6
  v5 --"a"-->  c16
  subgraph s1["https://sparql.string-db.org/sparql"]
    style s1 stroke-width:4px;
    v6 --"rdfs:seeAlso"-->  v5
    v6 --http://string-db.org/rdf/interaction/physical-highest-confidence-cutoff-->  v7
    v7 --"rdfs:label"-->  v8
    v7 --"rdfs:comment"-->  v9
  end
  v10 --"a"-->  c2
  a7 --"up:scientificName"-->  c4
  v10 --"up:organism"-->  a8
  a8 --"a"-->  a7
  v10 --":name"-->  v8
  v10 --":memberOf"-->  v11
  v11 --"a"-->  c8
  v11 --":ogBuiltAt"-->  a9
  a9 --"up:scientificName"-->  v12
  v11 --":ogPercentSingleCopy"-->  v13