bioalpha.h5ad_map.SparseDatasetMap.from_dataset

static SparseDatasetMap.from_dataset(dataset: Dataset, spformat: Literal['csr', 'csc'], file: H5ADMapFile, key: str, force: bool = False)

Convert h5py.Dataset to SparseDatasetMap without load full matrix to memory.

Parameters:
  • dataset (Dataset) – Dataset with shape (n_rows x n_cols) for converting to SparseDatasetMap.

  • spformat ("csr" | "csc") – Format that will convert to. If spformat == self.format_str, do nothing.

  • file (AlignedMixinMap) – Output handle that backed matrix will saved on. File must have functions create_dataset and create_group.

  • key (str, default = None) – Key saved to file. Default is spformat.

Returns:

spmatrix – Converted backed sparse matrix.

Return type:

SparseDatasetMap