Skip to main content

Module zarr_io

Module zarr_io 

Source
Expand description

General-purpose zarr I/O for reading numeric arrays and attributes from zarr directories or .zarr.zip archives.

Also provides a convenience function for reading coordinate-style data (row names + numeric matrix) that returns MatWithNames<DMatrix<f32>>, matching the parquet reader interface in legume_numeric::matrix.

Functions§

apply_zip_flag
If zip is true and the target is zarr, ensure the output path ends with .zarr.zip; otherwise pass through unchanged.
extract_zarr_zip
Extract a .zarr.zip archive into target_dir, transparently stripping any internal prefix produced by legume_numeric::matrix::common_io::zip_dir so the result is a flat .zarr directory regardless of the zip’s filename.
finalize_output
Finalize a handler’s output: re-zip the working .zarr directory when the target is .zarr.zip, and return the path the user will actually find (the archive for a .zarr.zip target, otherwise the working file).
finalize_zarr_output
If target_path ends with .zarr.zip, zip the zarr_dir into it and remove the directory. Otherwise this is a no-op (the directory IS the target).
materialize_writable_backend
Copy input backend to a writable output location. Transparently extracts .zarr.zip archives into a .zarr directory so the output can be opened read/write.
open_zarr_store
Open a zarr store for reading (convenience wrapper around open_zarr_store_rw).
open_zarr_store_rw
Open a zarr store, returning both a read store and an optional write store.
parse_10x_cell_id
Parse a 10x Xenium [N, 2] u32 cell_id ndarray into string barcodes.
parse_10x_cell_id_flat
Parse a flat row-major [N, 2] u32 buffer into 10x Xenium cell-ID strings.
prepare_output
Resolve the output target for a handler that writes a fresh backend, and clear any pre-existing file at that path. Returns (effective_output, backend, working_file), where working_file is the path to write (the un-zipped .zarr directory for a .zarr.zip target) — pair it with finalize_output once the backend is populated.
read_zarr_array_attr
Read an attribute from a zarr array node.
read_zarr_coordinates
Read cell coordinates from a Xenium-style zarr file.
read_zarr_flat_f32
Retrieve a zarr array as a flat Vec<f32> (row-major) and its shape.
read_zarr_flat_u32
Retrieve a zarr array as a flat Vec<u32> and its shape.
read_zarr_group_attr
Extract an attribute from a zarr group node.
read_zarr_matrix
Read a numeric matrix from a zarr array, selecting columns by index or name (looked up via an attribute on the array).
read_zarr_ndarray
Read a full ndarray from zarr storage.
read_zarr_numerics
Read a numeric vector from zarr storage.
read_zarr_strings
Read a string array from zarr storage.

Type Aliases§

ZarrStoreRw
A read store paired with an optional write store (present for directories, None for zips).