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
zipis true and the target is zarr, ensure the output path ends with.zarr.zip; otherwise pass through unchanged. - extract_
zarr_ zip - Extract a
.zarr.ziparchive intotarget_dir, transparently stripping any internal prefix produced bylegume_numeric::matrix::common_io::zip_dirso the result is a flat.zarrdirectory regardless of the zip’s filename. - finalize_
output - Finalize a handler’s output: re-zip the working
.zarrdirectory when the target is.zarr.zip, and return the path the user will actually find (the archive for a.zarr.ziptarget, otherwise the working file). - finalize_
zarr_ output - If
target_pathends with.zarr.zip, zip thezarr_dirinto 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.ziparchives into a.zarrdirectory 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), whereworking_fileis the path to write (the un-zipped.zarrdirectory for a.zarr.ziptarget) — pair it withfinalize_outputonce 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§
- Zarr
Store Rw - A read store paired with an optional write store (present for directories,
Nonefor zips).