Skip to content

Convert: loom (generic and velocyto), import and export #26

Description

@Claptar

Part of #20. Depends on #21. Equivalent of scanpy.read_loom / anndata.read_loom.

Import

loom AnnData
/matrix (genes × cells, dense, chunked) X (transposed)
/layers/* layers
/col_attrs/* obs (1-D) / obsm (2-D)
/row_attrs/* var (1-D) / varm (2-D)
/col_graphs/*, /row_graphs/* (COO a, b, w) obsp / varp
global attributes (/attrs in spec v3, root attrs in v2) uns

Options

  • --obs-names / --var-names choose the attribute (defaults CellID / Gene, as loompy)
  • --sparse (default, like scanpy's sparse=True) / --dense
  • --X-layer NAME promotes a layer to X
  • --make-unique

Velocyto looms: spliced, unspliced, ambiguous (and matrix) → layers, ready for scVelo.

Streaming: read /matrix in column blocks aligned to its chunking (usually 64×64), sparsify each block and emit CSR rows; reuse sparsify / transpose_sparse_streaming.

Export

h5ad → loom for SCope, velocyto and loompy users.

  • Dense transpose written in chunks; refuse above a size threshold unless --force (same idea as check_growth).
  • obs/var → col_attrs/row_attrs; obsm/varm 2-D arrays kept; categoricals written as strings.
  • obsp/varp → graphs.

Tests

  • h5py fixtures for spec v2 and v3, and a velocyto-style loom.
  • Compare with scanpy.read_loom / anndata.read_loom; round trip h5ad → loom → h5ad.

Activity

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