单细胞数据分析中比较重要得软件seurat应该能排在前几名,我一直没有系统得学习过seurat,所以把官网上得内容进行翻译及学习。
官网链接:https://satijalab.org/seurat/articles/get_started.html
个人觉得官网得学习资源还是很全得,基本包括了目前大家要用得分析内容。
加载数据
从同一细胞同时测量多种数据类型的能力,即所谓的多模式分析,代表了单细胞基因组学的一个新的令人兴奋的前沿。例如,CITE-SEQ能够同时测量同一细胞的转录本和细胞表面蛋白。其他令人兴奋的多模式技术,如10x多组试剂盒,允许对细胞转录组和染色质可及性进行配对测量(即scRNA-seq scATAC-seq)。其他可以与细胞转录本一起测量的模式包括遗传扰动、细胞甲基组和细胞散列的标签寡聚。我们设计的Seurat4能够无缝存储、分析和探索不同的多模式单细胞数据集。
在这里,我们介绍了一个创建多模式Seurat对象并执行初始分析的流程。例如,我们演示了如何基于测量的细胞转录本对CITE-SEQ数据集进行聚类,并随后发现在每个聚类中丰富的细胞表面蛋白。我们注意到,Seurat4还支持更高级的多模式数据分析技术,特别是我们的加权最近邻(WNN)方法的应用,该方法支持基于两种模式的加权组合同时对单元进行聚类,您可以在此处探索此功能。
在这里,我们分析了8,617个脐带血单个核细胞(CBMC)的数据集,其中转录测量与11种表面蛋白的丰度估计相匹配,其水平通过DNA条形码抗体进行量化。
首先,我们加载两个计数矩阵:一个用于RNA测量,另一个用于抗体衍生标签(ADT)。您可以在此处下载ADT文件,在此处下载RNA文件
代码语言:javascript复制library(Seurat)
library(ggplot2)
library(patchwork)
# Load in the RNA UMI matrix
# Note that this dataset also contains ~5% of mouse cells, which we can use as negative
# controls for the protein measurements. For this reason, the gene expression matrix has
# HUMAN_ or MOUSE_ appended to the beginning of each gene.
cbmc.rna <- as.sparse(read.csv(file = "../data/GSE100866_CBMC_8K_13AB_10X-RNA_umi.csv.gz", sep = ",",
header = TRUE, row.names = 1))
# To make life a bit easier going forward, we're going to discard all but the top 100 most
# highly expressed mouse genes, and remove the 'HUMAN_' from the CITE-seq prefix
cbmc.rna <- CollapseSpeciesExpressionMatrix(cbmc.rna)
# Load in the ADT UMI matrix
cbmc.adt <- as.sparse(read.csv(file = "../data/GSE100866_CBMC_8K_13AB_10X-ADT_umi.csv.gz", sep = ",",
header = TRUE, row.names = 1))
# Note that since measurements were made in the same cells, the two matrices have identical
# column names
all.equal(colnames(cbmc.rna), colnames(cbmc.adt))
## [1] TRUE
构建一个Seurat对象,添加RNA和蛋白质数据
现在我们创建一个 Seurat 对象,并添加 ADT 数据作为第二个矩阵中。
构建多个不同得组学得单细胞数据,加入第二个矩阵得方法都是通用得
代码语言:javascript复制# creates a Seurat object based on the scRNA-seq data
cbmc <- CreateSeuratObject(counts = cbmc.rna)
# We can see that by default, the cbmc object contains an assay storing RNA measurement
Assays(cbmc)
代码语言:javascript复制## [1] "RNA"
代码语言:javascript复制# create a new assay to store ADT information
adt_assay <- CreateAssayObject(counts = cbmc.adt)
# add this assay to the previously created Seurat object
cbmc[["ADT"]] <- adt_assay
# Validate that the object now contains multiple assays
Assays(cbmc)
代码语言:javascript复制## [1] "RNA" "ADT"
代码语言:javascript复制# Extract a list of features measured in the ADT assay
rownames(cbmc[["ADT"]])
代码语言:javascript复制## [1] "CD3" "CD4" "CD8" "CD45RA" "CD56" "CD16" "CD10" "CD11c"
## [9] "CD14" "CD19" "CD34" "CCR5" "CCR7"
代码语言:javascript复制# Note that we can easily switch back and forth between the two assays to specify the default
# for visualization and analysis
# List the current default assay
##需要对那个矩阵就对哪个矩阵进行default,这样接下来得分析都是围绕着这个组学进行分析
DefaultAssay(cbmc)
代码语言:javascript复制## [1] "RNA"
代码语言:javascript复制# Switch the default to ADT
DefaultAssay(cbmc) <- "ADT"
DefaultAssay(cbmc)
## [1] "ADT"
##这样就更改回了蛋白得矩阵
根据细胞的scRNA-seq谱对细胞进行聚类
下面的步骤代表了根据scRNA-seq数据对PBMCs进行快速聚类的方法。关于个别步骤或更多高级选项的更多细节,请看我们的PBMC聚类指导教程。是在前面得一个教程,但是我去年就看过了,所以觉得没有分享得必要,如果没有看过得话,可以去看一下,原文链接:https://satijalab.org/seurat/articles/pbmc3k_tutorial.html
代码语言:javascript复制# Note that all operations below are performed on the RNA assay Set and verify that the
# default assay is RNA
DefaultAssay(cbmc) <- "RNA"
DefaultAssay(cbmc)
代码语言:javascript复制## [1] "RNA"
代码语言:javascript复制# perform visualization and clustering steps
cbmc <- NormalizeData(cbmc)
cbmc <- FindVariableFeatures(cbmc)
cbmc <- ScaleData(cbmc)
cbmc <- RunPCA(cbmc, verbose = FALSE)
cbmc <- FindNeighbors(cbmc, dims = 1:30)
cbmc <- FindClusters(cbmc, resolution = 0.8, verbose = FALSE)
cbmc <- RunUMAP(cbmc, dims = 1:30)
DimPlot(cbmc, label = TRUE)
将多组学数据并列可视化
现在我们已经从scRNA-seq图谱中获得了聚类,我们可以将数据集中的蛋白质或RNA分子的表达可视化。重要的是,Seurat提供了几种在不同模式间切换的方法,并指定你对分析或可视化感兴趣的模式。这一点特别重要,因为在某些情况下,同一个特征可以出现在多个模式中--例如,这个数据集包含B细胞标记物CD19的独立测量(包括蛋白质和RNA水平)。
代码语言:javascript复制# Normalize ADT data,
DefaultAssay(cbmc) <- "ADT"
cbmc <- NormalizeData(cbmc, normalization.method = "CLR", margin = 2)
DefaultAssay(cbmc) <- "RNA"
# Note that the following command is an alternative but returns the same result
cbmc <- NormalizeData(cbmc, normalization.method = "CLR", margin = 2, assay = "ADT")
# Now, we will visualize CD14 levels for RNA and protein By setting the default assay, we can
# visualize one or the other
DefaultAssay(cbmc) <- "ADT"
p1 <- FeaturePlot(cbmc, "CD19", cols = c("lightgrey", "darkgreen")) ggtitle("CD19 protein")
DefaultAssay(cbmc) <- "RNA"
p2 <- FeaturePlot(cbmc, "CD19") ggtitle("CD19 RNA")
# place plots side-by-side
p1 | p2
代码语言:javascript复制# Alternately, we can use specific assay keys to specify a specific modality Identify the key
# for the RNA and protein assays
Key(cbmc[["RNA"]])
## [1] "rna_"
Key(cbmc[["ADT"]])
## [1] "adt_"
# Now, we can include the key in the feature name, which overrides the default assay
p1 <- FeaturePlot(cbmc, "adt_CD19", cols = c("lightgrey", "darkgreen")) ggtitle("CD19 protein")
p2 <- FeaturePlot(cbmc, "rna_CD19") ggtitle("CD19 RNA")
p1 | p2
识别scRNA-seq集群的细胞表面标志物
我们可以利用我们整合的CITE-seq结果来帮助注释从scRNA-seq得出的集群,并确定蛋白质和RNA标记物。
注意:这里是在前面进行细胞marker分析之前,已经做好了细胞注释。
代码语言:javascript复制# as we know that CD19 is a B cell marker, we can identify cluster 6 as expressing CD19 on the
# surface
VlnPlot(cbmc, "adt_CD19")
代码语言:javascript复制# we can also identify alternative protein and RNA markers for this cluster through
# differential expression
adt_markers <- FindMarkers(cbmc, ident.1 = 6, assay = "ADT")
rna_markers <- FindMarkers(cbmc, ident.1 = 6, assay = "RNA")
head(adt_markers)
## p_val avg_log2FC pct.1 pct.2 p_val_adj
## CD19 2.067533e-215 1.2787751 1 1 2.687793e-214
## CD45RA 8.106076e-109 0.4117172 1 1 1.053790e-107
## CD4 1.123162e-107 -0.7255977 1 1 1.460110e-106
## CD14 7.212876e-106 -0.5060496 1 1 9.376739e-105
## CD3 1.639633e-87 -0.6565471 1 1 2.131523e-86
## CD8 1.042859e-17 -0.3001131 1 1 1.355716e-16
head(rna_markers)
## p_val avg_log2FC pct.1 pct.2 p_val_adj
## BANK1 0 1.963277 0.456 0.015 0
## CD19 0 1.563124 0.351 0.004 0
## CD22 0 1.503809 0.284 0.007 0
## CD79A 0 4.177162 0.965 0.045 0
## CD79B 0 3.774579 0.944 0.089 0
## FCRL1 0 1.188813 0.222 0.002 0
多组学数据的其他可视化方式
代码语言:javascript复制# Draw ADT scatter plots (like biaxial plots for FACS). Note that you can even 'gate' cells if
# desired by using HoverLocator and FeatureLocator
FeatureScatter(cbmc, feature1 = "adt_CD19", feature2 = "adt_CD3")
代码语言:javascript复制# view relationship between protein and RNA
FeatureScatter(cbmc, feature1 = "adt_CD3", feature2 = "rna_CD3E")
代码语言:javascript复制FeatureScatter(cbmc, feature1 = "adt_CD4", feature2 = "adt_CD8")
代码语言:javascript复制# Let's look at the raw (non-normalized) ADT counts. You can see the values are quite high,
# particularly in comparison to RNA values. This is due to the significantly higher protein
# copy number in cells, which significantly reduces 'drop-out' in ADT data
FeatureScatter(cbmc, feature1 = "adt_CD4", feature2 = "adt_CD8", slot = "counts")
这个散点图比较像流式分析中得圈门,通过标记基因看所处得哪个部分,可以进行大致得倍性分析或者荧光信号得分析。
从10x的多组学实验中加载数据
Seurat还能分析使用CellRanger v3处理的多组学10X实验的数据;作为一个例子,我们使用7,900个外周血单核细胞(PBMC)的数据集重新制作了上面的图,10X基因组学公司在这里免费提供https://support.10xgenomics.com/single-cell-gene-expression/datasets/3.0.0/pbmc_10k_protein_v3。
代码语言:javascript复制pbmc10k.data <- Read10X(data.dir = "../data/pbmc10k/filtered_feature_bc_matrix/")
rownames(x = pbmc10k.data[["Antibody Capture"]]) <- gsub(pattern = "_[control_]*TotalSeqB", replacement = "",
x = rownames(x = pbmc10k.data[["Antibody Capture"]]))
pbmc10k <- CreateSeuratObject(counts = pbmc10k.data[["Gene Expression"]], min.cells = 3, min.features = 200)
pbmc10k <- NormalizeData(pbmc10k)
pbmc10k[["ADT"]] <- CreateAssayObject(pbmc10k.data[["Antibody Capture"]][, colnames(x = pbmc10k)])
pbmc10k <- NormalizeData(pbmc10k, assay = "ADT", normalization.method = "CLR")
plot1 <- FeatureScatter(pbmc10k, feature1 = "adt_CD19", feature2 = "adt_CD3", pt.size = 1)
plot2 <- FeatureScatter(pbmc10k, feature1 = "adt_CD4", feature2 = "adt_CD8a", pt.size = 1)
plot3 <- FeatureScatter(pbmc10k, feature1 = "adt_CD3", feature2 = "CD3E", pt.size = 1)
(plot1 plot2 plot3) & NoLegend()
Seurat 中多组学数据的附加功能
Seurat v4还包括用于分析、可视化和整合多模式数据集的额外功能。欲了解更多信息,请浏览下面的资源https://satijalab.org/seurat/articles/multimodal_vignette.html。