ludvigla / semla

Other
47 stars 6 forks source link

"LoadImages()" can not align the spots with the HE image. #26

Closed Famingzhao closed 2 months ago

Famingzhao commented 2 months ago

brain_st_cortex <- read_rds(file = "./Rawdata/Seurat_10X_stRNAseq.rds") semla.data <- UpdateSeuratForSemla(brain_st_cortex) semla.data <- LoadImages(semla.data, verbose = FALSE) semla.data MapFeaturesSummary(semla.data, image_use = "raw", features = "nFeature_Spatial", subplot_type = "box") image

lfranzen commented 2 months ago

Hi @Famingzhao,

Thank you for using semla and telling us about this issue. It is a bit hard for me to know exactly the issue without a bit more info. Which H&E image are you loading here? Do you still have the full original Spaceranger output data stored and could try to create a semla object directly instead and then transfer the Staffli object to your semla-from-Seurat object (see response to issue #25)?

We've had multiple reports of bugs around the spatial coordinates when converting a Seurat spatial object into semla, especially if subsetting has been applied to the spots in the original Seurat object. This is something we'll need to troubleshoot further, but for now I think the easiest/quickest workaround is to create a new semla object and transfer the Staffli object (containing all spatial info).

Kind regards, Lovisa

Famingzhao commented 2 months ago

Hi, Thank you for your response. I find that ReadVisiumData can solve this issue:

samples <- file.path(targetdir, "filtered_feature_bc_matrix.h5")
imgs <- file.path(targetdir, "spatial", "tissue_lowres_image.png")
spotfiles <- file.path(targetdir, "spatial", "tissue_positions_list.csv")
json <- file.path(targetdir, "spatial", "scalefactors_json.json")

infoTable <- tibble::tibble(samples, imgs, spotfiles, json)
se <- ReadVisiumData(infoTable)