> 作者 (author): LKP <kunpeng.liao@abiosciences.com>
> Skill 及脚本参数来源: Chen et al., 2025, Cancer Cell 43, 1656–1676, <https://doi.org/10.1016/j.ccell.2025.06.020>
基因程序/基因集打分方法合集
四套打分方法的实现与选用原则(均在本项目实际使用)。
1. AddModuleScore(Seurat 内置,快)
# 适用:常规基因集打分(PNI 34基因、EMT 187基因、12个恶性模块)
obj <- AddModuleScore(obj, features = list(gene_set), ctrl = 1000, seed = 2023,
name = "program_score")
# 多模块:features = gene_list(named list),每模块一个打分列
# 小特征集回退:ctrl = min(1000, valid_features),再失败 ctrl = min(100, valid_features)
2. AUCell(排名法,阈值稳健)
library(AUCell)
rankings <- AUCell_buildRankings(as.matrix(GetAssayData(obj, layer = "data")),
plotStats = FALSE, nCores = 1)
auc <- AUCell_calcAUC(geneSets = author_sets, rankings = rankings,
aucMaxRank = floor(nrow(rankings) * 0.1), # 前10%基因
nCores = 1)
scores <- t(as.data.frame(getAUC(auc))) # 基因集 × 细胞
# 适用:基因集较大(>=5 基因,交集后保底)且需要跨细胞可比排名
3. PROGENy 通路活性(decoupleR MLM)
library(progeny); library(decoupleR)
# decoupleR 2.12 的 get_progeny 依赖 OmnipathR 常失败,用 progeny 本地模型:
model <- progeny::getModel("Human", top = 500) # 每通路 top500 权重基因
net <- reshape2::melt(as.matrix(model), varnames = c("target", "source"))
net <- net[net$value != 0, ]; names(net) <- c("target", "source", "weight")
act <- run_mlm(mat = expr_matrix, net = net,
.source = "source", .target = "target", .mor = "weight", minsize = 5)
# z-score 后按细胞类型求均值热图:t(scale(t(score_mat)))
4. irGSEA(多方法整合,UMAP 投射)
library(irGSEA)
res <- irGSEA.score(object = obj, assay = "RNA", slot = "data",
seeds = 123, ncores = 1,
min.cells = 3, min.feature = 0,
custom = FALSE, geneset = NULL,
msigdb = TRUE, species = "Homo sapiens",
category = "H", subcategory = NULL, # Hallmark
geneid = "symbol",
method = c("AUCell"), # 单方法 AUCell
aucell.MaxRank = NULL, kcdf = "Gaussian")
irGSEA.density.scatterplot(object = res,
show.geneset = "HALLMARK-EPITHELIAL-MESENCHYMAL-TRANSITION",
reduction = "umap")
# 失败回退:AddModuleScore 打分后 FeaturePlot
方法选择原则
| 方法 | 适用场景 | 关键参数 |
|---|---|---|
| AddModuleScore | 快速筛查、模块多 | ctrl=1000, seed=2023 |
| AUCell | 基因集大、需排名语义 | aucMaxRank=10%基因数 |
| PROGENy | 信号通路活性(11通路) | getModel top=500, run_mlm minsize=5 |
| irGSEA | Hallmark 全景 + UMAP 展示 | method="AUCell", category="H" |
常见坑
- AddModuleScore ctrl 池:特征少时 ctrl=1000 可能报错,按 valid_features 自适应
- AUCell 输入 data 层:不是 counts;nCores=1 防 Windows 崩
- PROGENy 别用 decoupleR 内置 get_progeny:OmnipathR 网络依赖不稳,progeny::getModel 本地化
- 基因集与行名先 intersect:不存在的基因静默丢弃,记录实际用上多少
- 模块打分跨亚群比较:打分前确认同一 assay/层与同一 scale 基准