Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visium Voxels Don't Load Properly on Combined Seurat Object using Seurat v5.1.0 #8964

Open
TeodoraTockovska opened this issue May 31, 2024 · 8 comments
Labels
bug Something isn't working

Comments

@TeodoraTockovska
Copy link

Hi Seurat team!

I have found a bug while using SpatialPlot() on a combined Seurat object containing 12 Visium samples. While using CRAN's version of Seurat (v5.1.0), SpatialPlot does not display the voxels over the H&E images on 10/12 samples. I reverted back to Seurat v5 and SpatialPlot works as intended.

Thanks.

@TeodoraTockovska TeodoraTockovska added the bug Something isn't working label May 31, 2024
@zskylarli
Copy link
Contributor

zskylarli commented May 31, 2024

Hi - are you seeing this behavior with the stxBrain dataset loaded using SeuratData?

@TeodoraTockovska
Copy link
Author

TeodoraTockovska commented Jun 3, 2024

Hi @zskylarli,

I downloaded both datasets, where ssHippo dataset loaded in R but stxBrain failed to load. I tested running SpatialPlot with Seurat v5.0.0 and v5.1.0 using ssHippo. The dots showed up but there was no image for either version of Seurat.

# I tested the following code using Seurat v5.0.0 and Seurat v5.1.0

# Installation of ssHippo and sxtBrain
library(Seurat)
library(SeuratData) # v0.2.2.9001

InstallData("ssHippo")
data("ssHippo")
SpatialPlot(ssHippo)

# Note: the installation worked for me, but it did not load the object.
# InstallData("stxBrain")
# data("stxBrain")

@dcollins15
Copy link
Contributor

@TeodoraTockovska how was this combined object generated (i.e with what Seurat / SeuratObject versions)?

If you increase the value of pt.size.factor being passed to SpatialPlot (default is 1.6) are you able to see the missing voxels?

@TeodoraTockovska
Copy link
Author

Hi @dcollins15, the samples were merged using merge() and they were integrated using RunHarmony(). I integrated the objects using the Seurat v4 workflow (I can't remember the exact version). I used Seurat v5 for creating visualizations because SpatialPlot has the "keep.scale" argument.

I tried increasing the voxel size to 5 and i don't see the voxels on 10/12 samples.

@dcollins15
Copy link
Contributor

dcollins15 commented Jun 5, 2024

For an image where the voxels are not being displayed correctly, can you please show us the output of

Radius(merged_obj[["name-of-image"]], scale = "lowres")

and

merged_obj[["name-of-image"]]@spot.radius

while you're there it might also be helpful to see:

ScaleFactors(merged_obj[["name-of-image"]])

In v5.1.0 we update the way the voxel radius values are calculated to facilitate plotting with the hires H&E images provided in the Visium output. Previously, we relied on the spot.radius attribute of the VisiumV1 class which was populated inside Read10X_Image based on the "fiducial" scale factor. Now, the value is calculated on-the-fly based on either the "hires" or "lowres" scale factor (specified by the image.scale param for SpatialPlot).

I'm wondering if the two datasets that aren't plotting correctly might be getting scaled differently from the other ten. Do you know the exact version of Seurat that was used to do the initial data intake (4.x.x)?

@TeodoraTockovska
Copy link
Author

Hi @dcollins15, that is quite interesting. I selected the high resolution images for each sample, so the low resolution value was set to the high resolution value. Below are the outputs for one of my objects in the combined Seurat object. After checking my notes, I found that I used Seurat v4.3.0 for the initial analysis for each sample.

> Radius(combined_seurat[["image_obj1"]], scale = "lowres")
Error in Radius.VisiumV1(combined_seurat[["image_obj1"]], scale = "lowres") : 
  unused argument (scale = "lowres")
> combined_seurat[["image_obj1"]]@spot.radius
[1] 0.003068563
> ScaleFactors(combined_seurat[["image_obj1"]])
$spot
[1] 0.1158078

$fiducial
[1] 176.6469

$hires
[1] 0.1158078

$lowres
[1] 0.1158078

attr(,"class")
[1] "scalefactors"

@dcollins15
Copy link
Contributor

I selected the high resolution images for each sample, so the low resolution value was set to the high resolution value

It also looks like the "spot" value was also clobbered. For standard Visium datasets the "spot" and "fiducial" values should be a similar order of magnitude - a typical value is ~80.

Can you try setting the pt.size.factor to something like 1500 and see if the voxels show up then?

As a side note, as of v5.1.0, you can pass image.scale = "hires" to SpatialPlot to match the scaling for the high-resolution PNG.

Do you have access to the original Visium output for these datasets? If you reprocess them with Load10X_Spatial or just the images with Read10X_Image you should get the correct scale values.

@TeodoraTockovska
Copy link
Author

Hi @dcollins15,

My apologies for not responding sooner -- I am tied up with completing some projects at the moment. I am uncertain why the spot value had changed; I didn't make any other modifications to the values. Also, that is good to know for v5.1.0, that is going to be very useful!

As for your other questions, I can't answer them right now; I will get back to you when I get the chance.

Sincerely,
Teodora

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants