Mapping Gene Identifiers

Description

This function implements a generic mapping workflow that enables mapping gene identifers between different types, given a mapper function. The default mapper, biocann_map, enables mapping identifiers within or across platform, as well as across species.

Usage

mapIDs(keys, from, to, method = c("auto", "mauto", "all", "firstN", "1:1", "1:*", 
  "affy"), mapper = biocann_map, verbose = FALSE, ...)

Arguments

keys
character vector of identifiers to map.
method
a specification of the filtering strategy. See idFilter.
mapper
mapper function, responsible to generate the actual mappings between identifiers. See details.
from
specification of the type of identifiers of object. This is only neeeded when the source type cannot be inferred from object itself.
to
specification of the type of identifiers to convert to.
verbose
a logical or integer that sets the vverbosity level.
...
extra arguments to allow extension, which are passed down to the workhorse method convertIDs,character,GeneIdentifierType,GeneIdentifierType. See each method's description for more details.

Details

The mapper function passed in argument mapper is responsible for providing a sequence of map(s) that are sequentially applied, starting with the source gene identifiers in keys. It must at least have the following 4 arguments:

  1. fromsource gene identifier type, which will be passed as a GeneIdentifierType) object.
  2. tosource gene identifier type, which will be passed as a GeneIdentifierType) object.
  3. keysthe query keys to map, which may be used to help generate maps specific to the query, e.g., for generating cross-species mappings. They may also be ignored, if already compiled maps exist, e.g., maps in standard annotation packages, as the returned map do not need to be limited to the query keys.
  4. verbosea logical or integer that toggles verbose messages at different levels.

Examples


# some ENTREZ ids
ez <- as.character(1:1000)

# convert into probe ids for Affymetrix Chip hgu133a
m <- mapIDs(ez, EntrezIdentifier('hgu133a.db'), AnnotationIdentifier('hgu133b.db'), verbose=2)
## # Converting from EntrezId (hgu133a.db) to Annotation (hgu133b.db) ... 
## # Limiting query to EntrezId (hgu133a.db) ... [1000 -> 690 id(s)]
## # Loading map(s) from EntrezId (hgu133a.db) to Annotation (hgu133b.db) [x-platform/x-id] ... OK [1 step(s)]
##  # Mapping from EntrezId (hgu133b.db) to Annotation (hgu133b.db) [43827 entries] ...  [173/690 mapped (1:1-6 = 269)]
## OK [173/1000 mapped (1:1-6 = 269)]

# keep primary affy probes only
m <- mapIDs(ez, EntrezIdentifier('hgu133a.db'), AnnotationIdentifier('hgu133b.db')
                , method='affy', verbose=2)
## # Converting from EntrezId (hgu133a.db) to Annotation (hgu133b.db) ... 
## # Limiting query to EntrezId (hgu133a.db) ... [1000 -> 690 id(s)]
## # Loading map(s) from EntrezId (hgu133a.db) to Annotation (hgu133b.db) [x-platform/x-id] ... OK [1 step(s)]
##  # Mapping from EntrezId (hgu133b.db) to Annotation (hgu133b.db) [43827 entries] ...  [173/690 mapped (1:1-6 = 269)]
##  # Applying filtering strategy 'affy' ... (kept 61 2nd-affy probes)  [173/173 passed (1:1-6 = 269)]
## OK [173/1000 mapped (1:1-6 = 269)]

# same but only keep 1:1 mapping, using a composed filtering strategy
m <- mapIDs(ez, EntrezIdentifier('hgu133a.db'), AnnotationIdentifier('hgu133b.db')
                , method=c('affy', '1:1'), verbose=2)
## # Converting from EntrezId (hgu133a.db) to Annotation (hgu133b.db) ... 
## # Limiting query to EntrezId (hgu133a.db) ... [1000 -> 690 id(s)]
## # Loading map(s) from EntrezId (hgu133a.db) to Annotation (hgu133b.db) [x-platform/x-id] ... OK [1 step(s)]
##  # Mapping from EntrezId (hgu133b.db) to Annotation (hgu133b.db) [43827 entries] ...  [173/690 mapped (1:1-6 = 269)]
##  # Applying filtering strategy 'affy > 1:1' ... (kept 61 2nd-affy probes) (dropped 61 1:2+ maps)  [112/173 passed (1:1)]
## OK [112/1000 mapped (1:1)]