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

Bug in makeCappedVolumeBox() results in zero-column volumn box #34

Closed PeteHaitch closed 6 years ago

PeteHaitch commented 6 years ago
suppressPackageStartupMessages(library(DelayedArray))

# What triggered the error
makeCappedVolumeBox(maxvol = 1000000L, maxdim = c(24587696L, 18L), shape = "scale")
#> [1] 1168752       0

# Some exploring to see when you end up with boxes with zero columns
nc <- seq.int(1, 50)
names(nc) <- nc
sapply(nc, function(i) {
  makeCappedVolumeBox(maxvol = 1000000L, maxdim = c(24587696L, i), shape = "scale")[2]
})
#>  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 
#>  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  1 
#> 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 
#>  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1

Created on 2018-09-27 by the reprex package (v0.2.1)

Session info ``` r devtools::session_info() #> Session info ------------------------------------------------------------- #> setting value #> version R version 3.5.1 (2018-07-02) #> system x86_64, darwin15.6.0 #> ui X11 #> language (EN) #> collate en_AU.UTF-8 #> tz Australia/Melbourne #> date 2018-09-27 #> Packages ----------------------------------------------------------------- #> package * version date source #> backports 1.1.2 2017-12-13 CRAN (R 3.5.0) #> base * 3.5.1 2018-07-05 local #> BiocGenerics * 0.27.1 2018-06-17 Bioconductor #> BiocParallel * 1.15.12 2018-09-13 Bioconductor #> compiler 3.5.1 2018-07-05 local #> datasets * 3.5.1 2018-07-05 local #> DelayedArray * 0.7.41 2018-09-14 Bioconductor #> devtools 1.13.6 2018-06-27 CRAN (R 3.5.0) #> digest 0.6.17 2018-09-12 CRAN (R 3.5.1) #> evaluate 0.11 2018-07-17 CRAN (R 3.5.0) #> graphics * 3.5.1 2018-07-05 local #> grDevices * 3.5.1 2018-07-05 local #> htmltools 0.3.6 2017-04-28 CRAN (R 3.5.0) #> IRanges * 2.15.17 2018-08-24 Bioconductor #> knitr 1.20 2018-02-20 CRAN (R 3.5.0) #> magrittr 1.5 2014-11-22 CRAN (R 3.5.0) #> matrixStats * 0.54.0 2018-07-23 CRAN (R 3.5.1) #> memoise 1.1.0 2017-04-21 CRAN (R 3.5.0) #> methods * 3.5.1 2018-07-05 local #> parallel * 3.5.1 2018-07-05 local #> Rcpp 0.12.18 2018-07-23 CRAN (R 3.5.1) #> rmarkdown 1.10 2018-06-11 CRAN (R 3.5.0) #> rprojroot 1.3-2 2018-01-03 CRAN (R 3.5.0) #> S4Vectors * 0.19.19 2018-07-18 Bioconductor #> stats * 3.5.1 2018-07-05 local #> stats4 * 3.5.1 2018-07-05 local #> stringi 1.2.4 2018-07-20 CRAN (R 3.5.1) #> stringr 1.3.1 2018-05-10 CRAN (R 3.5.0) #> tools 3.5.1 2018-07-05 local #> utils * 3.5.1 2018-07-05 local #> withr 2.1.2 2018-03-15 CRAN (R 3.5.0) #> yaml 2.2.0 2018-07-25 CRAN (R 3.5.1) ```

I initially hit this when running the following:

dim(x)
#> [1] 24587696       18
saveHDF5SummarizedExperiment(x)
#> Start writing assay 1/3 to '/scratch/temp/5531374.1.cegs2.q/Rtmp0WGrOh/test/assays.h5':
#> Error in chunkdim(x) :
#>   The "chunkdim" method for HDF5RealizationSink objects returned an
#>   integer vector with illegal zeros. chunkdim() should always return an
#>   integer vector with nonzero values unless the zero values correspond to
#>   dimensions in 'x' that are also zero. Please contact the author of the
#>   HDF5RealizationSink class (defined in the HDF5Array package) about this
#>   and point him/her to the man page for extract_array() in the
#>   DelayedArray package (?extract_array).
hpages commented 6 years ago

Oops, not good. I'm looking into this...

hpages commented 6 years ago

Fixed in DelayedArray 0.7.45: https://github.com/Bioconductor/DelayedArray/commit/cb8c41bc9616b97399f761853b7ccb39e8e86ffd

Thanks Pete for the report!

PeteHaitch commented 6 years ago

Thanks for the quick fix, Herve!