PRECAST: DLPFC Single Sample Analysis

Wei Liu

2024-03-19

This vignette introduces the PRECAST workflow for the analysis of single spatial transcriptomics dataset. The workflow consists of three steps

We demonstrate the use of PRECAST to one human dorsolateral prefrontal cortex Visium data that are here, which can be downloaded to the current working path by the following command:

githubURL <- "https://github.com/feiyoung/PRECAST/blob/main/vignettes_data/dlpfc_151672.rda?raw=true"
download.file(githubURL, "dlpfc_151672.rda", mode = "wb")

Then load to R

load("dlpfc_151672.rda")

The package can be loaded with the command:

library(PRECAST)
library(Seurat)

Compare PRECAST with DR-SC in analyzing one sample

First, we view the the spatial transcriptomics data with Visium platform.

dlpfc_151672  ## a list including two Seurat object

check the meta data that must include the spatial coordinates named “row” and “col”, respectively. If the names are not, they are required to rename them.

meta_data <- dlpfc_151672@meta.data
all(c("row", "col") %in% colnames(meta_data))  ## the names are correct!
head(meta_data[, c("row", "col")])

Prepare the PRECASTObject.

Create a PRECASTObj object to prepare for PRECAST models. Here, we only show the HVGs method to select the 2000 highly variable genes, but users are able to choose more genes or also use the SPARK-X to choose the spatially variable genes.

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\). Here, we use user-specified number of clusters.

Use the function SelectModel() to re-organize the fitted results in PRECASTObj.

Other options Users are also able to set multiple K, then choose the best one

Besides, user can also use different initialization method by setting int.model, for example, set int.model=NULL; see the functions AddParSetting() and model_set() for more details.

Put the reults into a Seurat object seuInt.

Save the spatial and tSNE scatter plots for clusters from PRECAST

Fit DR-SC and Plot the spatial and tSNE scatter plots for clusters

Compare the clustering performance of PRECAST and DR-SC.

Compare the tSNE visualiztion performance of PRECAST and DR-SC.

Session Info