Contents

1 Installation

if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")
BiocManager::install("UniProt.ws")

1.1 Configuring uniport.ws

The UniProt.ws package provides a select interface to the UniProt web service.

suppressPackageStartupMessages({
    library(UniProt.ws)
})
up <- UniProt.ws(taxId=9606)

If you already know about the select interface, you can immediately learn about the various methods for this object by just looking it’s the help page.

help("UniProt.ws")

When you load the UniProt.ws package, it creates a UniProt.ws object. If you look at the object you will see some helpful information about it.

up
## UniProt.ws interface object:
## Taxonomy ID: 9606
## Species name: Homo sapiens (Human)
## List species with 'availableUniprotSpecies()'

By default, you can see that the UniProt.ws object is set to retrieve records from Homo sapiens. But you can change that of course. In order to change it, you first need to look up the appropriate taxonomy ID for the species that you are interested in. Uniprot provides support for over 20 thousand species, so there are a few to choose from! In order to make this easier, we have provided the helper function availableUniprotSpecies which will list all the supported species along with their taxonomy ids. When you call the availableUniprotSpecies function, it’s recommended that you make use of the pattern argument to limit your queries like this:

availableUniprotSpecies(pattern="musculus")
##       kingdom Taxon Node                     Official (scientific) name
## ANTMS       E     520121                            Anthocoris musculus
## ANTMU       E     208057                           Anthoscopus musculus
## APOMU       E     238007                                Apomys musculus
## BAIMU       E     213557                               Baiomys musculus
## BALMU       E       9771                          Balaenoptera musculus
## BLEMU       E     197864                           Blepharisma musculus
## MOUSE       E      10090                                   Mus musculus
## MUSMB       E      35531                        Mus musculus bactrianus
## MUSMC       E      10091                         Mus musculus castaneus
## MUSMM       E      57486                        Mus musculus molossinus
## MUSMS       E     186842                     Mus musculus x Mus spretus
## MUSMX       E     477816 Mus musculus musculus x Mus musculus castaneus
## POVM1       V    1891730                    Mus musculus polyomavirus 1

Once you have learned the taxonomy ID for the species of interest, you can then change the taxonomy id for the UniProt.ws object using taxId setter or by calling the constructor for UniProt.ws

mouseUp <- UniProt.ws(10090)
mouseUp
## UniProt.ws interface object:
## Taxonomy ID: 10090
## Species name: Mus musculus (Mouse)
## List species with 'availableUniprotSpecies()'

As you can see the species is different for the mouseUp new object.

1.2 Using UniProt.ws

Once you are safisfied that you have an uniport.ws that is using the appropriate organsims, you can make use of the standard set of methods in a select interface. Specifically: columns, keytypes, keys and select.

You will probably notice that there are a large number of columns that can be retrieved.

head(keytypes(up))
## [1] "Allergome"     "ArachnoServer" "Araport"       "BioCyc"       
## [5] "BioGRID"       "BioMuta"

And most (but not all) of these fields can also be used as keytypes.

head(columns(up))
## [1] "absorption"              "accession"              
## [3] "annotation_score"        "cc_activity_regulation" 
## [5] "cc_allergen"             "cc_alternative_products"

If necessary you can also look up the keys of a given type. But please be warned that the web service is slow at this particular kind of lookup. So if you really want to do this kind of operation you are probably going to want to save the result to your R session.

egs <- keys(up, "GeneID")

Finally, you can loop up whatever combinations of columns, keytypes and keys that you need when using select.

Note. ‘ENTREZ_GENE’ is now ‘GeneID’

keys <- c("1","2")
columns <- c("xref_pdb", "xref_hgnc", "sequence")
kt <- "GeneID"
res <- select(up, keys, columns, kt)
res
##   From  Entry                                                               PDB
## 1    1 P04217                                                              <NA>
## 2    1 V9HWD8                                                              <NA>
## 3    2 P01023 1BV8;2P9R;6TAV;7O7L;7O7M;7O7N;7O7O;7O7P;7O7Q;7O7R;7O7S;7VON;7VOO;
##      HGNC
## 1 HGNC:5;
## 2    <NA>
## 3 HGNC:7;
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             Sequence
## 1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    MSMLVVFLLLWGVTWGPVTEAAIFYETQPSLWAESESLLKPLANVTLTCQAHLETPDFQLFKNGVAQEPVHLDSPAIKHQFLLTGDTQGRYRCRSGLSTGWTQLSKLLELTGPKSLPAPWLSMAPVSWITPGLKTTAVCRGVLRGVTFLLRREGDHEFLEVPEAQEDVEATFPVHQPGNYSCSYRTDGEGALSEPSATVTIEELAAPPPPVLMHHGESSQVLHPGNKVTLTCVAPLSGVDFQLRRGEKELLVPRSSTSPDRIFFHLNAVALGDGGHYTCRYRLHDNQNGWSGDSAPVELILSDETLPAPEFSPEPESGRALRLRCLAPLEGARFALVREDRGGRRVHRFQSPAGTEALFELHNISVADSANYSCVYVDLKPPFGGSAPSERLELHVDGPPPRPQLRATWSGAVLAGRDAVLRCEGPIPDVTFELLREGETKAVKTVRTPGAAANLELIFVGPQHAGNYRCRYRSWVPHTFESELSDPVELLVAES
## 2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    MSMLVVFLLLWGVTWGPVTEAAIFYETQPSLWAESESLLKPLANVTLTCQAHLETPDFQLFKNGVAQEPVHLDSPAIKHQFLLTGDTQGRYRCRSGLSTGWTQLSKLLELTGPKSLPAPWLSMAPVSWITPGLKTTAVCRGVLRGVTFLLRREGDHEFLEVPEAQEDVEATFPVHQPGNYSCSYRTDGEGALSEPSATVTIEELAAPPPPVLMHHGESSQVLHPGNKVTLTCVAPLSGVDFQLRRGEKELLVPRSSTSPDRIFFHLNAVALGDGGHYTCRYRLHDNQNGWSGDSAPVELILSDETLPAPEFSPEPESGRALRLRCLAPLEGARFALVREDRGGRRVHRFQSPAGTEALFELHNISVADSANYSCVYVDLKPPFGGSAPSERLELHVDGPPPRPQLRATWSGAVLAGRDAVLRCEGPIPDVTFELLREGETKAVKTVRTPGAAANLELIFVGPQHAGNYRCRYRSWVPHTFESELSDPVELLVAES
## 3 MGKNKLLHPSLVLLLLVLLPTDASVSGKPQYMVLVPSLLHTETTEKGCVLLSYLNETVTVSASLESVRGNRSLFTDLEAENDVLHCVAFAVPKSSSNEEVMFLTVQVKGPTQEFKKRTTVMVKNEDSLVFVQTDKSIYKPGQTVKFRVVSMDENFHPLNELIPLVYIQDPKGNRIAQWQSFQLEGGLKQFSFPLSSEPFQGSYKVVVQKKSGGRTEHPFTVEEFVLPKFEVQVTVPKIITILEEEMNVSVC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EEFPFALGVQTLPQTCDEPKAHTSFQISLSVSYTGSRSASNMAIVDVKMVSGFIPLKPTVKMLERSNHVSRTEVSSNHVLIYLDKVSNQTLSLFFTVLQDVPVRDLKPAIVKVYDYYETDEFAIAEYNAPCSKDLGNA

1.3 sessionInfo()

sessionInfo()
## R version 4.3.1 (2023-06-16)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 22.04.2 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.17-bioc/R/lib/libRblas.so 
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_GB              LC_COLLATE=C              
##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
## 
## time zone: America/New_York
## tzcode source: system (glibc)
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
## [1] UniProt.ws_2.40.1   RSQLite_2.3.1       BiocGenerics_0.46.0
## [4] BiocStyle_2.28.0   
## 
## loaded via a namespace (and not attached):
##  [1] KEGGREST_1.40.0         xfun_0.39               bslib_0.5.0            
##  [4] Biobase_2.60.0          rjsoncons_1.0.0         vctrs_0.6.3            
##  [7] tools_4.3.1             bitops_1.0-7            generics_0.1.3         
## [10] stats4_4.3.1            curl_5.0.1              tibble_3.2.1           
## [13] fansi_1.0.4             AnnotationDbi_1.62.1    blob_1.2.4             
## [16] pkgconfig_2.0.3         BiocBaseUtils_1.2.0     dbplyr_2.3.2           
## [19] S4Vectors_0.38.1        lifecycle_1.0.3         GenomeInfoDbData_1.2.10
## [22] compiler_4.3.1          Biostrings_2.68.1       progress_1.2.2         
## [25] GenomeInfoDb_1.36.1     htmltools_0.5.5         sass_0.4.6             
## [28] RCurl_1.98-1.12         yaml_2.3.7              pillar_1.9.0           
## [31] crayon_1.5.2            jquerylib_0.1.4         cachem_1.0.8           
## [34] tidyselect_1.2.0        digest_0.6.32           purrr_1.0.1            
## [37] dplyr_1.1.2             bookdown_0.34           fastmap_1.1.1          
## [40] cli_3.6.1               magrittr_2.0.3          utf8_1.2.3             
## [43] httpcache_1.2.0         withr_2.5.0             prettyunits_1.1.1      
## [46] filelock_1.0.2          bit64_4.0.5             rmarkdown_2.22         
## [49] XVector_0.40.0          httr_1.4.6              bit_4.0.5              
## [52] png_0.1-8               hms_1.1.3               memoise_2.0.1          
## [55] evaluate_0.21           knitr_1.43              IRanges_2.34.1         
## [58] BiocFileCache_2.8.0     rlang_1.1.1             glue_1.6.2             
## [61] DBI_1.1.3               BiocManager_1.30.21     jsonlite_1.8.5         
## [64] R6_2.5.1                zlibbioc_1.46.0