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

- HDF5Array objects for representing conventional (a.k.a. dense) HDF5 datasets as DelayedArray objects.

- H5ADMatrix objects for representing h5ad central matrices (or matrices in the `/layers` group) as DelayedMatrix objects.

- TENxMatrix objects for representing 10x Genomics datasets as DelayedMatrix objects.

- DelayedMatrix objects in the DelayedArray package.

- The H5SparseMatrixSeed helper class.

- `h5ls` to list the content of an HDF5 file (`.h5` or `.h5ad`).

### 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.20.0 Index]