PRECAST: simulation

Wei Liu

2022-07-11

Generate the simulated data

First, we generate the multiple spatial transcriptomics data with lattice neighborhood, i.e. ST platform by using the function gendata_seulist in PRECAST package.

library(Seurat)
library(PRECAST)
seuList <- gendata_seulist(height1=20, width1=20, height2=24, width2=25,p=200, K=4, alpha=20, sigma2=0.1)
seuList
head(seuList[[1]]) 
## Must include the columns named "row" and "col" for saving the spatial coordinates

Fit PRECAST using simulated data

Prepare the PRECASTObject with preprocessing step.

Add the model setting

Fit PRECAST

For function PRECAST, users can specify the number of clusters \(K\) or set K to be an integer vector by using modified BIC(MBIC) to determine \(K\). First, we try using user-specified number of clusters. For convenience, we give a single K here.

Select a best model and use ARI to check the performance of clustering

Integrate the two samples by the function IntegrateSpaData.

Show the spatial scatter plot for clusters

Show the spatial UMAP/tNSE RGB plot

Show the tSNE plot based on the extracted features from PRECAST to check the performance of integration.

Show the UMAP plot based on the extracted features from PRECAST.

Users can also use the visualization functions in Seurat package:

Combined differential expression analysis

Session information

sessionInfo()