Skip to content

Convert: h5ad ↔ zarr #22

Closed
Closed

Description

@Claptar

Part of #20. Depends on #21.

Goal

adata convert data.h5ad -o data.zarr [--zarr-format 2|3]
adata convert data.zarr -o data.h5ad

This already works implicitly through adata subset in.h5ad -o out.zarr, which proves copy_store_contents handles every backend pair. A dedicated, discoverable command is what's missing.

Plan

  • Thin converter over storage.copy_store_contents.
  • Keep the source's chunking and compression by default; add --rechunk and --compressor for zarr targets.
  • Write consolidated metadata for zarr targets.
  • zarr v3 by default from an h5ad source (existing behaviour); follow the source format for zarr → zarr.
  • Refuse -o - and output == input.

Tests

  • All six pairings of h5ad / zarr2 / zarr3.
  • Open the result with anndata.read_zarr / read_h5ad under the integration marker.
  • Perf guard: one read per chunk, no full materialisation.

Activity

  1. Claptar commented on Oct 14, 2026

    @Claptar
    ContributorAuthor

    Implemented in #33, with one part deferred: --rechunk. Chunking is carried over from the source, and the copy already sizes its reads by bytes (32 MiB) rather than by source chunks, so a badly chunked source is read efficiently anyway. Rewriting the chunk layout is a separate option that can follow when someone needs it. --compression is in (none/gzip/lzf for h5ad, none/gzip/zstd/blosc for zarr), and consolidated metadata is written for zarr outputs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions