Skip to content

[Bioc-devel] Warnings from ls() in AnnotationDbi

2 messages · James W. MacDonald, Martin Morgan

#
A poster on the support site reported some warnings issued when running
hyperGTest() from GOstats. I tracked this down to the ls() function from
AnnotationDbi, when it dispatches on AnnDbBimap objects. The method is:

setMethod("ls", signature(name="Bimap"),
    function(name, pos, envir, all.names, pattern){
        if (!missing(pos))
          warning("ignoring 'pos' argument")
        if (!missing(envir))
          warning("ignoring 'envir' argument")
        if (!missing(all.names))
          warning("ignoring 'all.names' argument")
        .ls(name, pos, envir, all.names, pattern)
    }
)

And as noted, everything but 'name' is ignored in .ls().

This seemingly hasn't changed in years. In R-3.1.1 the method appears as
Function: ls (package base)
name="AnnDbBimap"
function (name, pos = -1L, envir = as.environment(pos), all.names = FALSE,
    pattern)
{
    if (!missing(pos))
        warning("ignoring 'pos' argument")
    if (!missing(envir))
        warning("ignoring 'envir' argument")
    if (!missing(all.names))
        warning("ignoring 'all.names' argument")
    .ls(name, pos, envir, all.names, pattern)
}

And now in R-3.2.0, the method appears as
Function: ls (package base)
name="Bimap"
function (name, pos = -1L, envir = as.environment(pos), all.names = FALSE,
    pattern, sorted = TRUE)
{
    .local <- function (name, pos, envir, all.names, pattern)
    {
        if (!missing(pos))
            warning("ignoring 'pos' argument")
        if (!missing(envir))
            warning("ignoring 'envir' argument")
        if (!missing(all.names))
            warning("ignoring 'all.names' argument")
        .ls(name, pos, envir, all.names, pattern)
    }
    .local(name, pos, envir, all.names, pattern)
}

Where everything gets wrapped in a call to .local(). Prior to this, we
never saw the warnings, but now we do:

 z <- ls(annotate:::getAnnMap("BPPARENTS", chip = "GO"))
Warning messages:
1: In .local(name, pos, envir, all.names, pattern) :
  ignoring 'pos' argument
2: In .local(name, pos, envir, all.names, pattern) :
  ignoring 'envir' argument
3: In .local(name, pos, envir, all.names, pattern) :
  ignoring 'all.names' argument

This is going to be a consistent issue going forward, so should all those
warnings be stripped out of the method for ls() in AnnotationDbi?

Best,

Jim
#
On 04/24/2015 09:07 AM, James W. MacDonald wrote:
I changed the signature of the method to match the signature of the generic, so 
the missing-ness of the arguments, and hence warnings, are assessed appropriately.

In devel, I supported sort=..., whereas in release it is ignored.

Thanks for pointing this out.

Martin