library(BiocStyle)
if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager") BiocManager::install("UniProt.ws")
uniport.ws
The r Biocpkg("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 r Biocpkg("UniProt.ws")
package, it creates a
UniProt.ws
object. If you look at the object you will see
some helpful information about it.
up
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")
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
As you can see the species is different for the
mouseUp
new object.
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))
And most (but not all) of these fields can also be used as keytypes.
head(columns(up))
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
sessionInfo()
sessionInfo()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.