Skip to contents

Convenience alias for load_h5ad(h5ad_streaming = TRUE). Kept for backwards compatibility. Prefer calling load_h5ad() directly.

Usage

stream_h5ad(
  object,
  h5_path,
  sc_qc_param = params_sc_min_quality(),
  raw_count_slot = c("auto", "X", "raw.X", "layers.counts"),
  csc_mem_gb = NULL,
  streaming = deprecated(),
  batch_size = deprecated(),
  max_genes_in_memory = deprecated(),
  cell_batch_size = deprecated(),
  .verbose = TRUE
)

Arguments

object

SingleCells class.

h5_path

Path to the h5ad file or AnnData Zarr store.

sc_qc_param

List. Output of params_sc_min_quality().

raw_count_slot

Where raw counts live. "auto" detects per file via detect_raw_count_slot(); otherwise one of "X", "raw.X", "layers.counts".

csc_mem_gb

Optional numeric. Memory in GB for the buffers of the cell-to-gene (CSR to CSC) conversion, at 10 bytes per non-zero. NULL (default) converts in one pass and holds the whole matrix. Set a cap for large data sets; every extra phase re-reads the cell file once.

streaming, batch_size, max_genes_in_memory, cell_batch_size

Replaced by csc_mem_gb and ignored. [Deprecated]

.verbose

Boolean.

Value

The class with updated shape information.

Examples

# same as load_h5ad(h5ad_streaming = TRUE)
data <- generate_single_cell_test_data(
  syn_data_params = params_sc_synthetic_data(n_cells = 200L, n_genes = 40L)
)
f_path <- tempfile(fileext = ".h5ad")
write_h5ad_sc(f_path, data$counts, data$obs, data$var, .verbose = FALSE)
dir_data <- tempfile("sc_stream")
dir.create(dir_data, recursive = TRUE)
sc <- stream_h5ad(
  object = SingleCells(dir_data = dir_data),
  h5_path = f_path,
  sc_qc_param = params_sc_min_quality(
    min_unique_genes = 5L,
    min_lib_size = 25L,
    min_cells = 5L
  ),
  .verbose = FALSE
)
dim(sc)
#> [1] 200  40

unlink(c(f_path, dir_data), recursive = TRUE, force = TRUE)