Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when filtering on multiple tables #244

Open
berombau opened this issue May 23, 2024 · 1 comment
Open

Error when filtering on multiple tables #244

berombau opened this issue May 23, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@berombau
Copy link
Collaborator

berombau commented May 23, 2024

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
@berombau berombau added the bug Something isn't working label May 23, 2024
@melonora
Copy link
Collaborator

@berombau thanks for reporting, I will have a look

@melonora melonora self-assigned this Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants