SPARQL example query
59: Count all isoforms for a given proteome
PREFIX proteome:<http://purl.uniprot.org/proteomes/> SELECT (COUNT(DISTINCT ?sequence) AS ?allIsoforms) WHERE { ?protein up:reviewed true . ?protein up:organism taxon:9606 . ?protein up:sequence ?sequence . ?protein up:proteome/^skos:narrower proteome:UP000005640 . }Use59: Count all isoforms for a given proteome
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> PREFIX taxon: <http://purl.uniprot.org/taxonomy/> PREFIX up: <http://purl.uniprot.org/core/> PREFIX proteome:<http://purl.uniprot.org/proteomes/> SELECT (COUNT(DISTINCT ?sequence) AS ?allIsoforms) WHERE { ?protein up:reviewed true . ?protein up:organism taxon:9606 . ?protein up:sequence ?sequence . ?protein up:proteome/^skos:narrower proteome:UP000005640 . }Use60: Find Human proteins that catalyze reactions where substrates or product have a Cholestane skeleton
SELECT DISTINCT ?protein ?disease ?rhea ?chebi ?omim WHERE { # Find complete ChEBIs with a Cholestane skeleton, via the Czech Elixir node IDSM Sachem chemical substructure search. SERVICE <https://idsm.elixir-czech.cz/sparql/endpoint/chebi> { ?chebi sachem:substructureSearch [ sachem:query "[C@]12(CCC3CCCC[C@]3(C)[C@@]1([H])CC[C@]1(C)[C@@]([H])([C@@](C)([H])CCCC(C)C)CC[C@@]21[H])[H]" ]. } # Use the fact that UniProt catalytic activities are annotated using Rhea # Mapping the found ChEBIs to Rhea reactions SERVICE <https://sparql.rhea-db.org/sparql>{ ?rhea rh:side/rh:contains/rh:compound/rdfs:subClassOf ?chebi . } # Match the found Rhea reactions with human UniProtKB proteins ?protein up:annotation/up:catalyticActivity/up:catalyzedReaction ?rhea . ?protein up:organism taxon:9606 . # Find only those human entries that have an annotated related disease, and optionaly map these to OMIM ?protein up:annotation/up:disease ?disease . OPTIONAL { ?disease rdfs:seeAlso ?omim . ?omim up:database <http://purl.uniprot.org/database/MIM> } }Use60: Find Human proteins that catalyze reactions where substrates or product have a Cholestane skeleton
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rh: <http://rdf.rhea-db.org/> PREFIX sachem: <http://bioinfo.uochb.cas.cz/rdf/v1.0/sachem#> PREFIX taxon: <http://purl.uniprot.org/taxonomy/> PREFIX up: <http://purl.uniprot.org/core/> SELECT DISTINCT ?protein ?disease ?rhea ?chebi ?omim WHERE { # Find complete ChEBIs with a Cholestane skeleton, via the Czech Elixir node IDSM Sachem chemical substructure search. SERVICE <https://idsm.elixir-czech.cz/sparql/endpoint/chebi> { ?chebi sachem:substructureSearch [ sachem:query "[C@]12(CCC3CCCC[C@]3(C)[C@@]1([H])CC[C@]1(C)[C@@]([H])([C@@](C)([H])CCCC(C)C)CC[C@@]21[H])[H]" ]. } # Use the fact that UniProt catalytic activities are annotated using Rhea # Mapping the found ChEBIs to Rhea reactions SERVICE <https://sparql.rhea-db.org/sparql>{ ?rhea rh:side/rh:contains/rh:compound/rdfs:subClassOf ?chebi . } # Match the found Rhea reactions with human UniProtKB proteins ?protein up:annotation/up:catalyticActivity/up:catalyzedReaction ?rhea . ?protein up:organism taxon:9606 . # Find only those human entries that have an annotated related disease, and optionaly map these to OMIM ?protein up:annotation/up:disease ?disease . OPTIONAL { ?disease rdfs:seeAlso ?omim . ?omim up:database <http://purl.uniprot.org/database/MIM> } }Use61: Select the Gene Protein Reaction sets for Human (Ensembl Gene, Human UniProtKB, Catalyzed Rhea reactions)
SELECT ?ensemblGene ?protein ?rhea WHERE { ?protein up:reviewed true ; up:organism taxon:9606 . ?protein up:annotation ?caa ; rdfs:seeAlso ?ensemblTranscript . ?ensemblTranscript up:database <http://purl.uniprot.org/database/Ensembl> . ?caa up:catalyticActivity ?ca . ?ca up:catalyzedReaction ?rhea . ?ensemblTranscript up:transcribedFrom ?ensemblGene }Use61: Select the Gene Protein Reaction sets for Human (Ensembl Gene, Human UniProtKB, Catalyzed Rhea reactions)
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX taxon: <http://purl.uniprot.org/taxonomy/> PREFIX up: <http://purl.uniprot.org/core/> SELECT ?ensemblGene ?protein ?rhea WHERE { ?protein up:reviewed true ; up:organism taxon:9606 . ?protein up:annotation ?caa ; rdfs:seeAlso ?ensemblTranscript . ?ensemblTranscript up:database <http://purl.uniprot.org/database/Ensembl> . ?caa up:catalyticActivity ?ca . ?ca up:catalyzedReaction ?rhea . ?ensemblTranscript up:transcribedFrom ?ensemblGene }Usediseases_involving_enzymes: Find Diseases that are thought to be related to Enzymes
SELECT ?disease ?diseaseLabel WHERE { ?protein up:enzyme|up:annotation/up:catalyticActivity/up:enzymeClass ?enzyme ; up:annotation ?diseaseAnnotation . ?diseaseAnnotation a up:Disease_Annotation ; up:disease ?disease . ?disease skos:prefLabel ?diseaseLabel . }Usediseases_involving_enzymes: Find Diseases that are thought to be related to Enzymes
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> PREFIX up: <http://purl.uniprot.org/core/> SELECT ?disease ?diseaseLabel WHERE { ?protein up:enzyme|up:annotation/up:catalyticActivity/up:enzymeClass ?enzyme ; up:annotation ?diseaseAnnotation . ?diseaseAnnotation a up:Disease_Annotation ; up:disease ?disease . ?disease skos:prefLabel ?diseaseLabel . }Usediseases_involving_enzymes_located_in_mitochondrion: Find (Human genetic) diseases that are thought to be related to Enzymes, known to be located in the Mitochondrion
SELECT DISTINCT ?disease WHERE { ?protein a up:Protein ; up:organism taxon:9606 ; up:annotation ?disease_annotation , ?subcellularLocation . { ?protein up:enzyme [] . } UNION { ?protein up:annotation/a up:Catalytic_Activity_Annotation . } ?disease_annotation a up:Disease_Annotation ; up:disease ?disease . ?subcellularLocation a up:Subcellular_Location_Annotation ; up:locatedIn ?location . ?location up:cellularComponent ?component . ?component up:partOf* <http://purl.uniprot.org/locations/173> . }Usediseases_involving_enzymes_located_in_mitochondrion: Find (Human genetic) diseases that are thought to be related to Enzymes, known to be located in the Mitochondrion
PREFIX taxon: <http://purl.uniprot.org/taxonomy/> PREFIX up: <http://purl.uniprot.org/core/> SELECT DISTINCT ?disease WHERE { ?protein a up:Protein ; up:organism taxon:9606 ; up:annotation ?disease_annotation , ?subcellularLocation . { ?protein up:enzyme [] . } UNION { ?protein up:annotation/a up:Catalytic_Activity_Annotation . } ?disease_annotation a up:Disease_Annotation ; up:disease ?disease . ?subcellularLocation a up:Subcellular_Location_Annotation ; up:locatedIn ?location . ?location up:cellularComponent ?component . ?component up:partOf* <http://purl.uniprot.org/locations/173> . }Usediseases_related_to_mutation_in_active_site: Find (Human Genetic) diseases, that are related to a natural variant on the active site of an enzyme.
Usediseases_related_to_mutation_in_active_site: Find (Human Genetic) diseases, that are related to a natural variant on the active site of an enzyme.
Usedistinct_extinct_organisms_in_uniprotkb: How many distinct extinct organisms are represented in UniProtKB
SELECT ?taxon (SAMPLE(?name) AS ?anName) (COUNT(DISTINCT ?protein) AS ?entriesPerExtinctTaxon) WHERE { GRAPH<http://sparql.uniprot.org/taxonomy>{ ?taxon a up:Taxon ; up:scientificName ?name . } ?protein up:organism ?taxon ; up:classifiedWith keywords:952 . } GROUP BY ?taxon ORDER BY ?taxonUsedistinct_extinct_organisms_in_uniprotkb: How many distinct extinct organisms are represented in UniProtKB
PREFIX keywords: <http://purl.uniprot.org/keywords/> PREFIX up: <http://purl.uniprot.org/core/> SELECT ?taxon (SAMPLE(?name) AS ?anName) (COUNT(DISTINCT ?protein) AS ?entriesPerExtinctTaxon) WHERE { GRAPH<http://sparql.uniprot.org/taxonomy>{ ?taxon a up:Taxon ; up:scientificName ?name . } ?protein up:organism ?taxon ; up:classifiedWith keywords:952 . } GROUP BY ?taxon ORDER BY ?taxonUsedistinct_rhea_transport_in_reviewed_uniprot: Count number of unique Rhea transport reactions annotated in reviewed UniProtKB entries.
SELECT (COUNT(DISTINCT ?rhea) AS ?distinctRheaTransportInUniProt) WHERE { GRAPH <https://sparql.rhea-db.org/rhea> { ?rhea rh:isTransport true . } ?protein up:annotation ?ann . ?ann up:catalyticActivity ?ca . ?ca up:catalyzedReaction ?rhea . }Usedistinct_rhea_transport_in_reviewed_uniprot: Count number of unique Rhea transport reactions annotated in reviewed UniProtKB entries.
PREFIX rh: <http://rdf.rhea-db.org/> PREFIX up: <http://purl.uniprot.org/core/> SELECT (COUNT(DISTINCT ?rhea) AS ?distinctRheaTransportInUniProt) WHERE { GRAPH <https://sparql.rhea-db.org/rhea> { ?rhea rh:isTransport true . } ?protein up:annotation ?ann . ?ann up:catalyticActivity ?ca . ?ca up:catalyzedReaction ?rhea . }Usedraft_human_metabolome: Generate a draft human metabolome
SELECT ?uniprot ?mnemonic ?rhea ?chebi ?smiles ?inchiKey WHERE { ?uniprot up:annotation/up:catalyticActivity/up:catalyzedReaction ?rhea ; up:organism taxon:9606 ; up:mnemonic ?mnemonic . SERVICE <https://sparql.rhea-db.org/sparql/> { ?rhea rh:side/rh:contains/rh:compound ?compound . ?compound (rh:chebi|(rh:reactivePart/rh:chebi)|(rh:underlyingChebi/rh:chebi)) ?chebi . } ?chebi chebislash:smiles ?smiles ; chebislash:inchikey ?inchiKey . }Usedraft_human_metabolome: Generate a draft human metabolome
PREFIX chebislash: <http://purl.obolibrary.org/obo/chebi/> PREFIX rh: <http://rdf.rhea-db.org/> PREFIX taxon: <http://purl.uniprot.org/taxonomy/> PREFIX up: <http://purl.uniprot.org/core/> SELECT ?uniprot ?mnemonic ?rhea ?chebi ?smiles ?inchiKey WHERE { ?uniprot up:annotation/up:catalyticActivity/up:catalyzedReaction ?rhea ; up:organism taxon:9606 ; up:mnemonic ?mnemonic . SERVICE <https://sparql.rhea-db.org/sparql/> { ?rhea rh:side/rh:contains/rh:compound ?compound . ?compound (rh:chebi|(rh:reactivePart/rh:chebi)|(rh:underlyingChebi/rh:chebi)) ?chebi . } ?chebi chebislash:smiles ?smiles ; chebislash:inchikey ?inchiKey . }Usedrosophila_enzymes_derived_from_at_least_two_mRNAs: Find Drosophila proteins, that depend on more than one transcript (Requires cross-references to Ensembl family of resources).
SELECT ?protein WHERE { ?protein up:organism taxon:7227 ; a up:Protein ; up:reviewed true ; rdfs:seeAlso ?transcript . ?transcript a up:Transcript_Resource . } GROUP BY ?protein HAVING(COUNT(?transcript) >= 2)Usedrosophila_enzymes_derived_from_at_least_two_mRNAs: Find Drosophila proteins, that depend on more than one transcript (Requires cross-references to Ensembl family of resources).
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX taxon: <http://purl.uniprot.org/taxonomy/> PREFIX up: <http://purl.uniprot.org/core/> SELECT ?protein WHERE { ?protein up:organism taxon:7227 ; a up:Protein ; up:reviewed true ; rdfs:seeAlso ?transcript . ?transcript a up:Transcript_Resource . } GROUP BY ?protein HAVING(COUNT(?transcript) >= 2)Usedrosophila_proteins_derived_from_at_least_two_mRNAs: Find Drosophila enzymes, that depend on more than one transcript (Requires cross-references to Ensembl family of resources).
SELECT ?protein WHERE { ?protein up:organism taxon:7227 ; a up:Protein ; up:reviewed true ; rdfs:seeAlso ?transcript . { ?protein up:annotation/a up:Catalytic_Activity_Annotation ; } UNION { ?protein up:enzyme ?enzyme . } ?transcript a up:Transcript_Resource . } GROUP BY ?protein HAVING(COUNT(?transcript) >= 2)Usedrosophila_proteins_derived_from_at_least_two_mRNAs: Find Drosophila enzymes, that depend on more than one transcript (Requires cross-references to Ensembl family of resources).
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX taxon: <http://purl.uniprot.org/taxonomy/> PREFIX up: <http://purl.uniprot.org/core/> SELECT ?protein WHERE { ?protein up:organism taxon:7227 ; a up:Protein ; up:reviewed true ; rdfs:seeAlso ?transcript . { ?protein up:annotation/a up:Catalytic_Activity_Annotation ; } UNION { ?protein up:enzyme ?enzyme . } ?transcript a up:Transcript_Resource . } GROUP BY ?protein HAVING(COUNT(?transcript) >= 2)Useenzyme_with_threonine_as_active_site: Find enzymes with a Tyrosine (Y) as an active site
SELECT ?protein WHERE { ?protein up:annotation ?activeSiteAnnotation . ?activeSiteAnnotation a up:Active_Site_Annotation ; up:range ?range . ?range faldo:begin ?begin . ?begin faldo:position ?beginPosition ; faldo:reference ?sequence . ?sequence rdf:value ?sequenceVal . FILTER(SUBSTR(?sequenceVal, ?beginPosition, 1) = 'Y') }Useenzyme_with_threonine_as_active_site: Find enzymes with a Tyrosine (Y) as an active site
PREFIX faldo: <http://biohackathon.org/resource/faldo#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX up: <http://purl.uniprot.org/core/> SELECT ?protein WHERE { ?protein up:annotation ?activeSiteAnnotation . ?activeSiteAnnotation a up:Active_Site_Annotation ; up:range ?range . ?range faldo:begin ?begin . ?begin faldo:position ?beginPosition ; faldo:reference ?sequence . ?sequence rdf:value ?sequenceVal . FILTER(SUBSTR(?sequenceVal, ?beginPosition, 1) = 'Y') }Useenzymes_interacting_with_molecules_similar_to_dopamine: Look for enzymes catalyzing reactions with molecules similar to dopamine.
SELECT ?protein ?rhea ?chebi WHERE { # Use the smiles of dopamine CHEBI:18243 SERVICE <https://idsm.elixir-czech.cz/sparql/endpoint/chebi>{ ?chebi sachem:similarCompoundSearch [ sachem:query "NCCc1ccc(O)c(O)c1" ] . } GRAPH<https://sparql.rhea-db.org/rhea>{ ?rhea rh:side/rh:contains/rh:compound ?compound . ?compound (rh:chebi|(rh:reactivePart/rh:chebi)|(rh:underlyingChebi/rh:chebi)) ?chebi . } ?protein up:reviewed true ; up:annotation ?caa . ?caa up:catalyticActivity/up:catalyzedReaction ?rhea . }Useenzymes_interacting_with_molecules_similar_to_dopamine: Look for enzymes catalyzing reactions with molecules similar to dopamine.
PREFIX CHEBI: <http://purl.obolibrary.org/obo/CHEBI_> PREFIX rh: <http://rdf.rhea-db.org/> PREFIX sachem: <http://bioinfo.uochb.cas.cz/rdf/v1.0/sachem#> PREFIX up: <http://purl.uniprot.org/core/> SELECT ?protein ?rhea ?chebi WHERE { # Use the smiles of dopamine CHEBI:18243 SERVICE <https://idsm.elixir-czech.cz/sparql/endpoint/chebi>{ ?chebi sachem:similarCompoundSearch [ sachem:query "NCCc1ccc(O)c(O)c1" ] . } GRAPH<https://sparql.rhea-db.org/rhea>{ ?rhea rh:side/rh:contains/rh:compound ?compound . ?compound (rh:chebi|(rh:reactivePart/rh:chebi)|(rh:underlyingChebi/rh:chebi)) ?chebi . } ?protein up:reviewed true ; up:annotation ?caa . ?caa up:catalyticActivity/up:catalyzedReaction ?rhea . }Use