细胞注释:参考映射
摘要: 通过从特征明确的参考图谱转移标签来注释细胞。使用 SingleR 进行简单投影,使用 Azimuth 进行 UMAP 引导的映射,或使用 Symphony 进行快速多参考整合。适用于存在高质量参考图谱的标准组织。
什么是参考图谱映射?
参考图谱映射 不是手动识别细胞类型,而是将注释从经过整理的图谱转移到您的查询数据中。
核心概念
您的数据(未注释) + 参考图谱(已注释) → 您的数据(已注释)

优势
| 参考图谱映射 | 手动注释 |
|---|---|
| 自动化 | 手动检查标记基因 |
| 一致性高 | 主观性强 |
| 速度快 | 耗时 |
| 全面性高 | 可能遗漏稀有类型 |
局限性
- ⚠️ 参考图谱必须包含您的细胞类型(无法发现新群体)
- ⚠️ 批次效应可能导致错误映射
- ⚠️ 质量取决于参考图谱的质量
何时使用参考图谱映射
✅ 适用于:
- 标准组织(PBMC、肺、脑、肿瘤微环境)
- 与已发表图谱进行验证
- 多样本的高通量注释
- 跨研究整合
❌ 避免在以下情况使用:
- 预期存在新细胞类型
- 参考图谱来自不同物种/技术平台
- 样本量小(参考信号可能淹没查询信号)
主要参考数据库
人类细胞图谱 (HCA)
链接: data.humancellatlas.org
内容: 涵盖 40+ 种组织的约 1 亿个细胞
最佳用途: 跨组织注释、发育生物学
CellxGene (Chan Zuckerberg Initiative)
链接: cellxgene.cziscience.com
内容: 带有交互式浏览器的精选单细胞数据集
最佳用途: 寻找组织特异性参考图谱、探索性分析
Azimuth 参考图谱 (Seurat)
链接: azimuth.hubmapconsortium.org
内容: 针对 PBMC、肺、肾、运动皮层等的优化参考图谱
最佳用途: 与 Seurat/Azimuth 工作流配合即用
其他资源
| 数据库 | 重点 | URL |
|---|---|---|
| HuBMAP | 人类组织图谱 | hubmapconsortium.org |
| Tabula Sapiens | 人类器官 | tabula-sapiens-portal.ds.czbiohub.org |
| Tabula Muris | 小鼠器官 | tabula-muris.ds.czbiohub.org |
| PanglaoDB | 聚合数据库 | panglaodb.se |
方法一:SingleR(简单快速)
最佳用途: 快速注释、Bioconductor 工作流
安装
BiocManager::install("SingleR")
BiocManager::install("celldex") # 参考数据集
基本用法
library(SingleR)
library(celldex)
# 加载参考图谱(内置)
ref <- HumanPrimaryCellAtlasData()
# 注释您的 Seurat/SingleCellExperiment 对象
predictions <- SingleR(
test = as.SingleCellExperiment(pbmc),
ref = ref,
labels = ref$label.main
)
# 添加到 Seurat 对象
pbmc$SingleR_labels <- predictions$labels
pbmc$SingleR_scores <- predictions$scores
# 可视化
DimPlot(pbmc, group.by = "SingleR_labels", label = TRUE)
可用参考图谱
# 列出可用参考图谱
celldex::listReferences()
# 常用参考图谱
ref_immune <- ImmGenData() # 小鼠免疫细胞
ref_encode <- BlueprintEncodeData() # 人类免疫/批量数据
ref_monaco <- MonacoImmuneData() # 人类 PBMC
ref_hpca <- HumanPrimaryCellAtlasData() # 泛组织人类数据
精细标签与粗略标签
# 分层注释
predictions_fine <- SingleR(
test = sce,
ref = ref,
labels = ref$label.fine # 详细标签
)
predictions_coarse <- SingleR(
test = sce,
ref = ref,
labels = ref$label.main # 宽泛类别
)
方法二:Azimuth(基于 UMAP)
最佳用途: 用户友好的 Web 界面、Seurat 整合
Web 界面(无需编码)
- 访问 azimuth.hubmapconsortium.org
- 选择参考图谱(PBMC、肺、肾等)
- 上传 Seurat 对象 (.rds) 或计数矩阵
- 下载注释结果
R 工作流
library(Seurat)
library(Azimuth)
# 安装参考图谱
InstallData("pbmcref")
# 运行 Azimuth
pbmc <- RunAzimuth(pbmc, reference = "pbmcref")
# 查看转移的标签
DimPlot(pbmc, group.by = "predicted.celltype.l2", label = TRUE)
# 检查置信度分数
FeaturePlot(pbmc, features = "predicted.celltype.l2.score")
可用的 Azimuth 参考图谱
| 参考图谱 | 组织 | 分辨率 |
|---|---|---|
| pbmcref | PBMC | 3 个层级 (L1, L2, L3) |
| lungref | 肺 | 细胞状态 + 亚型 |
| kidneyref | 肾 | 发育 + 成年 |
| motorcortexref | 脑 | 神经元亚型 |
| pancreas | 胰腺 | 内分泌 + 外分泌 |
方法三:Symphony(快速多参考整合)
最佳用途: 大型数据集、批次整合、多参考图谱
安装
devtools::install_github("immunogenomics/symphony")
构建参考图谱
library(symphony)
# 从 Seurat 对象构建
ref_obj <- buildReferenceFromSeurat(
seurat_obj,
verbose = TRUE,
do_normalize = TRUE,
do_umap = TRUE
)
# 保存以供重用
saveRDS(ref_obj, "my_reference.rds")
映射查询数据
# 加载参考图谱
ref <- readRDS("my_reference.rds")
# 映射查询数据
query_mapped <- mapQuery(
exp_query = query_seurat,
ref_obj = ref,
vars = c("batch", "donor"), # 校正批次效应
verbose = TRUE
)
# 转移标签
query_seurat$predicted_celltype <- query_mapped$meta_data$cell_type
方法四:Seurat v5 参考图谱映射
转移标签
library(Seurat)
# 在查询和参考数据间寻找锚点
anchors <- FindTransferAnchors(
reference = reference_seurat,
query = query_seurat,
dims = 1:30,
reference.reduction = "pca"
)
# 转移细胞类型标签
predictions <- TransferData(
anchorset = anchors,
refdata = reference_seurat$celltype,
dims = 1:30
)
query_seurat$predicted_celltype <- predictions$predicted.id
query_seurat$prediction_score <- predictions$prediction.score.max
# 可视化
DimPlot(query_seurat, group.by = "predicted_celltype", label = TRUE)
VlnPlot(query_seurat, features = "prediction_score", group.by = "predicted_celltype")
转移 UMAP 嵌入
# 将查询数据投影到参考 UMAP 上
query_seurat <- MapQuery(
anchorset = anchors,
reference = reference_seurat,
query = query_seurat,
refdata = list(celltype = "celltype"),
reference.reduction = "pca",
reduction.model = "umap"
)
# 在参考 UMAP 上绘图
DimPlot(query_seurat, reduction = "ref.umap", group.by = "predicted.celltype")
预测结果的质量控制
检查置信度分数
# SingleR
hist(predictions$scores, main = "Prediction Scores")
# Azimuth/Seurat
VlnPlot(pbmc, features = "predicted.celltype.score", pt.size = 0)
# 标记低置信度预测
pbmc$confident <- pbmc$predicted.celltype.score > 0.5
table(pbmc$confident)
比较不同方法
# 运行多种方法
pbmc$singleR <- singleR_predictions$labels
pbmc$azimuth <- azimuth_predictions
pbmc$seurat <- seurat_predictions
# 混淆矩阵
table(SingleR = pbmc$singleR, Azimuth = pbmc$azimuth)
# 共识注释(所有方法一致)
pbmc$consensus <- ifelse(
pbmc$singleR == pbmc$azimuth & pbmc$azimuth == pbmc$seurat,
pbmc$singleR,
"Ambiguous"
)
使用标记基因验证
# 检查预测的 T 细胞是否表达 CD3D
VlnPlot(pbmc, features = "CD3D", group.by = "predicted.celltype")
# 按预测类型检查经典标记基因
markers_to_check <- c("CD3D", "CD14", "MS4A1", "NKG7")
DotPlot(pbmc, features = markers_to_check, group.by = "predicted.celltype")
进阶:跨模态映射
ATAC-seq 到 RNA-seq
library(Signac)
# 寻找转移锚点 (ATAC → RNA)
anchors <- FindTransferAnchors(
reference = rna_seurat,
query = atac_seurat,
reduction = "cca",
features = VariableFeatures(rna_seurat)
)
# 转移标签
predictions <- TransferData(
anchorset = anchors,
refdata = rna_seurat$celltype,
weight.reduction = atac_seurat[["lsi"]]
)
atac_seurat$predicted_celltype <- predictions$predicted.id
多组学整合 (CITE-seq)
# 从参考数据转移蛋白表达
protein_predictions <- TransferData(
anchorset = anchors,
refdata = GetAssayData(reference, assay = "ADT"),
weight.reduction = "pca"
)
query[["ADT_predicted"]] <- CreateAssayObject(data = protein_predictions)
故障排除
预测分数低
原因:
- 参考图谱不包含您的细胞类型
- 查询与参考数据间存在批次效应
- 数据质量差
解决方法:
# 尝试不同的参考图谱
# 或使用更宽松的阈值
predictions_filtered <- predictions[predictions$scores > 0.3, ]
稀有类型注释错误
原因: 参考图谱缺乏稀有群体
解决方法: 结合参考图谱映射与手动整理:
# 自动注释常见类型,手动检查稀有聚类
pbmc$final_celltype <- pbmc$predicted.celltype
pbmc$final_celltype[pbmc$seurat_clusters == 12] <- "Manual: Rare Type"
参考图谱差异过大(物种、技术平台)
解决方法: 使用基于同源性的工具:
# 将小鼠基因转换为人类基因
library(orthogene)
converted <- convert_orthologs(gene_df, gene_input = "rownames",
input_species = "mouse",
output_species = "human")
方法比较
| 方法 | 速度 | 准确性 | 整合性 | 最佳用途 |
|---|---|---|---|---|
| SingleR | 快 | 高 | Bioconductor | 快速注释 |
| Azimuth | 中等 | 非常高 | Seurat | 用户友好、高质量参考图谱 |
| Symphony | 非常快 | 高 | Harmony 基础 | 大型队列、多批次 |
| Seurat Transfer | 中等 | 高 | Seurat | 自定义参考图谱 |
资源
- SingleR 教程: bioconductor.org/packages/SingleR
- Azimuth 应用: azimuth.hubmapconsortium.org
- Symphony 论文: Nature Commun 2021
- 参考图谱映射综述: Cell 2024
另请参阅: