单细胞分析|映射和注释查询数据集

reference映射简介

在本文中,我们首先构建一个reference,然后演示如何利用该reference来注释新的查询数据集。生成后,该reference可用于通过cell类型标签传输和将查询cell投影到reference UMAP 等任务来分析其他查询数据集。值得注意的是,这不需要纠正底层原始查询数据,因此如果有高质量的reference可用,这可能是一种有效的策略。

数据集预处理

出于本示例的目的,我们选择了通过四种技术生成的人类胰岛细胞数据集:CelSeq (GSE81076) CelSeq2 (GSE85241)、Fluidigm C1 (GSE86469) 和 SMART-Seq2 (E-MTAB-5061)。为了方便起见,我们通过 SeuratData 包分发此数据集。元数据包含四个数据集中每个细胞的技术(技术列)和细胞类型注释(细胞类型列)。

library(Seurat)
library(SeuratData)
library(ggplot2)

InstallData("panc8")

作为演示,我们将使用各种技术来构建参考。然后,我们将剩余的数据集映射到该参考上。我们首先从四种技术中选择cell,并在不进行整合的情况下进行分析。

接下来,我们将数据集整合到reference中。

pancreas.ref <- IntegrateLayers(object = pancreas.ref, method = CCAIntegration, orig.reduction = "pca",
    new.reduction = "integrated.cca", verbose = FALSE)
pancreas.ref <- FindNeighbors(pancreas.ref, reduction = "integrated.cca", dims = 1:30)
pancreas.ref <- FindClusters(pancreas.ref)
## Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
## 
## Number of nodes: 4679
## Number of edges: 190152
## 
## Running Louvain algorithm...
## Maximum modularity in 10 random starts: 0.8680
## Number of communities: 15
## Elapsed time: 0 seconds

pancreas.ref <- RunUMAP(pancreas.ref, reduction = "integrated.cca", dims = 1:30)
DimPlot(pancreas.ref, group.by = c("tech", "celltype"))

使用整合后的reference进行细胞类型分类

Seurat 还支持将参考数据(或元数据)投影到查询对象上。虽然许多方法都是保守的(两个过程都从识别锚点开始),但数据传输和集成之间有两个重要区别:

  1. 在数据传输中,Seurat 不会更正或修改查询表达式数据。
  2. 在数据传输中,Seurat 有一个选项(默认设置)将引用的 PCA 结构投影到查询上,而不是使用 CCA 学习联合结构。我们通常建议在 scRNA-seq 数据集之间投影数据时使用此选项。

找到锚点后,我们使用 TransferData() 函数根据参考数据(参考单元类型标签的向量)对查询cell进行分类。 TransferData() 返回一个包含预测 ID 和预测分数的矩阵,我们可以将其添加到查询元数据中。

# select two technologies for the query datasets
pancreas.query <- subset(panc8, tech %in% c("fluidigmc1", "celseq"))
pancreas.query <- NormalizeData(pancreas.query)
pancreas.anchors <- FindTransferAnchors(reference = pancreas.ref, query = pancreas.query, dims = 1:30,
    reference.reduction = "pca")
predictions <- TransferData(anchorset = pancreas.anchors, refdata = pancreas.ref$celltype, dims = 1:30)
pancreas.query <- AddMetaData(pancreas.query, metadata = predictions)

因为我们拥有来自完整整合分析的原始标签注释,所以我们可以评估预测的细胞类型注释与完整参考的匹配程度。

在此示例中,我们发现细胞类型分类具有很高的一致性,超过 96% 的细胞被正确标记。

pancreas.query$prediction.match <- pancreas.query$predicted.id == pancreas.query$celltype
table(pancreas.query$prediction.match)
## 
## FALSE  TRUE 
##    63  1579

为了进一步验证这一点,我们可以检查特定胰岛细胞群的一些典型细胞类型标记。请注意,即使其中一些细胞类型仅由一个或两个细胞(例如 epsilon 细胞)代表,我们仍然能够正确对它们进行分类。

table(pancreas.query$predicted.id)
## 
##             acinar activated_stellate              alpha               beta 
##                262                 39                436                419 
##              delta             ductal        endothelial              gamma 
##                 73                330                 19                 41 
##         macrophage               mast            schwann 
##                 15                  2                  6

VlnPlot(pancreas.query, c("REG1A", "PPY", "SST", "GHRL", "VWF", "SOX10"), group.by = "predicted.id")

UMAP 投影

我们还支持将查询投影到参考 UMAP 结构上。这可以通过计算参考 UMAP 模型然后调用 MapQuery() 而不是 TransferData() 来实现。

pancreas.ref <- RunUMAP(pancreas.ref, dims = 1:30, reduction = "integrated.cca", return.model = TRUE)
pancreas.query <- MapQuery(anchorset = pancreas.anchors, reference = pancreas.ref, query = pancreas.query,
    refdata = list(celltype = "celltype"), reference.reduction = "pca", reduction.model = "umap")

p1 <- DimPlot(pancreas.ref, reduction = "umap", group.by = "celltype", label = TRUE, label.size = 3,
    repel = TRUE) + NoLegend() + ggtitle("Reference annotations")
p2 <- DimPlot(pancreas.query, reduction = "ref.umap", group.by = "predicted.celltype", label = TRUE,
    label.size = 3, repel = TRUE) + NoLegend() + ggtitle("Query transferred labels")
p1 + p2
  • 4
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在R语言中,对单细胞数据进行注释可以使用许多不同的包和方法。以下是一些常用的注释方法: 1. 使用SingleR包:SingleR包是一个用于单细胞RNA测序数据注释的软件包。它通过将单细胞数据与基准参考数据进行比较,来预测每个单细胞样本的细胞类型。你可以使用SingleR包中的`SingleR`函数来进行注释。首先,你需要准备一个基准参考数据集,然后使用`SingleR`函数将单细胞数据与该参考数据集进行比较。 2. 使用scmap包:scmap包是另一个用于单细胞数据注释的软件包。它也是通过将单细胞数据与参考数据进行比较来预测每个单细胞样本的细胞类型。你可以使用scmap包中的`scmapCluster`函数来进行注释。首先,你需要准备一个参考数据集,然后使用`scmapCluster`函数将单细胞数据映射到参考数据集上。 3. 使用SingleCellExperiment包:SingleCellExperiment包是一个用于存储和分析单细胞RNA测序数据的通用框架。你可以使用该包中提供的方法来进行单细胞数据的注释。例如,你可以使用`reducedDims`函数对单细胞数据进行降维,然后使用`cluster`函数对降维后的数据进行聚类,最后使用`annotate`函数将聚类结果注释为细胞类型。 这些是一些常用的单细胞数据注释方法,你可以根据具体的需求选择合适的方法进行注释。当然,还有其他的包和方法可供选择,具体选择哪个方法取决于你的数据和研究问题。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值