Skip to content

Failure to read .h5mu files generated by mudata==0.1.2 #91

@votti

Description

@votti

Describe the bug
When trying to read a .h5mu file from mudata==0.1.2, I encounter the error:

src/mudata/_core/io.py:460: in read_h5mu
    mu = MuData._init_from_dict_(**d)
src/mudata/_core/mudata.py:361: in _init_from_dict_
    return cls(
src/mudata/_core/mudata.py:212: in __init__
    self._obsp = PairwiseArrays(self, axis=0, store=kwargs.get("obsp", {}))
.venv/lib/python3.10/site-packages/anndata/_core/aligned_mapping.py:368: in __init__
    super().__init__(parent, store=store)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[TypeError("'NoneType' object is not iterable") raised in repr()] PairwiseArrays object at 0x7be36e5861a0>
parent = MuData object with n_obs × n_vars = 100 × 30
  2 modalities
    mod1:       100 x 10
    mod2:       100 x 20

    def __init__(self, parent: AnnData | Raw, *, store: MutableMapping[str, Value]):
        self._parent = parent
        self._data = store
>       for k, v in self._data.items():
E       AttributeError: 'NoneType' object has no attribute 'items'

.venv/lib/python3.10/site-packages/anndata/_core/aligned_mapping.py:209: AttributeError

To Reproduce
I added a test case for loading legacy data in this PR: #90
(currently failing for unrelated reasons)

Expected behaviour
Also legacy .h5mu files should be loaded without errors.

System

  • OS: :Ubuntu
  • Python version 3.10.13
  • Versions of libraries involved: anndata==0.11.3

Additional context

My diagnosis is that the issue is that older mudata verisons store missing obsp/varp as None instead of droping them/putting an empty dict.
Anndata's PairwiseArrays expects the store argument to be a MutableMapping type thing and not None.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions