mget.chain: Lookup keys in a chain of 2 environment or AnnDbBimap objects

Description Usage Arguments Value Note Author(s) Examples

Description

Sometimes you need to chain (or JOIN) a few mapping tables together in order to get the end result. For example, Using the annotation.db packages, if you need to go from GENESYMBOL to GENENAME, you have to go via the ENTREZGENE ID. You would lookup the entrez gene ID for each SYMBOL, using the org.Hs.egSYMBOL2EG AnnDbBimap, which can sometimes return NA's. Then take those Entrez Gene ID's and look them up in the org.Hs.egGENENAME table. This function does the hard work for you.

Usage

1
  mget.chain(keys, a, b, debug = FALSE)

Arguments

keys

a vector of search keys which must be found in a

a

an environment, or AnnDbBimap object

b

an environment, or AnnDbBimap object

debug

logical: if TRUE, then a 3 column data.frame is returned, containing the keys, intermediate result, then final value. If FALSE, the default, return a named vector of values

Value

For the N search keys, either return a named vector, of length N of mapped values, or a 3 column, N row data.frame, if debug=TRUE. if there is no mapped value for a key, NA is returned.

Note

this returns only the first match for each key, along each of the mapping steps, where “first” is defined in mget2.

Author(s)

Mark Cowley, 2011-09-21

Examples

1
2
3
4
5
if( require(org.Hs.eg.db) ) {
  geneids <- c("TP53", "INS", "KRAS")
  mget.chain(geneids, org.Hs.egSYMBOL2EG, org.Hs.egGENENAME, FALSE)
  mget.chain(geneids, org.Hs.egSYMBOL2EG, org.Hs.egGENENAME, TRUE)
}

drmjc/macsR documentation built on May 15, 2019, 2:23 p.m.