◀ ▶

155_coiled_coil_regions: Find coiled-coil regions annotated on reviewed human proteins and their extent

PREFIX up: <http://purl.uniprot.org/core/> PREFIX taxon: <http://purl.uniprot.org/taxonomy/> PREFIX faldo: <http://biohackathon.org/resource/faldo#> SELECT ?protein ?begin ?end WHERE { ?protein a up:Protein ; up:organism taxon:9606 ; up:reviewed true ; up:annotation ?annotation . ?annotation a up:Coiled_Coil_Annotation ; up:range ?range . ?range faldo:begin/faldo:position ?begin ; faldo:end/faldo:position ?end . }Use

156_compositionally_biased_regions: Find compositionally-biased (low-complexity) regions annotated on reviewed human proteins, with the kind of bias and its extent

PREFIX up: <http://purl.uniprot.org/core/> PREFIX taxon: <http://purl.uniprot.org/taxonomy/> PREFIX faldo: <http://biohackathon.org/resource/faldo#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?protein ?bias ?begin ?end WHERE { ?protein a up:Protein ; up:organism taxon:9606 ; up:reviewed true ; up:annotation ?annotation . ?annotation a up:Compositional_Bias_Annotation ; up:range ?range . OPTIONAL { ?annotation rdfs:comment ?bias } ?range faldo:begin/faldo:position ?begin ; faldo:end/faldo:position ?end . }Use

157_polymorphisms_reported_for_a_protein: Find polymorphisms reported for proteins, i.e. population sequence variation described as such rather than as a disease-causing natural variant

PREFIX up: <http://purl.uniprot.org/core/> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?protein ?polymorphism WHERE { ?protein a up:Protein ; up:annotation ?annotation . ?annotation a up:Polymorphism_Annotation ; rdfs:comment ?polymorphism . }Use

158_citation_scope_via_citation_statement: Find the citations attached to human insulin (P01308) and, for each one, the scope of what it was cited for (e.g. which disease variant, which sequence region, or which experiment it documents). UniProt records the plain triple up:citation for direct traversal, and separately reifies that same triple as an up:Citation_Statement to attach the citation's scope to the specific citation relationship rather than to the citation itself, since one citation can support several different claims about the same protein

PREFIX up: <http://purl.uniprot.org/core/> PREFIX uniprotkb: <http://purl.uniprot.org/uniprot/> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT DISTINCT ?citation ?scope WHERE { ?statement a up:Citation_Statement ; rdf:subject uniprotkb:P01308 ; rdf:predicate up:citation ; rdf:object ?citation ; up:scope ?scope . }Use

159_excluded_proteomes_and_reason: Find proteomes that have been excluded from UniProtKB and the reason they were excluded (e.g. contaminated, derived from metagenome, unverified source organism)

PREFIX up: <http://purl.uniprot.org/core/> SELECT ?proteome ?exclusionReason WHERE { ?proteome a up:Excluded_Proteome ; up:exclusionReason ?exclusionReason . }Use

160_non_reference_proteomes_and_strain: Find non-reference proteomes and the organism and strain they were sequenced from

PREFIX up: <http://purl.uniprot.org/core/> SELECT ?proteome ?organism ?strain WHERE { ?proteome a up:Non_Reference_Proteome ; up:organism ?organism . OPTIONAL { ?proteome up:strain ?strain } }Use

161_taxa_sharing_a_rank: List all taxa in UniProt's taxonomy that have the taxonomic rank "genus", using the up:Rank resource rather than matching on a rank name string

PREFIX up: <http://purl.uniprot.org/core/> SELECT ?taxon ?scientificName WHERE { ?taxon up:rank up:Taxonomic_Rank_Genus ; up:scientificName ?scientificName . }Use

162_common_taxon_of_a_uniref_cluster: Find the common taxon (the lowest taxon shared by all members) of the UniRef100 cluster that human TP53 (P04637) belongs to, and how many sequences that cluster groups together. up:commonTaxon is precomputed per UniRef cluster from its actual members, not a general-purpose lowest-common-ancestor function over two arbitrary organisms

PREFIX up: <http://purl.uniprot.org/core/> PREFIX uniref: <http://purl.uniprot.org/uniref/> SELECT ?cluster (COUNT(?member) AS ?memberCount) (SAMPLE(?rawCommonTaxonName) AS ?commonTaxonName) WHERE { BIND(uniref:UniRef100_P04637 AS ?cluster) ?cluster up:member ?member ; up:commonTaxon ?commonTaxon . ?commonTaxon up:scientificName ?rawCommonTaxonName . } GROUP BY ?clusterUse

163_canonical_isoform_does_not_need_to_be_dash_1: Find reviewed proteins whose canonical isoform does not end in -1, ordered by the highest isoform number used as the canonical sequence. UniProt's up:sequence points to whichever isoform was chosen as canonical, which is not always isoform -1

PREFIX up: <http://purl.uniprot.org/core/> PREFIX uniprotkb: <http://purl.uniprot.org/uniprot/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> SELECT ?protein (?sequence AS ?canonicalIsoform) ?isoformCount WHERE { GRAPH <http://sparql.uniprot.org/uniprot> { ?protein up:reviewed true . ?protein up:sequence ?sequence . ?sequence a up:Simple_Sequence . OPTIONAL { ?sequence a up:External_Sequence . BIND(true AS ?isExternalSequence) BIND(SUBSTR(STR(?protein), STRLEN(STR(uniprotkb:))) AS ?proteinAc) FILTER(CONTAINS(STR(?sequence), ?proteinAc)) } FILTER(?isExternalSequence || !BOUND(?isExternalSequence)) } BIND(xsd:int(STRAFTER(STR(?sequence), "-")) AS ?isoformCount) } ORDER BY DESC(?isoformCount)Use

164_batch_go_annotations_from_mnemonics: Given a batch of UniProt mnemonic identifiers (Entry Names, e.g. MTMR1_HUMAN) rather than accessions, resolve each to its protein and retrieve its GO annotations in one query. This is the classic biomaRt batch-lookup pattern where a SPARQL VALUES clause replaces getBM(), and unlike biomaRt it naturally returns one row per (protein, GO term) pair instead of dropping or truncating the one-to-many result

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_> SELECT ?mnemonic ?protein ?goTerm ?goLabel WHERE { VALUES ?mnemonic { "MTMR1_HUMAN" "P53_HUMAN" "INS_HUMAN" } ?protein up:mnemonic ?mnemonic ; up:classifiedWith ?goTerm . ?goTerm rdfs:label ?goLabel . FILTER(STRSTARTS(STR(?goTerm), STR(GO:))) }Use

165_reviewed_proteins_for_a_go_term: Given a GO term, find all reviewed human proteins annotated with it. This is the reverse direction of retrieving GO terms for a protein, matching the classic BioMart workflow of building an enrichment-analysis candidate or background gene set from a GO id filter

PREFIX up: <http://purl.uniprot.org/core/> PREFIX taxon: <http://purl.uniprot.org/taxonomy/> PREFIX GO: <http://purl.obolibrary.org/obo/GO_> SELECT ?protein WHERE { # GO:0006915 is "apoptotic process" ?protein a up:Protein ; up:organism taxon:9606 ; up:reviewed true ; up:classifiedWith GO:0006915 . }Use

166_batch_annotate_gene_list: Given a batch list of UniProt accessions, retrieve one row per entry with its recommended protein name, function description, and reviewed status in a single query. This is the classic 'annotate my differential-expression gene list' BioMart workflow (attributes=c(\"name\",\"description\",\"reviewed\") in one getBM() call)

PREFIX up: <http://purl.uniprot.org/core/> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX uniprotkb: <http://purl.uniprot.org/uniprot/> SELECT ?protein ?recommendedName (GROUP_CONCAT(?function; separator='\n') AS ?functions) ?reviewed WHERE { VALUES ?protein { uniprotkb:P04637 uniprotkb:P01308 uniprotkb:Q13613 } ?protein up:reviewed ?reviewed . OPTIONAL { ?protein up:recommendedName ?name . } OPTIONAL { FILTER(!BOUND(?name)) ?protein up:submittedName ?name . } ?name up:fullName ?recommendedName . OPTIONAL { ?protein up:annotation ?functionAnnotation . ?functionAnnotation a up:Function_Annotation ; rdfs:comment ?function . } } GROUP BY ?protein ?recommendedName ?reviewedUse

167_batch_canonical_sequence_retrieval: Given a batch list of UniProt accessions, retrieve the amino acid sequence for each in a single query, matching BioMart's classic bulk "peptide" attribute pull

PREFIX up: <http://purl.uniprot.org/core/> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX uniprotkb: <http://purl.uniprot.org/uniprot/> SELECT ?protein ?sequence WHERE { GRAPH <http://sparql.uniprot.org/uniparc> { VALUES ?protein { uniprotkb:P04637 uniprotkb:P01308 uniprotkb:Q13613 } ?uniparc up:sequenceFor ?protein . ?uniparc rdf:value ?sequence . } }Use

168_batch_ensembl_transcript_cross_references: Given a batch of UniProt accessions, map each to its cross-referenced Ensembl transcript(s) in one query. This relationship is one-to-many (a protein can have several Ensembl transcripts), which is a recurring biomaRt pain point since getBM() is reported to drop or omit rows for it -- with SPARQL, a one-to-many mapping simply produces more result rows

PREFIX up: <http://purl.uniprot.org/core/> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX uniprotkb: <http://purl.uniprot.org/uniprot/> SELECT ?protein ?ensemblTranscript WHERE { VALUES ?protein { uniprotkb:P04637 uniprotkb:P01308 uniprotkb:Q13613 } ?protein rdfs:seeAlso ?ensemblTranscript . ?ensemblTranscript up:database <http://purl.uniprot.org/database/Ensembl> . }Use

169_batch_kegg_cross_references: Given a batch of UniProt accessions, retrieve each one's KEGG gene cross-reference in a single query. Note: if building metabolic pathways we recommend looking at how Rhea is used in UniProt.

PREFIX up: <http://purl.uniprot.org/core/> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX uniprotkb: <http://purl.uniprot.org/uniprot/> SELECT ?protein ?keggGene WHERE { VALUES ?protein { uniprotkb:P04637 uniprotkb:P01308 uniprotkb:Q13613 } ?protein rdfs:seeAlso ?keggGene . ?keggGene up:database <http://purl.uniprot.org/database/KEGG> . }Use

170_batch_ensembl_gene_and_protein_ids: Given a batch of UniProt accessions, resolve each to its Ensembl gene ID and Ensembl protein ID in one query. UniProt's rdfs:seeAlso cross-reference to Ensembl only reaches the transcript level directly; the transcript resource itself links on to the gene it was transcribed from (up:transcribedFrom, an ENSG id) and the protein it was translated to (up:translatedTo, an ENSP id), so no federation with an external Ensembl endpoint is needed to reach gene-level identifiers. Similar pattern appears for the other Ensembl like databases such as EnsemblBacteria

PREFIX up: <http://purl.uniprot.org/core/> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX uniprotkb: <http://purl.uniprot.org/uniprot/> SELECT ?protein ?ensemblTranscript ?ensemblGene ?ensemblProtein WHERE { VALUES ?protein { uniprotkb:P04637 uniprotkb:P01308 uniprotkb:Q13613 } ?protein rdfs:seeAlso ?ensemblTranscript . ?ensemblTranscript up:database <http://purl.uniprot.org/database/Ensembl> ; up:transcribedFrom ?ensemblGene ; up:translatedTo ?ensemblProtein . }Use

171_batch_id_mapping_style_lookup: Given a batch of UniProt accessions, resolve each to its mnemonic entry name, recommended protein name, and organism in one query -- the SPARQL equivalent of the columns (EntryName, ProteinName, Organism) UniProt's own web-based ID mapping/retrieve service returns

PREFIX up: <http://purl.uniprot.org/core/> PREFIX uniprotkb: <http://purl.uniprot.org/uniprot/> SELECT ?protein ?mnemonic ?recommendedName ?organismName WHERE { VALUES ?protein { uniprotkb:P04637 uniprotkb:P01308 uniprotkb:Q13613 } ?protein up:mnemonic ?mnemonic ; up:organism ?organism . ?protein up:reviewed ?reviewed . OPTIONAL { ?protein up:recommendedName ?name . } OPTIONAL { FILTER(!BOUND(?name)) ?protein up:submittedName ?name . } ?name up:fullName ?recommendedName . ?organism up:scientificName ?organismName . }Use

172_reviewed_members_of_a_reference_proteome: For a given taxon (Escherichia coli K12), find its reference proteome and list the reviewed proteins that are members of it. This goes one step further than finding just the proteome resource: a protein's up:proteome value identifies a component (e.g. a chromosome) of a proteome, whose IRI is the proteome's own IRI with a '#' fragment appended. The relation between a component and a proteome is via skos:narrower

PREFIX up: <http://purl.uniprot.org/core/> PREFIX taxon: <http://purl.uniprot.org/taxonomy/> PREFIX skos: <http://www.w3.org/2004/02/skos/core#> SELECT ?protein WHERE { ?proteome a up:Reference_Proteome ; up:organism taxon:83333 . ?protein up:proteome ?component ; up:reviewed true . ?proteome skos:narrower ?component . }Use

173_batch_ec_number_lookup: Given a batch of Enzyme Commission (EC) numbers, list the reviewed UniProt entries classified with each one, in a single query. A protein can be linked to an EC number three different ways: directly (up:enzyme), through a catalytic activity annotation's Rhea-linked enzyme classification (up:catalyticActivity/up:enzymeClass), or as a plain string in a structured protein name (up:ecName) -- the ?mappedVia column states which

PREFIX up: <http://purl.uniprot.org/core/> PREFIX enzyme: <http://purl.uniprot.org/enzyme/> SELECT ?ec ?protein ?mappedVia WHERE { VALUES ?ec { "1.1.1.1" "3.5.1.5" } BIND(IRI(CONCAT(STR(enzyme:), ?ec)) AS ?ecIRI) { ?protein up:enzyme ?ecIRI . BIND("direct enzyme classification (up:enzyme)" AS ?mappedVia) } UNION { ?protein up:annotation/up:catalyticActivity/up:enzymeClass ?ecIRI . BIND("catalytic activity annotation (up:catalyticActivity/up:enzymeClass)" AS ?mappedVia) } UNION { ?protein up:recommendedName|up:alternativeName ?name . ?name up:ecName ?ec . BIND("structured name (up:ecName string)" AS ?mappedVia) } ?protein up:reviewed true . }Use

174_pdb_structures_via_pdbj_federation: Starting from human tumor suppressor TP53 (P04637), federate live with PDBj/RDF Portal's wwPDB RDF to list the extended, versioned wwPDB identifier (e.g. pdb_00002bq0, not the legacy 4-character code) of every PDB entry that has been experimentally solved for it. This goes through PDBj's own pdbo:link_to_uniprot cross-reference rather than UniProt's local rdfs:seeAlso/database cross-reference, so it is a genuine two-endpoint federated query, not a locally-built PDB identifier

PREFIX up: <http://purl.uniprot.org/core/> PREFIX uniprotkb: <http://purl.uniprot.org/uniprot/> PREFIX pdbo: <http://rdf.wwpdb.org/schema/pdbx-with-vrptx-v50.owl#> PREFIX skos: <http://www.w3.org/2004/02/skos/core#> SELECT ?extendedPdbId #?pdb WHERE { BIND(uniprotkb:P04637 AS ?protein) # Compare with cross-reference stored in UniProtKB #?protein rdfs:seeAlso ?pdb . #?pdb up:database <http://purl.uniprot.org/database/wwPDB> SERVICE <https://rdfportal.org/pdb/sparql> { ?structRef pdbo:link_to_uniprot ?protein . ?pdbEntry pdbo:has_struct_refCategory/pdbo:has_struct_ref ?structRef . # Entries carry both their legacy 4-character code and the newer, # extended/versioned wwPDB identifier as skos:altLabel; the extended # one is the only one starting with "pdb_". ?pdbEntry skos:altLabel ?extendedPdbId . FILTER(STRSTARTS(?extendedPdbId, "pdb_")) } }Use

175_uniprot_identity_of_a_pdb_entry_via_pdbj: Starting from PDB entry pdb_00002bq0 (the extended, versioned wwPDB identifier for legacy entry 2BQ0), federate live with PDBj/RDF Portal's wwPDB RDF to retrieve the recommended or submitted protein name and organism of the UniProt entity it was solved from -- the reverse direction of resolving a protein to its PDB structures

PREFIX up: <http://purl.uniprot.org/core/> PREFIX pdbo: <http://rdf.wwpdb.org/schema/pdbx-with-vrptx-v50.owl#> PREFIX skos: <http://www.w3.org/2004/02/skos/core#> SELECT ?protein ?recommendedName ?organismName WHERE { SERVICE <https://rdfportal.org/pdb/sparql> { # The extended, versioned wwPDB identifier is recorded as a # skos:altLabel on the entry, alongside its legacy 4-character code. ?pdbEntry skos:altLabel "pdb_00002bq0" . ?pdbEntry pdbo:has_struct_refCategory/pdbo:has_struct_ref ?structRef . ?structRef pdbo:link_to_uniprot ?protein . } ?protein up:organism ?organism . ?organism up:scientificName ?organismName . OPTIONAL { ?protein up:recommendedName ?name . } OPTIONAL { FILTER(! BOUND(?name)) ?protein up:submittedName ?name . } ?name up:fullName ?recommendedName ; }Use

176_taxon_names_not_unique: Find up:scientificName values that label more than one taxon. The same string can genuinely be reused for unrelated nodes in UniProt's taxonomy: a higher-rank name is sometimes also reused at genus rank (e.g. Acanthocephala, a phylum of thorny-headed worms, is also an insect genus elsewhere in the tree); "environmental samples" is a special case, a placeholder reused thousands of times under many different higher taxa for unclassified/metagenomic entries

PREFIX up: <http://purl.uniprot.org/core/> SELECT ?scientificName (COUNT(?taxon) AS ?taxonCount) (GROUP_CONCAT(SUBSTR(STR(?taxon), 34); separator=",") AS ?taxonIds) WHERE { ?taxon up:scientificName ?scientificName . } GROUP BY ?scientificName HAVING (COUNT(?taxon) > 1) ORDER BY ?scientificNameUse

177_subcellular_location_go_direct_match: Find UniProt's subcellular-location ontology terms (up:Cellular_Component, the http://purl.uniprot.org/locations/ terms behind section G's per-protein annotations) and the Gene Ontology cellular-component term each one exactly matches, via skos:exactMatch

PREFIX up: <http://purl.uniprot.org/core/> PREFIX skos: <http://www.w3.org/2004/02/skos/core#> SELECT ?location ?locationName ?go WHERE { ?location a up:Cellular_Component ; skos:prefLabel ?locationName ; skos:exactMatch ?go . }Use

178_subcellular_location_go_indirect_match: Find Gene Ontology terms that are a looser match to a UniProt subcellular-location term than the direct skos:exactMatch: GO terms reached from the directly-matched term via rdfs:subClassOf+ (is-a), or via a BFO_0000050 (part_of) owl:Restriction on top of it. GO's own part_of axioms are loaded in the UniProt endpoint as an owl:Restriction blank node (a rdfs:subClassOf [ a owl:Restriction ; owl:onProperty obo:BFO_0000050 ; owl:someValuesFrom b ] means a is part_of b), so combining a property path with that restriction pattern is what it takes to follow "is-a-or-part-of" one more step

PREFIX up: <http://purl.uniprot.org/core/> PREFIX skos: <http://www.w3.org/2004/02/skos/core#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX obo: <http://purl.obolibrary.org/obo/> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT DISTINCT ?location ?locationName ?directGo ?relatedGo WHERE { ?location a up:Cellular_Component ; skos:prefLabel ?locationName ; skos:exactMatch ?directGo . { ?relatedGo rdfs:subClassOf+ ?directGo . } UNION { ?relatedGo rdfs:subClassOf [ a owl:Restriction ; owl:onProperty obo:BFO_0000050 ; owl:someValuesFrom ?directGo ] . } }Use

179_subcellular_location_names: List every term in UniProt's subcellular-location ontology (up:Cellular_Component) with its preferred name and description

PREFIX up: <http://purl.uniprot.org/core/> PREFIX skos: <http://www.w3.org/2004/02/skos/core#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?location ?locationName ?description WHERE { ?location a up:Cellular_Component ; skos:prefLabel ?locationName ; rdfs:comment ?description . }Use

180_subcellular_location_ancestors: Find every broader subcellular location reachable from a given one (here, Endosome membrane, locations:100). The location hierarchy mixes rdfs:subClassOf (is-a) and up:partOf (part-of) edges, so both have to be chained together - rdfs:subClassOf*/up:partOf+/rdfs:subClassOf* - to reach the full set of ancestors; using only one of the two misses e.g. Endosome (is-a) or Membrane (part-of, then is-a)

PREFIX up: <http://purl.uniprot.org/core/> PREFIX skos: <http://www.w3.org/2004/02/skos/core#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT DISTINCT ?ancestor ?ancestorName WHERE { GRAPH <http://sparql.uniprot.org/locations> { <http://purl.uniprot.org/locations/100> rdfs:subClassOf*/up:partOf+/rdfs:subClassOf* ?ancestor . ?ancestor skos:prefLabel ?ancestorName . } }Use
◀ ▶