Last active
July 20, 2023 14:55
-
-
Save maelle/9fb6a9c6676ccec796fff9e00ab82979 to your computer and use it in GitHub Desktop.
glitter + UniProt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pak::pak("lvaudor/glitter") | |
library("glitter") | |
# Select all taxa from the UniProt taxonomy | |
# doesn't work yet https://github.com/lvaudor/glitter/issues/144 | |
# Select all bacterial taxa and their scientific name from the UniProt taxonomy | |
# rdfs is a common prefix so built-in | |
spq_init() %>% | |
spq_prefix(prefixes = c( | |
up = "http://purl.uniprot.org/core/", | |
taxon = "http://purl.uniprot.org/taxonomy/" | |
)) %>% | |
spq_add("?taxon a up:Taxon") %>% | |
spq_mutate(name = up::scientificName(taxon)) %>% | |
spq_add("?taxon rdfs:subClassOf taxon:2") %>% | |
spq_head(10) %>% | |
spq_perform(endpoint = "https://sparql.uniprot.org/sparql") | |
# Select all UniProt entries that were integrated on the 30th of November 2010 | |
spq_init() %>% | |
spq_prefix(prefixes = c(up = "http://purl.uniprot.org/core/")) %>% | |
spq_add("?protein a up:Protein") %>% | |
spq_add("?protein up:created '2010-11-30'^^xsd:date") %>% | |
spq_head(10) %>% | |
spq_perform(endpoint = "https://sparql.uniprot.org/sparql") | |
# Select reviewed UniProt entries (Swiss-Prot), and their recommended protein name, that have a preferred gene name that contains the text 'DNA' | |
spq_init() %>% | |
spq_prefix(prefixes = c(up = "http://purl.uniprot.org/core/")) %>% | |
spq_add("?protein a up:Protein") %>% | |
spq_add("?protein up:reviewed true") %>% | |
spq_add("?protein up:recommendedName ?recommended") %>% | |
spq_add("?recommended up:fullName ?name") %>% | |
spq_add("?protein up:encodedBy ?gene") %>% | |
spq_add("?gene skos:prefLabel ?text") %>% | |
spq_filter(str_detect(text, 'DNA')) %>% | |
spq_head(10) %>% | |
spq_perform(endpoint = "https://sparql.uniprot.org/sparql") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Results!
Created on 2023-07-20 with reprex v2.0.2