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

Running BayesSpace in multiple capture areas #121

Open Mireiaandueza opened 3 months ago

Mireiaandueza commented 3 months ago

Hello,

We are analyzing Spatial Transcriptomics data from Visium 10X Genomics data, and we have multiple capture areas. We want to enhance our whole dataset with BayesSpace, but as it takes spatial coordinates into account we have run each capture area separately. We are now trying to merge the enhanced data matrices into a big Seurat object. Does this approach make sense?

Also, when merging and normalizing whole the dataset (LogNormalize) we get a UMAP with a clear artifact (I attach below), does this have to do with the BayesSpace normalization?

Thank you very much,

Best,

Mireia clustering_0.2.pdf

edward130603 commented 3 months ago

Hi Mireia, BayesSpace uses a normalization method very similar to LogNormalize. I might need some more info to figure out the issue.

Mireiaandueza commented 3 months ago

Hi Edward,

Thanks for your rapid answer! I answer to your questions below, also I attach part of the code for you to make a better idea of what we are trying to do.

- For the artifact, are you saying you have 42 capture areas in this study?

The color labels on the plot correspond to the clustering of Seurat FindClusters() after merging all enhanced datasets and running normalization, dimension reduction and clustering on the data.

- Do your color labels here represent different capture areas or clusters?

They represent clusters, as written above.

- Did you run PCA on each capture area separately and then combine the data together later?

When doing the merge to all datasets we run PCA to the combined data, but as you suggest, maybe PCA run by BayesSpace on each capture area could be interfering?

- Is there any spatial or cell type pattern to the halo of small clusters in the periphery?

We do not identify a cell type pattern that could correspond to the biology of or samples, and we did not see this halo in the UMAP of our original (non enhanced) data. We see this halo after running BayesSpace on a capture area, enhancing the expression of the whole matrix, and then running UMAP, I show you part of the code below, just for one slide:

_#Convert to SCE diet.seurat = Seurat::DietSeurat(ST) #ST is the seurat object for Visium 10X Genomics data for one capture area sce = as.SingleCellExperiment(diet.seurat) colData(sce) = cbind(colData(sce),ST@images[[slide]]@coordinates) sce <- spatialPreprocess(sce,platform = "Visium", n.PCs = 50, log.normalize = T)
sce <- spatialCluster(sce, nrep = 1000, burn.in = 100, q = n_cluster )

ENHANCED RESOLUTION OF CLUSTERS

sce.enhanced <- spatialEnhance(sce, q= n_cluster, 
                                model="t", gamma=2,
                                jitter_prior=0.3, jitter_scale=3.5,
                                nrep=1000, burn.in=100)

ENHANCED RESOLUTION OF MARKERS

markers <- rownames(ST)
sce.enhanced <- enhanceFeatures(sce.enhanced, sce,
                                 feature_names=markers,
                                 nrounds=0)

Convert to Seurat

ST <- as.Seurat(sce.enhanced, counts = NULL, data = "logcounts", project = "Spatial")
ST <- RunUMAP(ST, reduction = "PCA", dim = 1:30)

Plot for one gene

p1 <- FeaturePlot(ST, reduction = "umap", label = TRUE, feature = "Agr2") p1_

We thought that this halo was due to the merge, but it happens on each slide individually (I attach output for previous code for one slide).umap.pdf

- Did your data come from multiple batches? If your data comes from multiple batches, you may need to do batch correction

We do not believe that this could be affected by batch effect, as individual samples contain this halo mentioned above.

Do you expect the logcounts matrix from enhanced BayesSpace to have this shape in a UMAP? Maybe the way the software infers the subspot expression might have something to do with it?

Thanks in advance,

Best,

Mireia