/home/guillaume/Projets/gemmapy/.venv/lib64/python3.14/site-packages/anndata/_core/anndata.py:865: UserWarning:
AnnData expects .var.index to contain strings, but got values like:
[109979, 18952, 109978, 18950, 18951]
Inferred to be: integer
names = self._prep_dim_index(names, "var")
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/home/guillaume/Projets/gemmapy/.venv/lib64/python3.14/site-packages/legacy_api_wrap/__init__.py", line 88, in fn_compatible
return fn(*args_all, **kw)
File "/home/guillaume/Projets/gemmapy/.venv/lib64/python3.14/site-packages/scanpy/readwrite.py", line 582, in read_10x_mtx
return adata[:, gex_rows].copy()
~~~~~^^^^^^^^^^^^^
File "/home/guillaume/Projets/gemmapy/.venv/lib64/python3.14/site-packages/anndata/_core/anndata.py", line 1049, in __getitem__
oidx, vidx = self._normalize_indices(index)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^
File "/home/guillaume/Projets/gemmapy/.venv/lib64/python3.14/site-packages/anndata/_core/anndata.py", line 1030, in _normalize_indices
return _normalize_indices(index, self.obs_names, self.var_names)
File "/home/guillaume/Projets/gemmapy/.venv/lib64/python3.14/site-packages/anndata/_core/index.py", line 36, in _normalize_indices
ax1 = _normalize_index(ax1, names1)
File "/home/guillaume/Projets/gemmapy/.venv/lib64/python3.14/site-packages/anndata/_core/index.py", line 46, in _normalize_index
raise TypeError(msg)
TypeError: Don’t call _normalize_index with non-categorical/string names and non-range index Index([ 109979, 18952, 109978, 18950, 18951, 108645,
102640821, 102640825, 626832, 626834,
...
19263, 19264, 100043034, 19261, 20248, 19262,
20249, 19260, 403088, 100043033],
dtype='int64', length=24428)
Please make sure these conditions are met
What happened?
The
read_10x_mtxfunction uses Pandas' defaults for reading tabular data which results in numerical gene IDs such as NCBI gene IDs to be interpreted as number. This does not work withmake_unique=Truebecause it will attempt to concatenate a unique suffix to a float.Minimal code sample
Error output
/home/guillaume/Projets/gemmapy/.venv/lib64/python3.14/site-packages/anndata/_core/anndata.py:865: UserWarning: AnnData expects .var.index to contain strings, but got values like: [109979, 18952, 109978, 18950, 18951] Inferred to be: integer names = self._prep_dim_index(names, "var") Traceback (most recent call last): File "<input>", line 1, in <module> File "/home/guillaume/Projets/gemmapy/.venv/lib64/python3.14/site-packages/legacy_api_wrap/__init__.py", line 88, in fn_compatible return fn(*args_all, **kw) File "/home/guillaume/Projets/gemmapy/.venv/lib64/python3.14/site-packages/scanpy/readwrite.py", line 582, in read_10x_mtx return adata[:, gex_rows].copy() ~~~~~^^^^^^^^^^^^^ File "/home/guillaume/Projets/gemmapy/.venv/lib64/python3.14/site-packages/anndata/_core/anndata.py", line 1049, in __getitem__ oidx, vidx = self._normalize_indices(index) ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^ File "/home/guillaume/Projets/gemmapy/.venv/lib64/python3.14/site-packages/anndata/_core/anndata.py", line 1030, in _normalize_indices return _normalize_indices(index, self.obs_names, self.var_names) File "/home/guillaume/Projets/gemmapy/.venv/lib64/python3.14/site-packages/anndata/_core/index.py", line 36, in _normalize_indices ax1 = _normalize_index(ax1, names1) File "/home/guillaume/Projets/gemmapy/.venv/lib64/python3.14/site-packages/anndata/_core/index.py", line 46, in _normalize_index raise TypeError(msg) TypeError: Don’t call _normalize_index with non-categorical/string names and non-range index Index([ 109979, 18952, 109978, 18950, 18951, 108645, 102640821, 102640825, 626832, 626834, ... 19263, 19264, 100043034, 19261, 20248, 19262, 20249, 19260, 403088, 100043033], dtype='int64', length=24428)Versions
Details