Hi,

I get strange (incorrect?) output from AnnotationDbi::mget when using it on
a subset bimap object with argument ifnotfound=NA.
Keys that exist in the original map are incorrectly returned as found, keys
that don't are correctly returned as NA (See code and output below).

Any idea? Can anybody reproduce this?
Thank you

Renaud

##########################
## code
##########################

library(org.Hs.eg.db)
map <- org.Hs.egUNIGENE
# get some mappedkeys
k <- c(mappedkeys(map)[1:3], 'notakey')
# subset the map using only part of the keys
map2 <- map[k[1:2]]
keys(map2)
# try to get all keys from the subset map:
AnnotationDbi::mget(k, map2) # OK error on third key
AnnotationDbi::mget(k, map2, ifnotfound=NA) # Not OK: the third element
should be NA, right?
sessionInfo()


##############################
####
## output
##################################

R version 2.15.3 (2013-03-01) -- "Security Blanket"
Copyright (C) 2013 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i686-pc-linux-gnu (32-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(org.Hs.eg.db)
Loading required package: AnnotationDbi
Loading required package: BiocGenerics

Attaching package: ‘BiocGenerics’

The following object(s) are masked from ‘package:stats’:

    xtabs

The following object(s) are masked from ‘package:base’:

    anyDuplicated, cbind, colnames, duplicated, eval, Filter, Find,
    get, intersect, lapply, Map, mapply, mget, order, paste, pmax,
    pmax.int, pmin, pmin.int, Position, rbind, Reduce, rep.int,
    rownames, sapply, setdiff, table, tapply, union, unique

Loading required package: Biobase
Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

Loading required package: DBI

> map <- org.Hs.egUNIGENE
> # get some mappedkeys
> k <- c(mappedkeys(map)[1:3], 'notakey')
> # subset the map using only part of the keys
> map2 <- map[k[1:2]]
> keys(map2)
[1] "1"  "10"
> # try to get all keys from the subset map:
> AnnotationDbi::mget(k, map2) # OK error on third key
Error in .checkKeys(value, Lkeys(x), x@ifnotfound) :
  value for "100" not found
> AnnotationDbi::mget(k, map2, ifnotfound=NA) # Not OK: the third element
should be NA, right?
$`1`
[1] "Hs.529161" "Hs.709582"

$`10`
[1] "Hs.2"

$`100`
[1] "Hs.654536"

$notakey
[1] NA

> sessionInfo()
R version 2.15.3 (2013-03-01)
Platform: i686-pc-linux-gnu (32-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=C                 LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] org.Hs.eg.db_2.8.0   RSQLite_0.11.2       DBI_0.2-5
[4] AnnotationDbi_1.20.6 Biobase_2.18.0       BiocGenerics_0.4.0

loaded via a namespace (and not attached):
[1] IRanges_1.16.6  parallel_2.15.3 stats4_2.15.3
>

	[[alternative HTML version deleted]]

