STUtility
STUtility copied to clipboard
How to run TransferData from single cell RNA from seurat object?
Hi, thanks for your great tools. I have a problem to use it, How to run TransferData from single cell RNA from seurat object( with SCT method or normal method )?
You should be able to follow the Seurat spatial vignette to obtain cell type prediction scores.
[library](https://rdrr.io/r/base/library.html)([dplyr](https://dplyr.tidyverse.org/))
singlecell_reference <- [SCTransform](https://satijalab.org/seurat/reference/SCTransform.html)(singlecell_reference , ncells = 3000, verbose = FALSE) %>%
[RunPCA](https://satijalab.org/seurat/reference/RunPCA.html)(verbose = FALSE) %>%
[RunUMAP](https://satijalab.org/seurat/reference/RunUMAP.html)(dims = 1:30)
Prepare Visium data set
# Normalize Visium data
visium.se <- [SCTransform](https://satijalab.org/seurat/reference/SCTransform.html)(visium.se, verbose = FALSE) %>%
[RunPCA](https://satijalab.org/seurat/reference/RunPCA.html)(verbose = FALSE)
Predict cell types in the Visium dataset
anchors <- [FindTransferAnchors](https://satijalab.org/seurat/reference/FindTransferAnchors.html)(reference = singlecell_reference, query = visium.se, normalization.method = "SCT")
predictions.assay <- [TransferData](https://satijalab.org/seurat/reference/TransferData.html)(anchorset = anchors, refdata = singlecell_reference$celltype, prediction.assay = TRUE,
weight.reduction = cortex[["pca"]], dims = 1:30)
visium.se[["predictions"]] <- predictions.assay
Now you should be ab le to visualize cell type predictions scores with the STUtility visualization functions
ST.FeaturePlot(visium.se, features = "celltype1")