ReshapedHDF5Array-class: Virtually reshaped HDF5 datasets as DelayedArray objects

ReshapedHDF5Array-classR Documentation

Virtually reshaped HDF5 datasets as DelayedArray objects

Description

The ReshapedHDF5Array class is a DelayedArray subclass for representing an HDF5 dataset with a user-supplied upfront virtual reshaping.

All the operations available for DelayedArray objects work on ReshapedHDF5Array objects.

Usage

## Constructor function:
ReshapedHDF5Array(filepath, name, dim, type=NA)

Arguments

filepath, name, type

See ?HDF5Array for a description of these arguments.

dim

A vector of dimensions that describes the virtual reshaping i.e. the reshaping that is virtually applied upfront to the HDF5 dataset when the ReshapedHDF5Array object gets constructed.

Note that the HDF5 dataset is treated as read-only so is not effectively reshaped, that is, the dataset dimensions encoded in the HDF5 file are not mmodified.

Also please note that arbitrary reshapings are not supported. Only reshapings that reduce the number of dimensions by collapsing a group of consecutive dimensions into a single dimension are supported. For example, reshaping a 10 x 3 x 5 x 1000 array as a 10 x 15 x 1000 array or as a 150 x 1000 matrix is supported.

Value

A ReshapedHDF5Array (or ReshapedHDF5Matrix) object. (Note that ReshapedHDF5Matrix extends ReshapedHDF5Array.)

See Also

  • HDF5Array objects for representing HDF5 datasets as DelayedArray objects without upfront virtual reshaping.

  • DelayedArray objects in the DelayedArray package.

  • writeHDF5Array for writing an array-like object to an HDF5 file.

  • saveHDF5SummarizedExperiment and loadHDF5SummarizedExperiment in this package (the HDF5Array package) for saving/loading an HDF5-based SummarizedExperiment object to/from disk.

  • The ReshapedHDF5ArraySeed helper class.

  • h5ls to list the content of an HDF5 file.

Examples

library(h5vcData)
tally_file <- system.file("extdata", "example.tally.hfs5",
                          package="h5vcData")
h5ls(tally_file)

## Pick up "Coverages" dataset for Human chromosome 16 and collapse its
## first 2 dimensions:
cvg <- ReshapedHDF5Array(tally_file, "/ExampleStudy/16/Coverages",
                         dim=c(12, 90354753))
cvg

is(cvg, "DelayedArray")  # TRUE
seed(cvg)
path(cvg)
dim(cvg)
chunkdim(cvg)

Bioconductor/HDF5Array documentation built on Oct. 31, 2024, 9:16 a.m.