Raise on obs/var key collision in table-based coloring#678
Merged
Conversation
When the same key existed in both `table.obs.columns` and `table.var_names`, upstream `_get_table_origins` returned only the obs origin (elif chain), silently masking gene expression with obs values. Catch the collision at the renderer entry points and raise a descriptive ValueError naming both locations so the user can disambiguate. Fixes #621
- Use `get_element_annotators` instead of hand-rolling the table-annotates- element check via `table.uns["spatialdata_attrs"]["region"]`. - Drop unused `TableModel` import. - Align error message phrasing with the existing `_check_color_column_collision` pattern (`` `color=...` is ambiguous ``).
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #678 +/- ##
==========================================
- Coverage 77.72% 77.71% -0.02%
==========================================
Files 11 11
Lines 3641 3652 +11
Branches 860 863 +3
==========================================
+ Hits 2830 2838 +8
- Misses 486 487 +1
- Partials 325 327 +2
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
table.obs.columnsandtable.var_names, upstream_get_table_origins'selifchain returned only theobsorigin and the user silently got obs values instead of gene expression._check_obs_var_shadowinpl/utils.py, called from_render_shapes/_render_points/_render_labelsbefore any value fetch (the table'svar_namesare clobbered later in the rendering pipeline, so the check must run early).ValueErrornaming bothobs.columnsandvar_namesand pointing at the table key, so the user can rename or drop one side.