edward130603 / BayesSpace

Bayesian model for clustering and enhancing the resolution of spatial gene expression experiments.
http://edward130603.github.io/BayesSpace
Other
96 stars 20 forks source link

seurat_cluster_DE function #123

Open mtrussart opened 1 month ago

mtrussart commented 1 month ago

Hi,

I was looking into the vignette script you provided for the Thrane melanoma dataset and especially how to do the DE analysis using the seurat_cluster_DE function (http://www.ezstatconsulting.com/BayesSpace/articles/ji_SCC.html). I would like to know if with the updated version of Seurat whether the "sobj@assays$Spatial@data" is now replaced by sobj@assays$Spatial@counts?

Thanks a lot, Marie

edward130603 commented 1 month ago

Hi Marie, the counts slot in SingleCellExperiment and counts layer in Seurat are the same. Same for the logcounts slot in SCE and data layer in Seurat. Since we are using the normalized data (logcounts) for DE analysis, it should still be @data I believe. Hope that answers your question. If not, let me know the specific line of code or error/warning message you are getting. -Edward

mtrussart commented 1 month ago

Hi Edward, thanks for your fast reply. Yes I get an error with the @data of seurat@assays$Spatial@data in the seurat_cluster_DE function as there is no such data in the Spatial assay but instead a counts defined at the beginning of the function : seurat <- Seurat::[CreateSeuratObject]((counts=logcounts, assay='Spatial',meta.data=as.data.frame)

As far as I understand, the @data argument is created within the Seurat normalisation function but in this case you don't apply this normalisation, rather the counts assay is defined as the logcounts of the sce and then the DE is performed on those. If that's correct, then the sobj@assays$Spatial@data should be replaced by sobj@assays$Spatial@counts, right?

Thanks a lot, Marie

edward130603 commented 1 month ago

Yes, sorry for the mistake, thanks for pointing it out! We will need to update our vignettes.

You can set the counts slot of the Seurat object to be the same as the counts slot of the SCE, and then apply Seurat normalization to generate the data slot before running the marker detection function.