Hi Michael,
The fact that duplicate keys are not being allowed in OrganismDb objects
is an inconsistency that I will be looking into. That is, if you do the
same thing with orgDb or TranscriptDb objects, duplicates are allowed
and passed along. So I plan to fix this. I have checked in a
preliminary fix to the devel branch.
The NAs on the other hand though have always been dropped from select
methods since it doesn't usually make sense to include them in the
output. I can explore the possibility of doing something with an extra
argument to support a much more strict interpretation of the keys, but
it would have to error out if there are one to many mappings.
Marc
On 06/18/2014 06:03 AM, Michael Lawrence wrote:
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
_______________________________________________
Bioc-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel