idMap {EnrichmentBrowser} | R Documentation |
Functionality to map between common gene ID types such as ENSEMBL and ENTREZ for gene expression datasets, gene sets, and gene regulatory networks.
idMap( obj, org = NA, from = "ENSEMBL", to = "ENTREZID", multi.to = "first", multi.from = "first" ) idTypes(org)
obj |
The object for which gene IDs should be mapped. Supported options include
|
org |
Character. Organism in KEGG three letter code, e.g. ‘hsa’ for ‘Homo sapiens’. See references. |
from |
Character. Gene ID type from which should be mapped. Corresponds
to the gene ID type of argument |
to |
Character. Gene ID type to which should be mapped. Corresponds to
the gene ID type the argument |
multi.to |
How to resolve 1:many mappings, i.e. multiple to.IDs for a
single from.ID? This is passed on to the |
multi.from |
How to resolve many:1 mappings, i.e. multiple from.IDs
mapping to the same to.ID? Only applicable if
Note that a user-defined function can also be supplied for custom behaviors.
This will be applied for each case where there are multiple from.IDs for a
single to.ID, and accordingly takes the arguments |
The function 'idTypes' lists the valid values which the arguments 'from' and 'to' can take. This corresponds to the names of the available gene ID types for the mapping.
idTypes: character vector listing the available gene ID types for the mapping;
idMap: An object of the same class as the input argument obj
, i.e.
a SummarizedExperiment
if provided an expression dataset,
a list of character vectors or a GeneSetCollection
if
provided gene sets, and a character matrix if provided a gene regulatory network.
Ludwig Geistlinger <Ludwig.Geistlinger@sph.cuny.edu>
KEGG Organism code http://www.genome.jp/kegg/catalog/org_list.html
SummarizedExperiment
, mapIds
,
keytypes
# (1) ID mapping for gene expression datasets # create an expression dataset with 3 genes and 3 samples se <- makeExampleData("SE", nfeat = 3, nsmpl = 3) names(se) <- paste0("ENSG00000000", c("003", "005", "419")) idMap(se, org = "hsa") # user-defined mapping rowData(se)$MYID <- c("g1", "g1", "g2") idMap(se, to = "MYID") # data-driven resolving of many:1 mappings ## e.g. select from.ID with lowest p-value pcol <- configEBrowser("PVAL.COL") rowData(se)[[pcol]] <- c(0.001, 0.32, 0.15) idMap(se, to = "MYID", multi.from = "minp") ## ... or using a customized function maxScore <- function(ids, se) { scores <- rowData(se)[ids, "SCORE"] ind <- which.max(scores) return(ids[ind]) } rowData(se)$SCORE <- c(125.7, 33.4, 58.6) idMap(se, to = "MYID", multi.from = maxScore) # (2) ID mapping for gene sets # create two gene sets containing 3 genes each s2 <- paste0("ENSG00000", c("012048", "139618", "141510")) gs <- list(s1 = names(se), s2 = s2) idMap(gs, org = "hsa", from = "ENSEMBL", to = "SYMBOL") # (3) ID mapping for gene regulatory networks grn <- cbind(FROM = gs$s1, TO = gs$s2, TYPE = rep("+", 3)) idMap(grn, org = "hsa", from = "ENSEMBL", to = "ENTREZID")