R语言做生信Single cell单细胞分析

换个姿势标准化单细胞数据

2019-05-22  本文已影响23人  六博说
简介

  由于单细胞数据的高维度,基因长度差异,覆盖度差异及实验过程中的偏好性等因素,对前期数据进行有质量的标准化,对后续分析结果解读至关重要。标准化的分析比较多,对于常规的群体RNA分析而言,各种软件包也有相应的标准化方式,基因的定量也有RPKM ,TPM等标准化指标,单细胞数据对标准化的要求更高,本篇文章主要介绍新的标准化方法sctransform,他可以应用到Seurat中替换其原有的标准化函数。seuratV3简介及实操有对其相应的介绍。

安装R包及数据导入创建对象
#打开R环境直接安装
devtools::install_github(repo = 'ChristophH/sctransform', ref = 'develop')
devtools::install_github(repo = 'satijalab/seurat', ref = 'release/3.0')
#也可以直接安装SeuratV3包
install.packages("seurat")
library(Seurat)
library(ggplot2)
library(sctransform)
#测试数据在10X官网下载
pbmc_data <- Read10X(data.dir = "pbmc3k/filtered_gene_bc_matrices/hg19/")
pbmc <- CreateSeuratObject(counts = pbmc_data)
细节介绍

为什么在使用sctransform时可以选择更多的PC?
答:

例如,以下代码在单个命令中复制完整的端到端工作流:

pbmc <- CreateSeuratObject(pbmc_data) %>% PercentageFeatureSet(pattern = "^MT-", col.name = "percent.mt") %>% 
    SCTransform(vars.to.regress = "percent.mt") %>% RunPCA() %>% FindNeighbors(dims = 1:30) %>% 
    RunUMAP(dims = 1:30) %>% FindClusters()

sctransform存储的归一化值在哪里?
答:
如的预印本中所述,sctransform使用“正则化负二项式回归”计算scRNA-seq数据中的技术噪声模型。该模型的残差是标准化值,可以是正数或负数。给定基因中给定基因的阳性残基表明,鉴于基因在群体和细胞测序深度中的平均表达,观察到比预期更多的UMI,而负残差表明相反。
sctransfrom的结果存储在“SCT”测定中。您可以在插图命令备忘单开发者指南中了解有关Seurat中多种化验数据和命令的更多信息。

两种标准化方式比较

作为参考,首先应用标准的Seurat工作流程,并使用对数标准化

pbmc_logtransform <- pbmc
pbmc_logtransform <- NormalizeData(pbmc_logtransform, verbose = FALSE)
pbmc_logtransform <- FindVariableFeatures(pbmc_logtransform, verbose = FALSE) 
pbmc_logtransform <- ScaleData(pbmc_logtransform, verbose = FALSE) 
pbmc_logtransform <- RunPCA(pbmc_logtransform, verbose = FALSE) 
pbmc_logtransform <- RunUMAP(pbmc_logtransform,dims = 1:20, verbose = FALSE)

为了比较,现在应用sctransform规范化

# Note that this single command replaces NormalizeData, ScaleData, and FindVariableFeatures.
# Transformed data will be available in the SCT assay, which is set as the default after running sctransform
pbmc <- SCTransform(object = pbmc, verbose = FALSE)

通过PCA和UMAP嵌入执行降维

# These are now standard steps in the Seurat workflow for visualization and clustering
pbmc <- RunPCA(object = pbmc, verbose = FALSE)
pbmc <- RunUMAP(object = pbmc, dims = 1:20, verbose = FALSE)
pbmc <- FindNeighbors(object = pbmc, dims = 1:20, verbose = FALSE)
pbmc <- FindClusters(object = pbmc, verbose = FALSE)

在sctransform和log-normalized嵌入上可视化聚类结果。

pbmc_logtransform$clusterID <- Idents(pbmc)
Idents(pbmc_logtransform) <- 'clusterID'
plot1 <- DimPlot(object = pbmc, label = TRUE) + NoLegend() + ggtitle('sctransform') 
plot2 <- DimPlot(object = pbmc_logtransform, label = TRUE)
plot2 <- plot2 + NoLegend() + ggtitle('Log-normalization') 
CombinePlots(list(plot1,plot2))

用户可以基于规范标记单独注释群集。然而,与对数归一化分析相比,sctransform归一化显示出更明显的生物学区别。例如,注意在对数归一化分析中如何将簇0,1,9和11(所有不同的T细胞簇)混合在一起。sctransform分析显示:

# These are now standard steps in the Seurat workflow for visualization and clustering Visualize
# canonical marker genes as violin plots.
VlnPlot(pbmc, features = c("CD8A", "GZMK", "CCL5", "S100A4", "ANXA1", "CCR7", "ISG15", "CD3D"), 
    pt.size = 0.2, ncol = 4)

在sctransform嵌入上可视化规范标记基因。

FeaturePlot(object = pbmc, features = c("CD8A","GZMK","CCL5","S100A4","S100A4","CCR7"), pt.size = 0.2,ncol = 3)
FeaturePlot(object = pbmc, features = c("CD3D","ISG15","TCL1A","FCER2","XCL1","FCGR3A"), pt.size = 0.2,ncol = 3)
参考材料:

https://rawgit.com/ChristophH/sctransform/master/inst/doc/seurat.html
https://satijalab.org/seurat/v3.0/sctransform_vignette.html

关注微信公众号,第一时间获取更新


上一篇下一篇

猜你喜欢

热点阅读