You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
read_h5mu() fails on files written by mudata <= 0.1.1 (encoding-type "AnnData") #209
Since mudata 0.4, read_h5mu() can no longer read .h5mu files written by mudata 0.1.1 or older. Those versions stored each modality with the attribute encoding-type = "AnnData" (capital A), while mudata 0.1.2 and later write "anndata". As modality groups are now read through anndata's IO registry, which only knows the lowercase spelling, the read fails:
anndata._io.specs.registry.IORegistryError: No read method registered for
IOSpec(encoding_type='AnnData', encoding_version='0.1.0') from <class 'h5py._hl.group.Group'>.
This was found in anndataR (scverse/anndataR#511), which currently pins mudata<0.4 because its example file minipbcite.h5mu was written by an old mudata. The existing backwards-compatibility tests start at files from v0.1.2, which is why the regression wasn't caught.
Minimal reproduction, simulating an old file by setting the legacy attribute:
python
import numpy as np, anndata as ad, mudata as md, h5py
m = md.MuData({"rna": ad.AnnData(np.ones((3, 2)))})
m.write("legacy.h5mu")
with h5py.File("legacy.h5mu", "r+") as f:
f["mod/rna"].attrs["encoding-type"] = "AnnData" # as written by mudata <= 0.1.1
md.read_h5mu("legacy.h5mu") # IORegistryError
The same file reads fine with mudata 0.3.10.
A possible fix would be to treat the legacy "AnnData" encoding type as "anndata" when reading modalities, and to add a test for a pre-0.1.2 file.
Activity