Skip to content

fix(visium): build the circles from the spot coordinates again - #416

Merged
LucaMarconato merged 2 commits into
mainfrom
fix/visium-shapes-coords-regression
Sep 9, 2026
Merged

fix(visium): build the circles from the spot coordinates again#416
LucaMarconato merged 2 commits into
mainfrom
fix/visium-shapes-coords-regression

Conversation

@LucaMarconato

@LucaMarconato LucaMarconato commented Sep 9, 2026

Copy link
Copy Markdown
Member

Fixes a bug introduced by #411

below: AI generated–manually reviewed

visium() used coords for two things: the raw tissue_positions table merged into adata.obs, and, after a rebinding, the (n, 2) array of spot coordinates that ShapesModel.parse() consumes.

In #411 the rebinding was inlined into the adata.obsm["spatial"] assignment (coords changing type is what mypy rejects), so the raw table reached ShapesModel.parse() and the reader raised TypeError: ShapesModel.parse() does not support the type <class 'pandas.core.frame.DataFrame'>.

Use a separate name for the coordinates, which keeps mypy happy without changing the runtime behaviour, and add a regression test on a minimal synthetic dataset (the plain Visium reader had no test coverage).

LucaMarconato and others added 2 commits September 8, 2026 15:18
`visium()` used `coords` for two things: the raw `tissue_positions` table
merged into `adata.obs`, and, after a rebinding, the `(n, 2)` array of
spot coordinates that `ShapesModel.parse()` consumes.

In #411 the rebinding was inlined into the `adata.obsm["spatial"]`
assignment (`coords` changing type is what mypy rejects), so the raw
table reached `ShapesModel.parse()` and the reader raised
`TypeError: ShapesModel.parse() does not support the type
<class 'pandas.core.frame.DataFrame'>`.

Use a separate name for the coordinates, which keeps mypy happy without
changing the runtime behaviour, and add a regression test on a minimal
synthetic dataset (the plain Visium reader had no test coverage).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@LucaMarconato
LucaMarconato enabled auto-merge (squash) September 9, 2026 10:59
@codecov-commenter

codecov-commenter commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.13%. Comparing base (d2664fa) to head (e19b01e).

Files with missing lines Patch % Lines
src/spatialdata_io/readers/visium.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #416      +/-   ##
==========================================
- Coverage   63.15%   63.13%   -0.02%     
==========================================
  Files          26       26              
  Lines        3257     3258       +1     
==========================================
  Hits         2057     2057              
- Misses       1200     1201       +1     
Files with missing lines Coverage Δ
src/spatialdata_io/readers/visium.py 18.40% <0.00%> (-0.15%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@LucaMarconato
LucaMarconato merged commit 9be1835 into main Sep 9, 2026
8 checks passed
@LucaMarconato
LucaMarconato deleted the fix/visium-shapes-coords-regression branch September 9, 2026 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants