Let's say I have a vector of gene IDs where some are NA, and are some are
repeated, and I want to map them to gene symbols, where I get NAs for the
NA IDs or IDs without a symbol. What is the best way to do this?

I tried select() but it gave me a table with unique entries; not very
convenient. It also does not handle NAs. And totally breaks with duplicates
using the GENEID key type (kind of works with ENTREZID):

select(Homo.sapiens, GENEID, "SYMBOL", "GENEID")
Error in `[[<-`(`*tmp*`, name, value = list(GENEID = c("245938", "245939",
:
  269 elements in value to replace 1312 elements

Also tried the venerable mget(GENEID, org.Hs.egSYMBOL, ifnotfound=NA), but
this returns a list and fails with NAs.

What would be nice is something like:

map(Homo.sapiens, GENEID, "SYMBOL", "GENEID", OneToOneOrNone)

where OneToOneOrNone is an assertion that I expect the mappings to be
one-to-one, so it will unlist() or whatever and throw an error if the
assertion fails. It should return NA for anything not found, and for any NA
GENEID. Does something like this already exist?

Michael

        [[alternative HTML version deleted]]

_______________________________________________
Bioc-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel

Reply via email to