[Bioc-devel] calling the function from the wrong package: union from IRanges and graph

mattia pelizzola mattia.pelizzola at gmail.com
Tue Jul 27 22:46:47 CEST 2010


I am building a package and I have a strange issue that is even
difficult to provide an example for.

I have a method 'Join' in this package that I am working on that uses
the union function from the IRanges library.
Now, on a clean R startup, if I load my library and I use this method
Join I get an error. I think that the union function from the library
graph is called in place of the one from IRanges ..

> Join(gel1, gel2, method='union')
Error in as.vector(x) : no method for coercing this S4 class to a vector
> traceback()
5: as.vector(x)
4: unique(c(as.vector(x), as.vector(y)))
3: union(IR1, IR2)
2: Join(gel1, gel2, method = "union")
1: Join(gel1, gel2, method = "union")

At the same time, if I execute on the console:
> union(IRanges(), IRanges())
IRanges of length 0

it works perfectly.

Finally, if I manually source the code containing my Join method, even
the union function within this method now is working ..
> source('./R/BSmetClasses_GElist.R')
> a=Join(gel1, gel2, method='union')

This is the same code of the library that is installed and running ..
I know that now the method is on my GlobalEnv but I can't understand
how this would change the result.

> union
standardGeneric for "union" defined from package "base"

function (x, y)
<environment: 0x3a99228>
Methods may be defined for arguments: x, y
Use  showMethods("union")  for currently available ones.

> showMethods('union')
Function: union (package base)
x="ANY", y="ANY"
x="ANY", y="GeneSetCollection"
x="CollectionIdType", y="CollectionIdType"
x="CollectionType", y="CollectionType"
x="GeneColorSet", y="GeneColorSet"
x="GeneSetCollection", y="ANY"
x="GeneSet", y="GeneSet"
x="GRanges", y="GRanges"
x="graphBAM", y="graphBAM"
x="graph", y="graph"
x="IRanges", y="IRanges"
x="RangesList", y="RangesList"
x="XStringSet", y="XStringSet"

I am quite confused and sorry that I can't provide any more meaningful example,


> sessionInfo()
R version 2.11.0 (2010-04-22)

 [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=C              LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C

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

other attached packages:
 [1] methylPipe_1.0.0     RMySQL_0.7-4         BSgenome_1.16.1
 [4] Biostrings_2.16.0    GenomicRanges_1.0.1  IRanges_1.6.1
 [7] GOstats_2.14.0       RSQLite_0.9-0        DBI_0.2-5
[10] graph_1.26.0         Category_2.14.0      AnnotationDbi_1.10.1
[13] Biobase_2.8.0        rtracklayer_1.8.1    RCurl_1.4-2
[16] nlme_3.1-96          snow_0.3-3           marray_1.26.0
[19] limma_3.4.0          gplots_2.7.4         caTools_1.10
[22] bitops_1.0-4.1       gdata_2.8.0          gtools_2.6.2

loaded via a namespace (and not attached):
 [1] annotate_1.26.0   genefilter_1.30.0 GO.db_2.4.1       GSEABase_1.10.0
 [5] lattice_0.18-5    RBGL_1.24.0       splines_2.11.0    survival_2.35-8
 [9] tools_2.11.0      XML_3.1-0         xtable_1.5-6

More information about the Bioc-devel mailing list