BayesSpace icon indicating copy to clipboard operation
BayesSpace copied to clipboard

error in joint clustering

Open BhardwajArch opened this issue 2 years ago • 1 comments

Hello I am working on multiple samples of visium spatial transcriptome data.

**-> Raw data was analysed in the space ranger and stored in the seurat object list.

Next to remove batch effect ,used PrepSCTIntegration method for Spatial data.**

library(SingleCellExperiment) library(ggplot2) library(BayesSpace)

object.list # object list object.list <- PrepSCTIntegration(object.list = object.list, anchor.features = st.features, verbose = FALSE)

int.anchors <- FindIntegrationAnchors(object.list = object.list, normalization.method = "SCT", verbose = FALSE, anchor.features = st.features)

st.integrated <- IntegrateData(anchorset = int.anchors, normalization.method = "SCT", verbose = TRUE)

st.integrated <- RunPCA(st.integrated, verbose = FALSE)

ss.integrated <- st.integrated

-> For the joint analysis in Bayespace, I changed the seurat object list into sce object list

ss_list <- SplitObject(ss.integrated, split.by = "orig.ident")

A1<- st_list$A1

#Convert to SCE diet.seurat = Seurat::DietSeurat(A1, graphs = "pca") #slim down Seurat obj prior to conversion sceA = as.SingleCellExperiment(diet.seurat, assay = "SCT") #convert seurat to SCE colData(sceA) = cbind(colData(sceA), A1@images$A1@coordinates) #add spatial info to SCE

B1 <- st_list$B1

#Convert to SCE diet.seurat = Seurat::DietSeurat(B1, graphs = "pca") #slim down Seurat obj prior to conversion sceB = as.SingleCellExperiment(diet.seurat, assay = "SCT") #convert seurat to SCE colData(sceB) = cbind(colData(sceB), B1@images$B1@coordinates) #add spatial info to SCE

sce.combined = cbind(sce, sceB, deparse.level = 1)

sce.combined = spatialPreprocess(sce.combined, platform = "Visium", skip.PCA = T, log.normalize = F)

clusterPlot(sce.combined)

It gives me clusters for one image instead of two imaging data.

I would appreciate all the suggestions

BhardwajArch avatar Mar 09 '22 12:03 BhardwajArch

Sorry for the delayed response. I think the issue is because you need to offset the row and/or col values first. The first code chunk under the "Clustering" header in our vignette describes how to do this. Let me know if you run into further issues.

edward130603 avatar Mar 15 '22 05:03 edward130603