ucell的设计本意是通过cell type signature打分进行细胞注释,但一样可以用于其它gene set的打分
首先做好gene signature list,与seurat流程相整合。对每个细胞计算每个条目的得分,每个条目的得分会存储在seurat object- metadata里的列。
demo1: 简单快速用法
注意:ucell直接在count上走流程,可视化的时候才normalize scale等.但其他的demo都是先走标准流程。
library(remotes)
remotes::install_github("carmonalab/UCell")
library(UCell)
set.seed(123)
###加载示例数据集
library(GEOquery)
cached.object <- "demodata.rds"
if (!file.exists(cached.object)) {
geo_acc <- "GSE115978"
options(timeout = max(1000, getOption("timeout")))
gse <- getGEO(geo_acc)
getGEOSuppFiles(geo_acc)
exp.mat <- read.csv(sprintf("%s/GSE115978_counts.csv.gz", geo_acc), header = T,
row.names = 1, sep = ",")
saveRDS(exp.mat, cached.object)
} else {
exp.mat <- readRDS(cached.object)
}
###define gene signatures
signatures <- list(Immune = c("PTPRC"),
Macrophage = c("CTSB", "C1QB", "LAPTM5", "TYROBP", "PSAP", "C1QA", "HLA-DRA", "CTSD", "NPC2", "FCER1G"),
Tcell = c("CD3D", "CD3E", "CD3G", "CD2"),
Bcell = c("MS4A1", "CD79A", "CD79B", "CD19", "BANK1"),
Myeloid_cell = c("CD14", "LYZ", "CSF1R", "FCER1G", "SPI1", "LCK-"),
Stromal = c("MMP2", "COL1A1", "COL1A2", "COL3A1", "LUM", "DCN"))
###perform ucell
u.scores <- ScoreSignatures_UCell(exp.mat, features = signatures)
u.scores[1:8, 1:2]
###show the distrobution of the scores
library(reshape2)
library(ggplot2)
melted <- reshape2::melt(u.scores)
colnames(melted) <- c("Cell", "Signature", "