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

Squidpy unable to read fovs even when they are in the correct format #858

Closed asmilagswash closed 3 months ago

asmilagswash commented 3 months ago

Description

...

Minimal reproducible example

...

adata = sq.read.nanostring(path = sample_dir, counts_file = counts_file, meta_file = meta_file, fov_file = fov_file)

Traceback

```pytb ... ``` --------------------------------------------------------------------------- KeyError Traceback (most recent call last) Cell In[5], line 1 ----> 1 adata = sq.read.nanostring(path = sample_dir, 2 counts_file = counts_file, 3 meta_file = meta_file, 4 fov_file = fov_file) File /usr/local/lib/python3.10/site-packages/squidpy/read/_read.py:259, in nanostring(path, counts_file, meta_file, fov_file) 257 if fname.endswith(file_extensions): 258 fov = str(int(pat.findall(fname)[0])) --> 259 adata.uns[Key.uns.spatial][fov]["images"][kind] = _load_image(path / subdir / fname) 261 if fov_file is not None: 262 fov_positions = pd.read_csv(path / fov_file, header=0, index_col=fov_key) KeyError: '214'

Version

1.3 ...

asmilagswash commented 3 months ago

sorry this bug has been fixed in the latest stable version. the earlier versions werent able to read the FOVs in nanostring data which had 0 or almost no cells