scverse / squidpy

Spatial Single Cell Analysis in Python
https://squidpy.readthedocs.io/en/stable/
BSD 3-Clause "New" or "Revised" License
439 stars 79 forks source link

Visium observation with NaN metadata #906

Open jychien opened 1 week ago

jychien commented 1 week ago

Description

When tissue_positions.csv rather than tissue_positions_list.csv is in the spatial directory for a Visium dataset, the resulting AnnData object has:

Minimal reproducible example

Image

Traceback

It looks like this the issue could be that it should be header=0 rather than header=1 in this line: https://github.com/scverse/squidpy/blob/945e127b0e690a6f926de8c3b6d7ed4c6b2ebae5/src/squidpy/read/_read.py#L87

Version

squidpy 1.2.3 and later

LLehner commented 3 days ago

Hi @jychien, the squidpy reader functions will be deprecated eventually, since we use spatialdata-io for reading now. I would suggest to use the Visium reader from spatialdata-io which loads the data into a spatialdata object.

sdata = sd.visium("path/to/directory")

The anndata object with coordinates can be found under sdata.tables, so you can continue to use squidpy as usal for analysis.