[BioC] rhdf5 write/read inconsistency

Julian Gehring julian.gehring at embl.de
Thu Nov 7 12:07:19 CET 2013


Hi Brad,

I recall that there was a bug in some versions of the HDF5 driver with 
similar consequences.  Does the behavior still occur if you define the 
chunks to be along the second dimension of your matrix?

Best wishes
Julian


On 11/06/2013 03:55 PM, Brad Friedman [guest] wrote:
> library(rhdf5)
> go <- function(numRow = blocksize,
>                 chunksize = 4,
>                 numCol = 3,
>                 dims = c(numRow, numCol),
>                 start = 1,
>                 blocksize = 7)  {
>    str(list(numRow = numRow, numCol = numCol,
>             start = start,
>             chunksize = chunksize,
>             blocksize = blocksize))
>
>    mtx <- matrix(1:(blocksize*numCol), ncol = numCol)
>    cat("sum(matrix)=", sum(mtx), "\n")
>
>    file.exists("x.hdf5") && unlink("x.hdf5")
>    h5createFile("x.hdf5")
>    h5createDataset(file="x.hdf5",
>                    dataset = "x",
>                    dims = dims,
>                    H5type = "H5T_NATIVE_UINT32",
>                    level = 0,
>                    chunk= c(chunksize,numCol))
>
>    h5write(mtx, "x.hdf5", name = "x",
>            start = c(start, 1),
>            stride = c(1,1),
>            block = c(blocksize, numCol),
>            count= c(1,1))
>
>    {
>      for(i in 1:10)
>        print(sum(h5read("x.hdf5", "/x",
>                         start = c(start, 1),
>                         stride = c(1,1),
>                         block = c(blocksize, numCol),
>                         count= c(1,1))))
>    }
> }



More information about the Bioconductor mailing list