Skip to content

fix: spatDeconvPlot() selects cell types by name, not position - #159

Merged
RubD merged 1 commit into
gsourcefrom
fix/deconv-cell-id-by-name-gsource
Oct 11, 2026
Merged

RubD merged 1 commit into
gsourcefrom
fix/deconv-cell-id-by-name-gsource

Conversation

@RubD

@RubD RubD commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

plot_spat_scatterpie_layer_ggplot() took colnames(spatial_enrichment)[-1] as the pie columns, which assumes cell_ID is the first column. DWLS writes cell_ID last, so cell_ID was passed to scatterpie::geom_scatterpie() and rowSums() failed with 'x' must be numeric or complex.

This picks the columns by name instead: setdiff(colnames(spatial_enrichment), "cell_ID"). That matches how the same function already merges with the locations (by = "cell_ID"). Tables with cell_ID first behave exactly as before.

  • Regression test tests/testthat/test_spat_deconv_plot.R puts cell_ID last. It fails without the fix and passes with it.
  • NEWS entry

Same fix as the 0.2.15.1 patch PR into main.

Fixes #149

Reference to: #149 (comment)

The scatterpie layer took colnames(spatial_enrichment)[-1] as the pie
columns, assuming cell_ID is first. DWLS writes cell_ID last, so it was
passed to geom_scatterpie() and rowSums() failed. Exclude cell_ID by name.

Fixes #149

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@RubD
RubD merged commit 45992f8 into gsource Oct 11, 2026
2 of 8 checks passed
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.

1 participant