| Title: | beachmat bindings for HDF5-backed matrices |
|---|---|
| Description: | Extends beachmat to support initialization of tatami matrices from HDF5-backed arrays. This allows C++ code in downstream packages to directly call the HDF5 C/C++ library to access array data, without the need for block processing via DelayedArray. Some utilities are also provided for direct creation of an in-memory tatami matrix from a HDF5 file. |
| Authors: | Aaron Lun [aut, cre] |
| Maintainer: | Aaron Lun <[email protected]> |
| License: | GPL-3 |
| Version: | 1.11.0 |
| Built: | 2026-05-30 05:28:47 UTC |
| Source: | https://github.com/bioc/beachmat.hdf5 |
Initialize C++ representations of HDF5-backed matrices based on their HDF5Array representations.
## S4 method for signature 'H5SparseMatrixSeed' initializeCpp( x, ..., hdf5.cache.size = getAutoBlockSize(), hdf5.realize = initializeOptions("realize"), memorize = hdf5.realize, hdf5.realize.force.integer = initializeOptions("realize.force.integer") ) ## S4 method for signature 'HDF5ArraySeed' initializeCpp( x, ..., hdf5.cache.size = getAutoBlockSize(), hdf5.realize = initializeOptions("realize"), memorize = hdf5.realize, hdf5.realize.force.integer = initializeOptions("realize.force.integer") )## S4 method for signature 'H5SparseMatrixSeed' initializeCpp( x, ..., hdf5.cache.size = getAutoBlockSize(), hdf5.realize = initializeOptions("realize"), memorize = hdf5.realize, hdf5.realize.force.integer = initializeOptions("realize.force.integer") ) ## S4 method for signature 'HDF5ArraySeed' initializeCpp( x, ..., hdf5.cache.size = getAutoBlockSize(), hdf5.realize = initializeOptions("realize"), memorize = hdf5.realize, hdf5.realize.force.integer = initializeOptions("realize.force.integer") )
x |
A HDF5Array seed object. |
... |
Further arguments, ignored. |
hdf5.cache.size |
Integer scalar specifying the size of the cache in bytes during data extraction from a HDF5 matrix. Larger values reduce disk I/O during random access to the matrix, at the cost of increased memory usage. |
hdf5.realize |
See the |
memorize |
Deprecated, use |
hdf5.realize.force.integer |
See the |
An external pointer that can be used in any tatami-compatible function.
Aaron Lun
library(HDF5Array) y <- matrix(runif(1000), ncol=20, nrow=50) z <- as(y, "HDF5Array") ptr <- initializeCpp(z)library(HDF5Array) y <- matrix(runif(1000), ncol=20, nrow=50) z <- as(y, "HDF5Array") ptr <- initializeCpp(z)
Options for initializing HDF5 matrices in initializeCpp.
initializeOptions(option, value)initializeOptions(option, value)
option |
String specifying the name of the option. |
value |
Value of the option. |
The following options are supported:
realize, a logical scalar specifying whether to load the matrix data from HDF5 into memory with loadIntoMemory,
and then cache it for future calls with checkMemoryCache.
This avoids time-consuming disk I/O when performing multiple passes through the matrix, at the expense of increased memory usage.
realize.force.integer, a logical scalar indicating whether values should be coerced into integers when loading the matrix into memory with loadIntoMemory.
If value is missing, the current setting of option is returned.
If value is supplied, it is used to set the option, and the previous value of the option is invisibly returned.
Aaron Lun
initializeOptions("realize.force.integer") old <- initializeOptions("realize.force.integer", TRUE) # setting to a new value initializeOptions("realize.force.integer") # new option takes affect initializeOptions("realize.force.integer", old) # setting it backinitializeOptions("realize.force.integer") old <- initializeOptions("realize.force.integer", TRUE) # setting to a new value initializeOptions("realize.force.integer") # new option takes affect initializeOptions("realize.force.integer", old) # setting it back
Load a HDF5-backed matrix into memory as an external pointer to a tatami-compatible representation.
This differs from the (default) behavior of initializeCpp, which only loads slices of the matrix on request.
loadIntoMemory(x, force.integer = FALSE)loadIntoMemory(x, force.integer = FALSE)
x |
A HDF5Array-derived matrix or seed object. |
force.integer |
Whether to force floating-point values to be integers to reduce memory consumption. |
An external pointer that can be used in tatami-based functions.
Aaron Lun
library(HDF5Array) y <- matrix(runif(1000), ncol=20, nrow=50) z <- as(y, "HDF5Array") ptr <- loadIntoMemory(z)library(HDF5Array) y <- matrix(runif(1000), ncol=20, nrow=50) z <- as(y, "HDF5Array") ptr <- loadIntoMemory(z)