Moving from SpatialExperiment to Seurat: Transferring the spatial coordinates #8671
Unanswered
BasMatsuura
asked this question in
Q&A
Replies: 1 comment
-
Hi, Any luck with any solutions? I'm using the same dataset and trying to do the same thing, convert the SpatialExperiment object to Seurat. Thanks for any help! Best, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Dear all,
Recently I started working with the SpatialExperiment and Seurat object formats. So I am not very experienced in the topic. I downloaded spatial genomics data from an Alzheimer's diseased subject using the 'spatialLIBD' package by the Lieber Institute. This file came as a SpatialExperiment object. From it I managed to extract both the count matrix and spatial coordinates. Then I started following this workflow: https://satijalab.org/seurat/articles/spatial_vignette. From it I learned that I needed to transform the SpatialExperiment into a Seurat object. This I did using the following code:
Download the data
spe <- spatialLIBD::fetch_data(type = "Visium_SPG_AD_Visium_wholegenome_spe")
Subset a specific sample
spe_D1_Br3880 <- spe[, spe$sample_id == "V10A27106_D1_Br3880"]
Extract the count matrix
spe_D1_Br3880_data <- assay(spe_D1_Br3880, "counts")
Transform into a Seurat object.
spe_D1_Br3880_data <- CreateSeuratObject(counts = spe_D1_Br3880_data)
Now, my question has to do with the spatial coordinates. The code above does not appear to add them to the object. This occurred to me when making a function call like:
Attempt to visualize RunUMAP output
p2 <- SpatialDimPlot(spe_D1_Br3880_umap, label = TRUE, label.size = 3)
Similarly I run into errors when trying to identify spatially variable genes:
FindSpatiallyVariableFeatures(spe_D1_Br3880_seurat_umap, assay = "SCT", features = VariableFeatures(spe_D1_Br3880_seurat_umap)[1:1000],
selection.method = "moransi")
Are there ways to all relevant information from my original SpatialExperiment object so I can continue the workflow provided in the link given above? For all information in the SpatialExperiment to be transferred into the newly created Seurat object, if you will. I tried using the Load10X_Spatial() function as was advised in another thread. But it wasn't straightforward how to load the object downloaded by spatialLIBD::fetch_data using that function. It started throwing a bunch of errors.
Best,
Bas
Beta Was this translation helpful? Give feedback.
All reactions