H5ADMatrix-class: h5ad central matrices (or matrices in the /layers group) as...

H5ADMatrix-classR Documentation

h5ad central matrices (or matrices in the /layers group) as DelayedMatrix objects

Description

h5ad files are HDF5 files used for on-disk representation of AnnData Python objects. At the very minimum, they contain a central data matrix, named X, of shape #observations x #variables, and possibly additional data matrices (stored in the HDF5 group /layers) that share the shape and dimnames of X. See https://anndata.readthedocs.io/ for more information.

The H5ADMatrix class is a DelayedMatrix subclass for representing and operating on the central matrix of an h5ad file, or any matrix in its /layers group.

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

Usage

## Constructor function:
H5ADMatrix(filepath, layer=NULL)

Arguments

filepath

The path (as a single string) to the h5ad file.

layer

NULL (the default) or the name of a matrix in the /layers group. By default (i.e. when layer is not specified) H5ADMatrix() returns the central matrix (X).

Value

H5ADMatrix() returns an H5ADMatrix object of shape #variables x #observations. Note that in Python and HDF5 the shape of this matrix is considered to be #observations x #variables, but in R it is transposed. This follows the widely adopted convention of transposing HDF5 matrices when they get loaded into R.

References

https://anndata.readthedocs.io/ for AnnData Python objects and the h5ad format.

See Also

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

  • H5SparseMatrix objects for representing HDF5 sparse matrices as DelayedMatrix objects.

  • DelayedMatrix objects in the DelayedArray package.

  • The H5ADMatrixSeed helper class.

  • readH5AD and writeH5AD in the zellkonverter package for importing/exporting an h5ad file as/from a SingleCellExperiment object.

Examples

library(zellkonverter)
h5ad_file <- system.file("extdata", "krumsiek11.h5ad",
                         package="zellkonverter")
X <- H5ADMatrix(h5ad_file)
X

Bioconductor/HDF5Array documentation built on Aug. 2, 2022, 11:22 p.m.