diff --git a/src/ngio/tables/_ad_reader.py b/src/ngio/tables/_ad_reader.py index 306655d..1756987 100644 --- a/src/ngio/tables/_ad_reader.py +++ b/src/ngio/tables/_ad_reader.py @@ -35,20 +35,20 @@ def callback(func: Callable, elem_name: str, elem: Any, iospec: Any) -> Any: if iospec.encoding_type == "anndata" or elem_name.endswith("/"): ad_kwargs = {} base_elem = [ + "X", + "layers", "obs", - "var", "obsm", - "varm", "obsp", - "varp", "uns", - "layers", - "X", + "var", + "varm", + "varp", ] # This should make sure that the function behaves the same as the original # implementation. base_elem += list(elem.keys()) - for k in base_elem: + for k in set(base_elem): v = elem.get(k) if v is not None and not k.startswith("raw."): ad_kwargs[k] = read_dispatched(v, callback)