單細胞轉錄組數據分析||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閱讀 230,563評論 6 544
  • 序言:濱河連續發生了三起死亡事件,死亡現場離奇詭異,居然都是意外死亡,警方通過查閱死者的電腦和手機,發現死者居然都...
    沈念sama閱讀 99,694評論 3 429
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人,你說我怎么就攤上這事。” “怎么了?”我有些...
    開封第一講書人閱讀 178,672評論 0 383
  • 文/不壞的土叔 我叫張陵,是天一觀的道長。 經常有香客問我,道長,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 63,965評論 1 318
  • 正文 為了忘掉前任,我火速辦了婚禮,結果婚禮上,老公的妹妹穿的比我還像新娘。我一直安慰自己,他們只是感情好,可當我...
    茶點故事閱讀 72,690評論 6 413
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著,像睡著了一般。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發上,一...
    開封第一講書人閱讀 56,019評論 1 329
  • 那天,我揣著相機與錄音,去河邊找鬼。 笑死,一個胖子當著我的面吹牛,可吹牛的內容都是我干的。 我是一名探鬼主播,決...
    沈念sama閱讀 44,013評論 3 449
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了?” 一聲冷哼從身側響起,我...
    開封第一講書人閱讀 43,188評論 0 290
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后,有當地人在樹林里發現了一具尸體,經...
    沈念sama閱讀 49,718評論 1 336
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內容為張勛視角 年9月15日...
    茶點故事閱讀 41,438評論 3 360
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發現自己被綠了。 大學時的朋友給我發了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 43,667評論 1 374
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖,靈堂內的尸體忽然破棺而出,到底是詐尸還是另有隱情,我是刑警寧澤,帶...
    沈念sama閱讀 39,149評論 5 365
  • 正文 年R本政府宣布,位于F島的核電站,受9級特大地震影響,放射性物質發生泄漏。R本人自食惡果不足惜,卻給世界環境...
    茶點故事閱讀 44,845評論 3 351
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧,春花似錦、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 35,252評論 0 28
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至,卻和暖如春,著一層夾襖步出監牢的瞬間,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 36,590評論 1 295
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人。 一個月前我還...
    沈念sama閱讀 52,384評論 3 400
  • 正文 我出身青樓,卻偏偏與公主長得像,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當晚...
    茶點故事閱讀 48,635評論 2 380

推薦閱讀更多精彩內容