美文网首页r
Seurat——Mapping and annotating q

Seurat——Mapping and annotating q

作者: 重拾生活信心 | 来源:发表于2022-04-15 15:50 被阅读0次

Mapping and annotating query datasets • Seurat (satijalab.org)

1 Introduction to single-cell reference mapping

2Dataset preprocessing

数据:SeuratData package
human pancreatic islet cell datasets produced across four technologies,
CelSeq (GSE81076)
CelSeq2 (GSE85241)
Fluidigm C1 (GSE86469)
SMART-Seq2 (E-MTAB-5061)

metadata里包含technology(tech column)和cell type(celltype column)

split.by="tech" 分离整合在一起的四个不同技术结果。
NomalizeData()
FindVariableFeatures()

library(Seurat)
library(SeuratData)
InstallData("panc8")
data("panc8")

pancreas.list <- SplitObject(panc8, split.by = "tech")
pancreas.list <- pancreas.list[c("celseq", "celseq2", "fluidigmc1", "smartseq2")]

for (i in 1:length(pancreas.list)) {
    pancreas.list[[i]] <- NormalizeData(pancreas.list[[i]], verbose = FALSE)
    pancreas.list[[i]] <- FindVariableFeatures(pancreas.list[[i]], selection.method = "vst", nfeatures = 2000,
        verbose = FALSE)
}

3 Integration of 3 pancreatic islet cell datasets

FindIntegrationAnchors()
IntegrateData()

确定anchors,整合三个objects作为reference,使用另一个作为query dataset 以演示mapping。

IntegrateData()返回一个Seuratobject,包含一个新assay(integrated)

返回的对象将包含一个新的分析,该分析保存所有细胞的集成(或“批量校正”)表达矩阵,使它们能够被联合分析。

reference.list <- pancreas.list[c("celseq", "celseq2", "smartseq2")]
pancreas.anchors <- FindIntegrationAnchors(object.list = reference.list, dims = 1:30)
pancreas.integrated <- IntegrateData(anchorset = pancreas.anchors, dims = 1:30)
library(ggplot2)
library(cowplot)
library(patchwork)
# switch to integrated assay. The variable features of this assay are automatically set during
# IntegrateData
DefaultAssay(pancreas.integrated) <- "integrated"
# Run the standard workflow for visualization and clustering
pancreas.integrated <- ScaleData(pancreas.integrated, verbose = FALSE)
pancreas.integrated <- RunPCA(pancreas.integrated, npcs = 30, verbose = FALSE)
pancreas.integrated <- RunUMAP(pancreas.integrated, reduction = "pca", dims = 1:30, verbose = FALSE)
p1 <- DimPlot(pancreas.integrated, reduction = "umap", group.by = "tech")
p2 <- DimPlot(pancreas.integrated, reduction = "umap", group.by = "celltype", label = TRUE, repel = TRUE) +
    NoLegend()
p1 + p2

4 Cell type classification using an integrated reference

Transferdata()根据reference对query dataset 进行分类,返回包含预测ID和预测scores的矩阵,可以添加到query metadata.

pancreas.query <- pancreas.list[["fluidigmc1"]]
pancreas.anchors <- FindTransferAnchors(reference = pancreas.integrated, query = pancreas.query,
    dims = 1:30, reference.reduction = "pca")
predictions <- TransferData(anchorset = pancreas.anchors, refdata = pancreas.integrated$celltype,
    dims = 1:30)
pancreas.query <- AddMetaData(pancreas.query, metadata = predictions)

比较original label annotation 和预测到的。

pancreas.query$prediction.match <- pancreas.query$predicted.id == pancreas.query$celltype
table(pancreas.query$prediction.match)

为了进一步验证对比的结果,我们可以检查特定胰岛细胞群的一些典型细胞类型标记。即使其中一些细胞类型仅含一个或两个细胞(例如epsilon细胞)表示,仍然能够正确地对它们进行分类。
(在预测到的细胞类型中看marker的表达)

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

5 Unimodal UMAP Projection

pancreas.integrated <- RunUMAP(pancreas.integrated, dims = 1:30, reduction = "pca", return.model = TRUE)
pancreas.query <- MapQuery(anchorset = pancreas.anchors, reference = pancreas.integrated, query = pancreas.query,
    refdata = list(celltype = "celltype"), reference.reduction = "pca", reduction.model = "umap")
p1 <- DimPlot(pancreas.integrated, 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

相关文章

网友评论

    本文标题:Seurat——Mapping and annotating q

    本文链接:https://www.haomeiwen.com/subject/bozfertx.html