View source: R/AnnotationFuncs.R
translate | R Documentation |
Function for translating from one annotation to another, eg. from RefSeq to Ensemble. This function takes a vector of annotation values and translates first to the primary annotation in the Biocore Data Team package (ie. entrez gene identifier for org.Bt.eg.db) and then to the desired product, while removing non-translated annotations and optionally reducing the result so there is only a one-to-one relation.
translate(
values,
from,
to = NULL,
reduce = c("all", "first", "last"),
return.list = TRUE,
remove.missing = TRUE,
simplify = FALSE,
...
)
values |
Vector of annotations that needs translation. Coerced to character vector. |
from |
Type of annotation |
to |
Desired goal, eg. |
reduce |
Reducing method, either return all annotations (one-to-many relation)
or the first or last found annotation. The reducing step is applied
after translating to the goal:
|
return.list |
Logical, when |
remove.missing |
Logical, whether to remove non-translated values, defaults |
simplify |
Logical, unlists the result. Defaults to FALSE. Usefull when using |
... |
Additional arguments sent to |
If you want to do some further mapping on the result, you will have to use
either unlist
og lapply
, where the first returns all the end-products
of the first mapping, returning a new list, and the latter produces a list-within-list.
If from
returns GO identifiers (e.g. from = org.Bt.egGO
), then the
returned resultset is more complex and consists of several layers of lists instead of
the usual list of character vectors. If to
has also been specified, the GO IDs
must be extracted (internally) and you have the option of filtering for evidence and category at this point.
See pickGO
.
List; names of elements are values
and the elements are the translated elements,
or NULL
if not translatable with remove.missing = TRUE
.
Requires user to deliver the annotation packages such as org.Bt.egREFSEQ.
Stefan McKinnon Edwards stefan.hoj-edwards@agrsci.dk
pickRefSeq
, pickGO
library(org.Bt.eg.db)
genes <- c(280705, 280706, 100327208)
translate(genes, org.Bt.egSYMBOL)
symbols <- c("SERPINA1","KERA","CD5")
refseq <- translate(symbols, from=org.Bt.egSYMBOL2EG, to=org.Bt.egREFSEQ)
# Pick the proteins:
pickRefSeq(refseq, priorities=c('NP','XP'), reduce='all')
# If you wanted do do some further mapping on the result from
# translate, simply use lapply.
library(GO.db)
GO <- translate(genes, org.Bt.egGO)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.