On 04/24/2015 09:07 AM, James W. MacDonald wrote:
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

showMethods(ls, class = "AnnDbBimap", includeDefs = T)
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

showMethods(ls, class = "Bimap", includeDefs = TRUE)
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?

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


Best,

Jim







--
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793

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

Reply via email to