H5SparseMatrix-class {HDF5Array}R Documentation

HDF5 sparse matrices as DelayedMatrix objects

Description

The H5SparseMatrix class is a DelayedMatrix subclass for representing and operating on an HDF5 sparse matrix stored in CSR/CSC/Yale format.

All the operations available for DelayedMatrix objects work on H5SparseMatrix objects.

Usage

## Constructor function:
H5SparseMatrix(filepath, group)

Arguments

filepath

The path (as a single string) to the HDF5 file (.h5 or .h5ad) where the sparse matrix is located.

group

The name of the group in the HDF5 file where the sparse matrix is stored.

Value

An H5SparseMatrix object.

See Also

Examples

library(zellkonverter)
h5ad_file <- system.file("extdata", "example_anndata.h5ad",
                         package="zellkonverter")
h5ls(h5ad_file)

M <- H5SparseMatrix(h5ad_file, "/obsp/connectivities")
M

is(M, "DelayedMatrix")  # TRUE
dim(M)
seed(M)
path(M)
is_sparse(M)  # TRUE

[Package HDF5Array version 1.21.0 Index]