[Bioc-devel] NAMESPACE issue, possibly related to AnnotationDbi
J.J.Goeman at lumc.nl
J.J.Goeman at lumc.nl
Fri Dec 4 14:09:23 CET 2009
Dear all,
I ran into a NAMESPACE problem, which I solved (more or less) but which
I still want to share, because I do not completely understand what is
happening.
On Rcmd check, my package vignette gave the error
Error in as.list.default(alias) :
no method for coercing this S4 class to a vector
The culprit was a call of as.list(alias), where alias = hu6800SYMBOL,
inside a function. Similar errors arose using mget on hu6800SYMBOL.
As the vignette ran without errors if I just sourced all my R files, I
concluded it must be a namespace problem. I INSTALLed my package with a
browser() in the right location, and I was able to produce the following
output:
> features(res, alias=hu6800SYMBOL)
Called from: covariates(...)
Browse[1]> class(alias)
[1] "ProbeAnnDbBimap"
attr(,"package")
[1] "AnnotationDbi"
Browse[1]> showMethods("as.list")
Function: as.list (package base)
x="AgiAnnDbMap"
x="AnnDbBimap"
x="ANY"
x="Bimap"
x="EBMTP"
x="FlatBimap"
(inherited from: x="Bimap")
x="GoAnnDbBimap"
x="GOTermsAnnDbBimap"
x="IpiAnnDbMap"
x="logical"
(inherited from: x="ANY")
x="MTP"
x="ProbeAnnDbBimap"
(inherited from: x="AnnDbBimap")
Browse[1]> as.list(alias)
Error in as.list.default(alias) :
no method for coercing this S4 class to a vector
Clearly, AnnotationDbi is attached, but somehow as.list() is not able to
find the method for the ProbeAnnDbBimap object that is inherited from
AnnDbBimap.
As I had already concluded that it was a namespace problem, I tried
adding
importFrom(AnnotationDbi, as.list)
to my NAMESPACE file. That solved the error (or worked around it?), but
I don't really understand why.
I'd be grateful if somebody who knows more about namespaces could
explain this issue to me.
Session info below.
Jelle
R version 2.10.0 (2009-10-26)
i386-pc-mingw32
locale:
[1] LC_COLLATE=English_United Kingdom.1252
[2] LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] annotate_1.24.0 KEGG.db_2.3.5 hu6800.db_2.3.5
[4] org.Hs.eg.db_2.3.6 RSQLite_0.7-3 DBI_0.2-4
[7] AnnotationDbi_1.8.1 vsn_3.14.0 golubEsets_1.4.7
[10] globaltest_5.1.1 Biobase_2.5.8
loaded via a namespace (and not attached):
[1] affy_1.24.2 affyio_1.14.0 grid_2.10.0
[4] lattice_0.17-26 limma_2.19.1 MASS_7.3-4
[7] multtest_2.2.0 preprocessCore_1.7.4 splines_2.10.0
[10] survival_2.35-7 tools_2.10.0 xtable_1.5-6
www.msbi.nl/goeman
More information about the Bioc-devel
mailing list