scverse / scverse/napari-spatialdata

Error when filtering on multiple tables

Open
#244 1 comment 0 reactions 1 assignee View on GitHub

@melonora is already working on this.

Since Jun 10, 2024.

bug
Dominant language
Python
Stars
90
Forks
25
Avg merge
22m
Merged PRs (30d)
1

Description

Filtering does not work if an extra table is present not related to an element (which is a use case to save analysis results).

# napari_spatialdata/utils/_utils.py:361
for element_type, element_name, _ in sdata.filter_by_coordinate_system(coordinate_system_name)._gen_elements()

which calls:

# spatialdata/_core/spatialdata.py:737
table = _filter_table_by_element_names(table, element_names) # table is None and has no len
if len(table) != 0:
# TypeError: object of type 'NoneType' has no len()

To reproduce:

import spatialdata as sd
import anndata as ad
from spatialdata.datasets import blobs

sdata = blobs()
sdata.tables['table2'] = sd.models.TableModel.parse(ad.AnnData((10, 10)))
sdata.write('test.zarr')
# Open in napari-spatialdata, click on coordinate-system global, get error

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.