other: Saving other seed classes

saveDelayedObject,ANY-methodR Documentation

Saving other seed classes

Description

Optional methods to save other classes, depending on the availability of the packages in the current R installation.

Usage

## S4 method for signature 'ANY'
saveDelayedObject(x, file, name)

Arguments

x

An R object of a supported class, see Details.

file

String containing the path to a HDF5 file.

name

String containing the name of the group to save into.

Details

The ANY method will dispatch to classes that are implemented in other packages:

  • If x is a LowRankMatrixSeed from the BiocSingular package, it is handled as a delayed matrix product.

  • If x is a ResidualMatrixSeed from the ResidualMatrix package, it is converted into the corresponding series of delayed operations. However, the top-level group will contain a "r_type_hint" dataset to indicate that it was originally a ResidualMatrix object. This provides R clients with the opportunity to reload it as a ResidualMatrix, which may be more efficient than the naive DelayedArray representation.

  • Otherwise, if x comes from package Y, we will try to load chihaya.Y. This is assumed to define an appropriate saveDelayedObject method for x.

Value

A NULL, invisibly. A group is created at name containing the contents of x.

Author(s)

Aaron Lun

Examples

# Saving a matrix product.
library(BiocSingular)
left <- matrix(rnorm(100000), ncol=20)
right <- matrix(rnorm(50000), ncol=20)
thing <- LowRankMatrix(left, right)
temp <- tempfile()
saveDelayed(thing, temp)
rhdf5::h5ls(temp)
loadDelayed(temp)


LTLA/DelayedArraySaver documentation built on Oct. 11, 2023, 1:33 p.m.