scverse / scanpy

Single-cell analysis in Python. Scales to >1M cells.
https://scanpy.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1.8k stars 581 forks source link

read_10x_mtx() with annData 0.10.4 only reads one variable #2825

Closed lelandwilliams closed 5 months ago

lelandwilliams commented 5 months ago

Please make sure these conditions are met

What happened?

After upgrading annData to 0.10.4 I tried to read in some Visium data with read_10x_mtx() The resulting table only had one variable (/gene/column), and had it over and over again.

Minimal code sample

S = scanpy.read_10x_mtx(mydata)

Error output

/home/lhw/pkgs/mambaforge/envs/env2/lib/python3.11/site-packages/anndata/_core/anndata.py:1908: UserWarning: Variable names are not unique. To make them unique, call `.var_names_make_unique`.
  utils.warn_names_duplicates("var")

In [6]: S.var_names
Out[6]: 
Index(['NOC2L', 'NOC2L', 'NOC2L', 'NOC2L', 'NOC2L', 'NOC2L', 'NOC2L', 'NOC2L',
       'NOC2L', 'NOC2L',
       ...
       'NOC2L', 'NOC2L', 'NOC2L', 'NOC2L', 'NOC2L', 'NOC2L', 'NOC2L', 'NOC2L',
       'NOC2L', 'NOC2L'],
      dtype='object', length=18085)

To test, I ran in another environment with scanpy 1.9.6 but annData 0.10.3.
Below are the results:

In [4]: S = scanpy.read_10x_mtx(mydata)

In [5]: S.var_names
Out[5]: 
Index(['SAMD11', 'NOC2L', 'KLHL17', 'PLEKHN1', 'PERM1', 'HES4', 'ISG15',
       'AGRN', 'RNF223', 'C1orf159',
       ...
       'MT-ND2', 'MT-CO2', 'MT-ATP6', 'MT-CO3', 'MT-ND3', 'MT-ND4L', 'MT-ND4',
       'MT-ND5', 'MT-ND6', 'MT-CYB'],
      dtype='object', length=18085)

Versions

Scanpy 1.9.6 annData 0.10.3 works, annData 0.10.4 does not

``` ```
flying-sheep commented 5 months ago

Duplicate of #2806

Please check recently closed issues, I just closed #2822 as a duplicate