Bioconductor / DelayedArray

A unified framework for working transparently with on-disk and in-memory array-like datasets
https://bioconductor.org/packages/DelayedArray
24 stars 9 forks source link

type accessor not found, when DelayedArray and Biostrings package are loaded #48

Closed FelixErnst closed 5 years ago

FelixErnst commented 5 years ago

Hi

the type accessor seems to be block, if the Biostrings package is loaded in the same session as DelayedArray. Not loading Biostrings or loading Biostrings before DelayedArray solves the problem.

library(DelayedArray)
library(Biostrings)
a <- array(runif(1500000), dim=c(10000, 30, 5))
A <- DelayedArray(a)
type(A)
#> Error in (function (classes, fdef, mtable) : unable to find an inherited method for function 'type' for signature '"DelayedArray"'
sessionInfo()
#> R version 3.6.0 (2019-04-26)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows 10 x64 (build 18362)
#> 
#> Matrix products: default
#> 
#> locale:
#> [1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252   
#> [3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C                   
#> [5] LC_TIME=German_Germany.1252    
#> 
#> attached base packages:
#> [1] parallel  stats4    stats     graphics  grDevices utils     datasets 
#> [8] methods   base     
#> 
#> other attached packages:
#> [1] Biostrings_2.52.0    XVector_0.24.0       DelayedArray_0.10.0 
#> [4] BiocParallel_1.17.18 IRanges_2.19.10      S4Vectors_0.23.17   
#> [7] BiocGenerics_0.31.4  matrixStats_0.54.0  
#> 
#> loaded via a namespace (and not attached):
#>  [1] Rcpp_1.0.1      lattice_0.20-38 digest_0.6.19   grid_3.6.0     
#>  [5] magrittr_1.5    evaluate_0.14   highr_0.8       zlibbioc_1.30.0
#>  [9] stringi_1.4.3   Matrix_1.2-17   rmarkdown_1.13  tools_3.6.0    
#> [13] stringr_1.4.0   xfun_0.8        yaml_2.2.0      compiler_3.6.0 
#> [17] htmltools_0.3.6 knitr_1.23

Can this behavior be circumvented?

hpages commented 5 years ago

Hi Felix,

Thanks for reporting this issue.

The problem was that both Biostrings and DelayedArray were defining their own type() generic, hence the masking of one generic by the other. So I just added a type() generic in the BiocGenerics package (BiocGenerics 0.31.4) and removed the type() generics from DelayedArray (DelayedArray 0.11.4) and from Biostrings (Biostrings 2.53.1).

With these changes everybody now uses the same generic and all the type() methods are defined on that generic. This addresses the masking problem.

Note that you'll also need to make sure to re-install the HDF5Array package to avoid some weird errors due to some stale method table for the type() generic. I bumped HDF5Array's version only for the sake of triggering its propagation and re-installation on the end-user machines.

If everything goes as expected, you should only need to run BiocManager::install() in about 48h and that will take care of updating BiocGenerics, DelayedArray, HDF5Array, and Biostrings. This is for BioC devel only.

H.

hpages commented 5 years ago

Closing the issue. Feel free to re-open if you still run into problems with this.