单细胞转录组数据分析||Seurat新版教程:Differential expression testing

这个教程突出显示了在Seurat中执行差异表达式的一些示例工作流。出于演示目的,我们将使用第一个向导教程中创建的2700个PBMC对象。

执行默认的差异分析

Seurat的大部分差异表达式特性都可以通过findmarker函数访问。默认情况下,Seurat基于非参数Wilcoxon秩和检验执行差异分析。这将替换以前的默认测试(' bimod ')。若要测试两组特定细胞之间的差异表达,ident.1 and ident.2。

library(Seurat)
library(ggplot2)
pbmc <- readRDS(file = "D:\\Users\\Administrator\\Desktop\\Novo周运来\\SingleCell\\scrna_tools/pbmc3k_final.rds")

# list options for groups to perform differential expression on
levels(pbmc)

[1] "Naive CD4 T"  "Memory CD4 T" "CD14+ Mono"   "B"           
[5] "CD8 T"        "FCGR3A+ Mono" "NK"           "DC"          
[9] "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_logFC pct.1 pct.2     p_val_adj
FCGR3A 1.221183e-111 -2.960870 0.049 0.975 1.674731e-107
IFITM3 3.799566e-110 -2.706276 0.051 0.975 5.210725e-106
CFD    1.051493e-108 -2.415630 0.030 0.938 1.442018e-104
FCER1G 1.608504e-108 -3.358616 0.100 1.000 2.205903e-104
TYROBP 3.503255e-103 -3.294981 0.144 1.000  4.804364e-99
CD68   7.439840e-103 -2.104813 0.046 0.926  1.020300e-98

结果数据框架有以下列:

  • p_val: p_val(未调整)
  • avg_logFC:两组间平均logFC。正值表示特征在第一组中表达得更高。
  • pct.1 :在第一组中检测到该特征的cell的百分比
  • pct.2 :在第二组中检测到该特征的cell的百分比
  • p_val_adj:调整p值,基于bonferroni校正使用数据集中的所有功能。
# 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)
head(monocyte.de.markers)
            p_val avg_logFC pct.1 pct.2    p_val_adj
IL32 1.666248e-81 0.7904889 0.951 0.474 2.285092e-77
LTB  2.610564e-81 0.8857289 0.981 0.650 3.580128e-77
LDHB 1.142971e-65 0.6517270 0.968 0.618 1.567470e-61
CD3D 7.634892e-62 0.6077867 0.917 0.442 1.047049e-57
IL7R 6.620193e-61 0.8088807 0.750 0.335 9.078933e-57
CD2  1.223464e-59 0.8861585 0.669 0.250 1.677858e-55
预过基因或者细胞,以提高DE测试的速度

为了提高标记发现的速度,特别是对于大型数据集,Seurat允许对特征或cell进行预过滤。例如,在两组细胞中都很少检测到的特征,或者在相似的平均水平上表达的特征,不太可能有差异表达。min.pct、logfc的示例用例。阈值,min.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))
  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=08s  
               p_val avg_logFC pct.1 pct.2     p_val_adj
FCGR3A 1.221183e-111 -2.960870 0.049 0.975 1.674731e-107
IFITM3 3.799566e-110 -2.706276 0.051 0.975 5.210725e-106
CFD    1.051493e-108 -2.415630 0.030 0.938 1.442018e-104
FCER1G 1.608504e-108 -3.358616 0.100 1.000 2.205903e-104
TYROBP 3.503255e-103 -3.294981 0.144 1.000  4.804364e-99
CD68   7.439840e-103 -2.104813 0.046 0.926  1.020300e-98
# 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)))
6s  
               p_val avg_logFC pct.1 pct.2     p_val_adj
FCGR3A 1.221183e-111 -2.960870 0.049 0.975 1.674731e-107
IFITM3 3.799566e-110 -2.706276 0.051 0.975 5.210725e-106
CFD    1.051493e-108 -2.415630 0.030 0.938 1.442018e-104
FCER1G 1.608504e-108 -3.358616 0.100 1.000 2.205903e-104
TYROBP 3.503255e-103 -3.294981 0.144 1.000  4.804364e-99
CD68   7.439840e-103 -2.104813 0.046 0.926  1.020300e-98
# 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))
  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=07s  
               p_val avg_logFC pct.1 pct.2     p_val_adj
FCGR3A 1.221183e-111 -2.960870 0.049 0.975 1.674731e-107
IFITM3 3.799566e-110 -2.706276 0.051 0.975 5.210725e-106
CFD    1.051493e-108 -2.415630 0.030 0.938 1.442018e-104
FCER1G 1.608504e-108 -3.358616 0.100 1.000 2.205903e-104
TYROBP 3.503255e-103 -3.294981 0.144 1.000  4.804364e-99
CD68   7.439840e-103 -2.104813 0.046 0.926  1.020300e-98
# 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))

  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=16s  
              p_val avg_logFC pct.1 pct.2    p_val_adj
FCER1G 9.932112e-69 -3.358616 0.100 1.000 1.362090e-64
TYROBP 6.640266e-68 -3.294981 0.144 1.000 9.106461e-64
AIF1   1.559285e-66 -3.210036 0.185 1.000 2.138403e-62
FCGR3A 3.389538e-66 -2.960870 0.049 0.975 4.648412e-62
IFITM3 5.490079e-66 -2.706276 0.051 0.975 7.529094e-62
LST1   7.587752e-65 -3.265432 0.213 1.000 1.040584e-60

Perform DE analysis using alternative tests

The following differential expression tests are currently supported:

  • “wilcox” : Wilcoxon rank sum test (default)
  • “bimod” : Likelihood-ratio test for single cell feature expression, (McDavid et al., Bioinformatics, 2013)
  • “roc” : Standard AUC classifier
  • “t” : Student’s t-test
  • “poisson” : Likelihood ratio test assuming an underlying negative binomial distribution. Use only for UMI-based datasets
  • “negbinom” : Likelihood ratio test assuming an underlying negative binomial distribution. Use only for UMI-based datasets
  • “LR” : Uses a logistic regression framework to determine differentially expressed genes. Constructs a logistic regression model predicting group membership based on each feature individually and compares this to a null model with a likelihood ratio test.
  • “MAST” : GLM-framework that treates cellular detection rate as a covariate (Finak et al, Genome Biology, 2015) (Installation instructions)
  • “DESeq2” : DE based on a model using the negative binomial distribution (Love et al, Genome Biology, 2014) (Installation instructions)

For MAST and DESeq2 please ensure that these packages are installed separately in order to use them as part of Seurat. Once installed, use the test.use parameter can be used to specify which DE test to use.

# Test for DE features using the MAST package
head(FindMarkers(pbmc, ident.1 = "CD14+ Mono", ident.2 = "FCGR3A+ Mono", test.use = "MAST"))
Assuming data assay in position 1, with name et is log-transformed.
                                                               
Done!
Combining coefficients and standard errors
Calculating log-fold changes
Calculating likelihood ratio tests
Refitting on reduced model...
                                                               
Done!
               p_val avg_logFC pct.1 pct.2     p_val_adj
FTL    1.639548e-249 -2.647647 0.993     1 2.248476e-245
FTH1   2.783216e-242 -2.219687 1.000     1 3.816902e-238
AIF1   7.652245e-202 -3.210036 0.185     1 1.049429e-197
CST3   2.169655e-191 -3.253608 0.231     1 2.975465e-187
LST1   3.128135e-191 -3.265432 0.213     1 4.289924e-187
TYROBP 3.898825e-179 -3.294981 0.144     1 5.346848e-175
# 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))
converting counts to integer mode
gene-wise dispersion estimates
mean-dispersion relationship
final dispersion estimates

               p_val avg_logFC pct.1 pct.2     p_val_adj
FTL    5.228822e-270 -2.852609 0.993     1 7.170807e-266
FTH1   4.012123e-230 -2.428191 1.000     1 5.502225e-226
TYROBP  3.206815e-93 -2.631490 0.144     1  4.397826e-89
FCER1G  3.419275e-89 -2.660790 0.100     1  4.689194e-85
CST3    2.334414e-84 -2.739375 0.231     1  3.201416e-80
AIF1    7.077034e-81 -2.626784 0.185     1  9.705445e-77

Acknowledgements

We thank the authors of the MAST and DESeq2 packages for their kind assistance and advice. We also point users to the following study by Charlotte Soneson and Mark Robinson, which performs careful and extensive evaluation of methods for single cell differential expression testing.

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 214,444评论 6 496
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 91,421评论 3 389
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 160,036评论 0 349
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 57,363评论 1 288
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 66,460评论 6 386
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 50,502评论 1 292
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 39,511评论 3 412
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 38,280评论 0 270
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,736评论 1 307
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,014评论 2 328
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,190评论 1 342
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,848评论 5 338
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 40,531评论 3 322
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,159评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,411评论 1 268
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 47,067评论 2 365
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,078评论 2 352

推荐阅读更多精彩内容