anndata.abc.CSRDataset#

class anndata.abc.CSRDataset[source]#

Bases: ABC

On disk CSR sparse matrix.

Analogous to h5py.Dataset or zarr.Array, but for sparse matrices.

Attributes

backend[source]#

Which file type is used on-disk.

dtype[source]#

The numpy.dtype of the data attribute of the sparse matrix.

format: ClassVar[Literal['csr', 'csc']] = 'csr'[source]#

The format of the sparse matrix.

group[source]#

The group underlying the backed matrix.

shape[source]#

Shape of the matrix.

Methods

abstractmethod __getitem__(index)[source]#

Load a slice or an element from the sparse dataset into memory.

Parameters:
index anndata.typing.Index

Index to load.

Return type:

float | csr_matrix | csc_matrix | csr_array | csc_array

Returns:

The desired data read off disk.

abstractmethod append(sparse_matrix)[source]#

Append an in-memory or on-disk sparse matrix to the current object’s store.

Parameters:
sparse_matrix csr_matrix | csc_matrix | csr_array | csc_array | CSRDataset | CSCDataset

The matrix to append.

Raises:
Return type:

None

abstractmethod to_memory()[source]#

Load the sparse dataset into memory.

Return type:

csr_matrix | csc_matrix | csr_array | csc_array

Returns:

The in-memory representation of the sparse dataset.