scverse / scverse/napari-spatialdata

Shift-E on point elements doesn't retain annotations (i.e. additional DataFrame columns)

Open
#367 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Thanks for this awesome package!

I just wanted to quickly leave the following report here:

After viewing a points element in napari and saving it back to the SpatialData object using "Shift-E", annotations are not retained.

Reproducer:

from spatialdata import SpatialData
from spatialdata.models import PointsModel
import pandas as pd

sdata = SpatialData()

sdata['points'] = PointsModel.parse(
        pd.DataFrame({
            'x': [1, 2],
            'y': [3, 4],
            'category': ['A', 'B'],
        }),
    )

sdata['points'].columns # Index(['x', 'y', 'category'], dtype='object')

from napari_spatialdata import Interactive

interactive = Interactive(sdata)
interactive.add_element("points", "global")

# press Shift-E

sdata['points'].columns # sdata['points'].columns # no longer contains column 'category' (no longer contains column 'category')

Versions used:

napari_spatialdata.__version__: 0.5.4.post0
spatialdata.__version__: 0.4.0

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.

Research direction

Start with the Interactive(sdata) setup and its add_element("points", "global") entry point, then trace what Shift-E invokes when saving the points element. Run the provided pandas and PointsModel reproducer, and verify that the category column remains in sdata['points'].columns after the save.

Written by the indexing model from the issue text.

Assessment

Tech stack
pandas, python
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.