单细胞36计之15调虎离山---差异表达检测

第十五计 调虎离山
设法使老虎离开山头。比喻为了便于行事,想法子引诱人离开原来的地方。
此计运用这个道理,是说战场上若遇强敌,要善用谋,用假象使敌人离开驻地,诱他就我之范,丧失他的优势,使他处处皆难,寸步难行,由主动变被动,而我则出其不意而致胜。

载入数据

此插图强调了一些在Seurat中执行差异表达的示例工作流程。出于演示目的,我们将使用通过SeuratData包提供的2700个PBMC对象。

library(Seurat)
library(SeuratData)
pbmc <- LoadData("pbmc3k", type = "pbmc3k.final")

执行默认的差异表达测试

可以通过该FindMarkers()函数访问大部分Seurat的差异表达功能。默认情况下,Seurat基于非参数Wilcoxon秩和检验执行微分表达式。这将替换以前的默认测试(“ bimod”)。要测试两组特定细胞之间的差异表达,请指定ident.1ident.2参数。

# list options for groups to perform differential expression on
levels(pbmc)
## [1] "Naive CD4 T"  "Memory CD4 T" "CD14+ Mono"   "B"            "CD8 T"       
## [6] "FCGR3A+ Mono" "NK"           "DC"           "Platelet"
# Find differentially expressed features between CD14+ and FCGR3A+ Monocytes
monocyte.de.markers <- FindMarkers(pbmc, ident.1 = "CD14+ Mono", ident.2 = "FCGR3A+ Mono")
# view results
head(monocyte.de.markers)
##                p_val avg_log2FC pct.1 pct.2    p_val_adj
## FCGR3A 1.193617e-101  -3.776553 0.131 0.975 1.636926e-97
## LYZ     8.134552e-75   2.614275 1.000 0.988 1.115572e-70
## RHOC    4.479768e-68  -2.325013 0.162 0.864 6.143554e-64
## S100A8  7.471811e-65   3.766437 0.975 0.500 1.024684e-60
## S100A9  1.318422e-64   3.299060 0.996 0.870 1.808084e-60
## IFITM2  4.821669e-64  -2.085807 0.677 1.000 6.612437e-60

结果数据框包含以下列:

  • p_val:p_val(未调整)
  • avg_log2FC:两组之间平均表达的对数倍数变化。正值表示该特征在第一组中的表达更高。
  • pct.1:第一组中检测到该功能的单元格的百分比
  • pct.2:第二组中检测到该功能的单元格的百分比
  • p_val_adj:基于使用数据集中所有特征的Bonferroni校正,调整后的p值。

如果ident.2省略该参数或将其设置为NULL,FindMarkers()则将测试由指定的组ident.1与所有其他单元格之间的差异表达特征。

# Find differentially expressed features between CD14+ Monocytes and all other cells, only
# search for positive markers
monocyte.de.markers <- FindMarkers(pbmc, ident.1 = "CD14+ Mono", ident.2 = NULL, only.pos = TRUE)
# view results
head(monocyte.de.markers)
##                p_val avg_log2FC pct.1 pct.2     p_val_adj
## S100A9  0.000000e+00   5.570063 0.996 0.215  0.000000e+00
## S100A8  0.000000e+00   5.477394 0.975 0.121  0.000000e+00
## FCN1    0.000000e+00   3.394219 0.952 0.151  0.000000e+00
## LGALS2  0.000000e+00   3.800484 0.908 0.059  0.000000e+00
## CD14   2.856582e-294   2.815626 0.667 0.028 3.917516e-290
## TYROBP 3.190467e-284   3.046798 0.994 0.265 4.375406e-280

预过滤功能或单元可提高DE测试的速度

为了提高标记发现的速度,特别是对于大型数据集,Seurat允许对特征或单元进行预过滤。例如,在任一组细胞中很少检测到的特征或以相似的平均水平表达的特征不太可能被差异表达。所述的实施例的用例min.pctlogfc.thresholdmin.diff.pct,和max.cells.per.ident参数在下面证明。

# Pre-filter features that are detected at <50% frequency in either CD14+ Monocytes or FCGR3A+
# Monocytes
head(FindMarkers(pbmc, ident.1 = "CD14+ Mono", ident.2 = "FCGR3A+ Mono", min.pct = 0.5))
##                p_val avg_log2FC pct.1 pct.2    p_val_adj
## FCGR3A 1.193617e-101  -3.776553 0.131 0.975 1.636926e-97
## LYZ     8.134552e-75   2.614275 1.000 0.988 1.115572e-70
## RHOC    4.479768e-68  -2.325013 0.162 0.864 6.143554e-64
## S100A8  7.471811e-65   3.766437 0.975 0.500 1.024684e-60
## S100A9  1.318422e-64   3.299060 0.996 0.870 1.808084e-60
## IFITM2  4.821669e-64  -2.085807 0.677 1.000 6.612437e-60
# Pre-filter features that have less than a two-fold change between the average expression of
# CD14+ Monocytes vs FCGR3A+ Monocytes
head(FindMarkers(pbmc, ident.1 = "CD14+ Mono", ident.2 = "FCGR3A+ Mono", logfc.threshold = log(2)))
##                p_val avg_log2FC pct.1 pct.2    p_val_adj
## FCGR3A 1.193617e-101  -3.776553 0.131 0.975 1.636926e-97
## LYZ     8.134552e-75   2.614275 1.000 0.988 1.115572e-70
## RHOC    4.479768e-68  -2.325013 0.162 0.864 6.143554e-64
## S100A8  7.471811e-65   3.766437 0.975 0.500 1.024684e-60
## S100A9  1.318422e-64   3.299060 0.996 0.870 1.808084e-60
## IFITM2  4.821669e-64  -2.085807 0.677 1.000 6.612437e-60
# Pre-filter features whose detection percentages across the two groups are similar (within
# 0.25)
head(FindMarkers(pbmc, ident.1 = "CD14+ Mono", ident.2 = "FCGR3A+ Mono", min.diff.pct = 0.25))
##                p_val avg_log2FC pct.1 pct.2    p_val_adj
## FCGR3A 1.193617e-101  -3.776553 0.131 0.975 1.636926e-97
## RHOC    4.479768e-68  -2.325013 0.162 0.864 6.143554e-64
## S100A8  7.471811e-65   3.766437 0.975 0.500 1.024684e-60
## IFITM2  4.821669e-64  -2.085807 0.677 1.000 6.612437e-60
## LGALS2  1.034540e-57   2.956704 0.908 0.265 1.418768e-53
## CDKN1C  2.886353e-48  -1.453845 0.029 0.506 3.958345e-44
# Increasing min.pct, logfc.threshold, and min.diff.pct, will increase the speed of DE testing,
# but could also miss features that are prefiltered

# Subsample each group to a maximum of 200 cells. Can be very useful for large clusters, or
# computationally-intensive DE tests
head(FindMarkers(pbmc, ident.1 = "CD14+ Mono", ident.2 = "FCGR3A+ Mono", max.cells.per.ident = 200))
##               p_val avg_log2FC pct.1 pct.2    p_val_adj
## FCGR3A 4.725441e-61  -3.776553 0.131 0.975 6.480470e-57
## LYZ    6.442891e-56   2.614275 1.000 0.988 8.835781e-52
## S100A8 8.983226e-49   3.766437 0.975 0.500 1.231960e-44
## S100A9 1.812278e-47   3.299060 0.996 0.870 2.485358e-43
## IFITM2 1.185202e-45  -2.085807 0.677 1.000 1.625386e-41
## RPS19  1.685374e-44  -1.091150 0.990 1.000 2.311321e-40

使用替代测试执行DE分析

当前支持以下差异表达测试:

  • “ wilcox”:Wilcoxon秩和检验(默认)
  • “ bimod”:单细胞特征表达的似然比测试,(McDavid等,生物信息学,2013)
  • “ roc”:标准AUC分类器
  • “ t”:学生的t检验
  • “泊松”:假设潜在的二项分布为负的似然比检验。仅用于基于UMI的数据集
  • “ negbinom”:似然比检验,假设潜在的负二项式分布。仅用于基于UMI的数据集
  • “ LR”:使用逻辑回归框架确定差异表达的基因。构造一个逻辑回归模型,根据每个特征分别预测组成员身份,并将其与似然比检验的空模型进行比较。
  • “ MAST”:将细胞检测率视为协变量的GLM框架(Finak等,Genome Biology,2015)(安装说明)
  • “ DESeq2”:基于使用负二项式分布的模型的DE (Love等人,Genome Biology,2014)(安装说明)

对于MAST和DESeq2,请确保单独安装这些软件包,以便将它们用作Seurat的一部分。安装后,可以使用usetest.use参数指定要使用的DE测试。

# Test for DE features using the MAST package
head(FindMarkers(pbmc, ident.1 = "CD14+ Mono", ident.2 = "FCGR3A+ Mono", test.use = "MAST"))
##                p_val avg_log2FC pct.1 pct.2     p_val_adj
## LYZ    7.660518e-145   2.614275 1.000 0.988 1.050563e-140
## FCGR3A 2.899069e-119  -3.776553 0.131 0.975 3.975784e-115
## S100A9  2.124607e-95   3.299060 0.996 0.870  2.913687e-91
## S100A8  3.280199e-92   3.766437 0.975 0.500  4.498465e-88
## IFITM2  5.595219e-87  -2.085807 0.677 1.000  7.673283e-83
## LGALS2  1.133131e-75   2.956704 0.908 0.265  1.553976e-71
# Test for DE features using the DESeq2 package. Throws an error if DESeq2 has not already been
# installed Note that the DESeq2 workflows can be computationally intensive for large datasets,
# but are incompatible with some feature pre-filtering options We therefore suggest initially
# limiting the number of cells used for testing
head(FindMarkers(pbmc, ident.1 = "CD14+ Mono", ident.2 = "FCGR3A+ Mono", test.use = "DESeq2", max.cells.per.ident = 50))
##               p_val avg_log2FC pct.1 pct.2    p_val_adj
## S100A9 1.871231e-58   2.538360 0.996 0.870 2.566206e-54
## LYZ    4.174350e-52   1.987962 1.000 0.988 5.724704e-48
## S100A8 5.747352e-49   2.784248 0.975 0.500 7.881918e-45
## FCGR3A 1.314956e-35  -2.949992 0.131 0.975 1.803331e-31
## RPS19  1.515491e-33  -1.614892 0.990 1.000 2.078345e-29
## IFITM2 1.223331e-26  -2.212583 0.677 1.000 1.677676e-22

你可能感兴趣的:(单细胞36计之15调虎离山---差异表达检测)