Bioconductor / HDF5Array

HDF5 backend for DelayedArray objects
https://bioconductor.org/packages/HDF5Array
9 stars 13 forks source link

Error with `read_block()` when using `writeHDF5Array()` #55

Closed frederikziebell closed 1 year ago

frederikziebell commented 1 year ago

The following code

library("HDF5Array")

m <- matrix(runif(364, min=-1), nrow=26,
            dimnames=list(letters, LETTERS[1:14]))

M1 <- writeHDF5Array(m, tempfile(fileext=".h5"), name="M1", chunkdim=c(5, 5))

gives an error

Error in .read_block_OLD(x, viewport, as.sparse = as.sparse) : 
  could not find function ".read_block_OLD"

I guess this has to do with the warning message on package load replacing previous import ‘S4Arrays::read_block’ by ‘DelayedArray::read_block’ when loading ‘HDF5Array’, i.e. that the read_block function is internally run from the DelayedArray instead of the S4Arrays package.

─ Session info ─────────────────────────────────
 setting  value
 version  R version 4.3.0 (2023-04-21)
 os       macOS Ventura 13.4
 system   x86_64, darwin20
 ui       RStudio
 language (EN)
 collate  en_US.UTF-8
 ctype    en_US.UTF-8
 tz       Europe/Berlin
 date     2023-05-22
 rstudio  2023.03.0+386 Cherry Blossom (desktop)
 pandoc   2.19.2 @ /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/ (via rmarkdown)

─ Packages ──────────────────────────────────
 package        * version date (UTC) lib source
 BiocGenerics   * 0.46.0  2023-04-25 [1] Bioconductor
 cli              3.6.1   2023-03-23 [1] CRAN (R 4.3.0)
 crayon           1.5.2   2022-09-29 [1] CRAN (R 4.3.0)
 DelayedArray   * 0.26.2  2023-05-11 [1] Bioconductor
 digest           0.6.31  2022-12-11 [1] CRAN (R 4.3.0)
 evaluate         0.21    2023-05-05 [1] CRAN (R 4.3.0)
 fastmap          1.1.1   2023-02-24 [1] CRAN (R 4.3.0)
 HDF5Array      * 1.28.1  2023-05-02 [1] Bioconductor
 htmltools        0.5.5   2023-03-23 [1] CRAN (R 4.3.0)
 IRanges        * 2.34.0  2023-04-25 [1] Bioconductor
 knitr            1.42    2023-01-25 [1] CRAN (R 4.3.0)
 lattice          0.21-8  2023-04-05 [2] CRAN (R 4.3.0)
 Matrix         * 1.5-4.1 2023-05-18 [2] CRAN (R 4.3.0)
 MatrixGenerics * 1.12.0  2023-04-25 [1] Bioconductor
 matrixStats    * 0.63.0  2022-11-18 [1] CRAN (R 4.3.0)
 rhdf5          * 2.44.0  2023-04-25 [1] Bioconductor
 rhdf5filters     1.12.1  2023-04-30 [1] Bioconductor
 Rhdf5lib         1.22.0  2023-04-25 [1] Bioconductor
 rlang            1.1.1   2023-04-28 [1] CRAN (R 4.3.0)
 rmarkdown        2.21    2023-03-26 [1] CRAN (R 4.3.0)
 rstudioapi       0.14    2022-08-22 [1] CRAN (R 4.3.0)
 S4Arrays       * 1.0.4   2023-05-14 [1] Bioconductor
 S4Vectors      * 0.38.1  2023-05-02 [1] Bioconductor
 sessioninfo      1.2.2   2021-12-06 [1] CRAN (R 4.3.0)
 xfun             0.39    2023-04-20 [1] CRAN (R 4.3.0)
 yaml             2.3.7   2023-01-23 [1] CRAN (R 4.3.0)

 [1] /Users/foo/Library/R/x86_64/4.3/library
 [2] /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library
frederikziebell commented 1 year ago

Update:

I updated to the devel-versions of S4Arrays, SparseArray, DelayedArray, and HDF5Array (in that order), and the issue is gone.

─ Session info ─────────────────────────
 setting  value
 version  R version 4.3.0 (2023-04-21)
 os       macOS Ventura 13.4
 system   x86_64, darwin20
 ui       RStudio
 language (EN)
 collate  en_US.UTF-8
 ctype    en_US.UTF-8
 tz       Europe/Berlin
 date     2023-05-22
 rstudio  2023.03.0+386 Cherry Blossom (desktop)
 pandoc   NA

─ Packages ──────────────────────────
 package        * version date (UTC) lib source
 BiocGenerics   * 0.46.0  2023-04-25 [1] Bioconductor
 cli              3.6.1   2023-03-23 [1] CRAN (R 4.3.0)
 crayon           1.5.2   2022-09-29 [1] CRAN (R 4.3.0)
 DelayedArray   * 0.27.3  2023-05-22 [1] Github (Bioconductor/DelayedArray@dc36ffe)
 HDF5Array      * 1.29.3  2023-05-22 [1] Github (Bioconductor/HDF5Array@41fe4b1)
 IRanges        * 2.34.0  2023-04-25 [1] Bioconductor
 knitr            1.42    2023-01-25 [1] CRAN (R 4.3.0)
 lattice          0.21-8  2023-04-05 [2] CRAN (R 4.3.0)
 Matrix         * 1.5-4.1 2023-05-18 [2] CRAN (R 4.3.0)
 MatrixGenerics * 1.12.0  2023-04-25 [1] Bioconductor
 matrixStats    * 0.63.0  2022-11-18 [1] CRAN (R 4.3.0)
 rhdf5          * 2.44.0  2023-04-25 [1] Bioconductor
 rhdf5filters     1.12.1  2023-04-30 [1] Bioconductor
 Rhdf5lib         1.22.0  2023-04-25 [1] Bioconductor
 S4Arrays       * 1.1.4   2023-05-22 [1] Github (Bioconductor/S4Arrays@91a9dba)
 S4Vectors      * 0.38.1  2023-05-02 [1] Bioconductor
 sessioninfo      1.2.2   2021-12-06 [1] CRAN (R 4.3.0)
 SparseArray    * 1.1.6   2023-05-22 [1] Github (Bioconductor/SparseArray@191979f)
 xfun             0.39    2023-04-20 [1] CRAN (R 4.3.0)
 XVector          0.40.0  2023-04-25 [1] Bioconductor
 zlibbioc         1.46.0  2023-04-25 [1] Bioconductor

 [1] /Users/foo/Library/R/x86_64/4.3/library
 [2] /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library
hpages commented 1 year ago

Hi,

I strongly suspect that the problem lies in the DelayedArray 0.26.2 binaries for Windows and Mac. See https://support.bioconductor.org/p/9152409/#9152412

If you have Xcode you can try to reinstall from source with BiocManager::install("DelayedArray", type="source", force=TRUE). Otherwise the DelayedArray 0.26.3 binary for Intel Mac should become available tomorrow.

Really sorry for the inconvenience.

BTW I highly recommend against installing BioC 3.18 (devel) packages on top of your BioC 3.17 installation. Mixing packages from different Bioconductor releases is likely to cause all kinds of problems that won't necessarily manifest now, but they will eventually cause some damage.

Best, H.

frederikziebell commented 1 year ago

Installing from source solved the problem, thanks!

hpages commented 1 year ago

Thanks for confirming. Closing now.