Open
Description
Describe the bug
Starting cellxgene launch ~/datasets/precancer_atlas/sce_small.h5ad
with the latest version of AnnData (0.10.9) crashes because calling data.obs.reset_index(inplace=TRUE)
(https://github.com/chanzuckerberg/cellxgene/blob/main/server/data_anndata/anndata_adaptor.py#L113) puts the object in to an inconsistent state.
When I install Anndata version 0.10.5 the problem disappears.
Output
/Users/ahlmanne/prog/experiments/cellxgene/.cellxgene/lib/python3.12/site-packages/server/data_anndata/anndata_adaptor.py:241: UserWarning: Anndata data matrix is in float64 format not float32. Precision may be truncated.
warnings.warn(
WARNING:root:Type float64 will be converted to 32 bit float and may lose precision.
WARNING:root:Type float64 will be converted to 32 bit float and may lose precision.
WARNING:root:Type float64 will be converted to 32 bit float and may lose precision.
WARNING:root:Type float64 will be converted to 32 bit float and may lose precision.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/ahlmanne/prog/experiments/cellxgene/.cellxgene/lib/python3.12/site-packages/server/data_anndata/anndata_adaptor.py", line 34, in __init__
self._validate_and_initialize()
File "/Users/ahlmanne/prog/experiments/cellxgene/.cellxgene/lib/python3.12/site-packages/server/data_anndata/anndata_adaptor.py", line 202, in _validate_and_initialize
self._create_schema()
File "/Users/ahlmanne/prog/experiments/cellxgene/.cellxgene/lib/python3.12/site-packages/server/data_anndata/anndata_adaptor.py", line 146, in _create_schema
for layout in self.get_embedding_names():
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ahlmanne/prog/experiments/cellxgene/.cellxgene/lib/python3.12/site-packages/server/data_anndata/anndata_adaptor.py", line 305, in get_embedding_names
layouts = [key[2:] for key in self.data.obsm_keys() if type(key) is str and key.startswith("X_")]
^^^^^^^^^^^^^^^^^^^^^
File "/Users/ahlmanne/prog/experiments/cellxgene/.cellxgene/lib/python3.12/site-packages/anndata/_core/anndata.py", line 929, in obsm_keys
return list(self.obsm.keys())
^^^^^^^^^
File "/Users/ahlmanne/prog/experiments/cellxgene/.cellxgene/lib/python3.12/site-packages/anndata/_core/aligned_mapping.py", line 422, in __get__
return self.construct(obj, store=getattr(obj, f"_{self.name}"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ahlmanne/prog/experiments/cellxgene/.cellxgene/lib/python3.12/site-packages/anndata/_core/aligned_mapping.py", line 403, in construct
return self.cls(obj, axis=self.axis, store=store)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ahlmanne/prog/experiments/cellxgene/.cellxgene/lib/python3.12/site-packages/anndata/_core/aligned_mapping.py", line 297, in __init__
super().__init__(parent, store=store)
File "/Users/ahlmanne/prog/experiments/cellxgene/.cellxgene/lib/python3.12/site-packages/anndata/_core/aligned_mapping.py", line 210, in __init__
self._data[k] = self._validate_value(v, k)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ahlmanne/prog/experiments/cellxgene/.cellxgene/lib/python3.12/site-packages/anndata/_core/aligned_mapping.py", line 275, in _validate_value
raise ValueError(msg) from None
ValueError: value.index does not match parent’s obs names:
Index are different
Attribute "inferred_type" are different
[left]: string
[right]: integer
Version (please complete the following information):
- Desktop: Macbook pro M3
- Version: 1.3.0