[BioC] GOHyperGResult in a data.frame, possible NAMESPACE problem?

Seth Falcon sfalcon at fhcrc.org
Mon Jan 11 21:10:30 CET 2010

Hi Robert,

This sort of post might have a better home on the bioc-devel list, but 
since we've started here, some comments below...

On 1/11/10 11:05 AM, Robert Castelo wrote:
> ## call the problematic function
> report<- GOreport(goHypGcond, "org.Hs.eg.db", NULL)
> Error in do.call("expand.grid", dimnames(x)) :
>    second argument must be a list
>> traceback()
> 9: stop("second argument must be a list")
> 8: do.call("expand.grid", dimnames(x))
> 7: data.frame(do.call("expand.grid", dimnames(x)), Freq = c(x),
>         row.names = row.names)
> 6: eval(expr, envir, enclos)
> 5: eval(ex)
> 4: as.data.frame.table(x[[i]], optional = TRUE, stringsAsFactors =
> stringsAsFactors)
> 3: as.data.frame(x[[i]], optional = TRUE, stringsAsFactors =
> stringsAsFactors)
> 2: data.frame(summary(goHypGresult), GeneSyms = reportGeneSyms,
>         Genes = reportGenes)
> 1: GOreport(goHypGcond, "org.Hs.eg.db", NULL)
> so there is something wrong with the instruction that builds the
> data.frame at the very end of the function.
> however, if i paste the function on the R shell and i call it again
> works smoothly:

Yes, that sounds like a name space sort of issue.

> this is really puzzling for me and i suspect that i'm confronted with
> some general problem regarding namespaces or so, thus these are the
> contents of the NAMESPACE file from this package myPkg containing the
> GOreport function:
> exportPattern("^[[:alpha:]]+")
> importFrom(annotate, getAnnMap)
> importFrom(AnnotationDbi, mget)
> importFrom(IRanges, unique)
> importMethodsFrom(GOstats)

I would try:


You need to import the classes as well as the methods.  You could try 
declaring just those that you use, but I would try the above catch-all 

> and these are the contents of the DESCRIPTION file
> Package: myPkg
> Type: Package
> Title: What the package does (short line)
> Version: 1.0
> Date: 2010-01-11
> Author: Who wrote it
> Description: More about what it does (maybe more than one line)
> Depends: methods, annotate, Biobase (>= 2.4.1), AnnotationDbi, GOstats,
> IRanges
> Imports: methods, annotate, Biobase (>= 2.4.1), AnnotationDbi, GOstats,
> IRanges
> Maintainer: Who to complain to<yourfault at somewhere.net>
> License: What license is it under?
> i guess this is difficult to reproduce since if you simply paste the
> function is going to work for you and the problem arises only within the
> context of a package, but any hint on the possible reason related to the
> namespace or whatever else you think will be highly appreciated.

If you are able to post a .tar.gz of your source package to a public 
URL, we could take a closer look.

> sessionInfo()
> R version 2.9.1 (2009-06-26)
> x86_64-unknown-linux-gnu

Especially since you are developing a package of your own, I would 
recommend upgrading to the latest R and BioC releases.  You might also 
consider using R-devel and Bioc-devel versions to make sure that what 
you develope remains compatible as the project(s) evolve.

+ seth

Seth Falcon
Bioconductor Core Team | FHCRC

More information about the Bioconductor mailing list