Fix SpatialDimplot(..., interactive = TRUE)
to support all SpatialImage
types
#9691
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.
This PR resolves an issue encountered when running
SpatialDimplot
onSlideSeq
orSTARmap
inputs withinteractive = TRUE
. Since the functionality is interactive, implementing a proper test is a bit of a PITA so in lieu, the following script can be used to verify that the bug has been resolved:The issue was introduced by yours truly in
Seurat
5.1.0 when I added spatial coordinates to the hover output ofISpatialDimPlot
. The trouble was that theScaleFactors
generic wasn't implemented forSlideSeq
orSTARmap
, hence the error:The fix is to define the generic for the types in question,
ScaleFactors.SlideSeq
andScaleFactors.STARmap
. Both implementations return ascalefactors
S3 class with all its values set to 1. Another alternative is to updateISpatialDimPlot
to check the class ofobject[[image]]
and conditionally callScaleFactors
on the appropriate types:My thinking is that although the
scalefactors
class is specific to the Visium platform (and therefore kinda "wrong" to populate for other technologies) we're eventually planning on unifying all of theSpatialImage
implementations under theFOV
class. Until then, it seems like a good idea to take the opportunity to refine the disparate types to expose a consistent interface.Reported as: