單細胞轉(zhuǎn)錄組數(shù)據(jù)分析||Seurat新版教程:Differential expression testing

這個教程突出顯示了在Seurat中執(zhí)行差異表達式的一些示例工作流架忌。出于演示目的拟淮,我們將使用第一個向?qū)Ы坛讨袆?chuàng)建的2700個PBMC對象软舌。

執(zhí)行默認的差異分析

Seurat的大部分差異表達式特性都可以通過findmarker函數(shù)訪問识脆。默認情況下,Seurat基于非參數(shù)Wilcoxon秩和檢驗執(zhí)行差異分析恕曲。這將替換以前的默認測試(' 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

結(jié)果數(shù)據(jù)框架有以下列:

  • p_val: p_val(未調(diào)整)
  • avg_logFC:兩組間平均logFC。正值表示特征在第一組中表達得更高实蓬。
  • pct.1 :在第一組中檢測到該特征的cell的百分比
  • pct.2 :在第二組中檢測到該特征的cell的百分比
  • p_val_adj:調(diào)整p值茸俭,基于bonferroni校正使用數(shù)據(jù)集中的所有功能吊履。
# 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測試的速度

為了提高標記發(fā)現(xiàn)的速度瓣履,特別是對于大型數(shù)據(jù)集率翅,Seurat允許對特征或cell進行預過濾。例如袖迎,在兩組細胞中都很少檢測到的特征冕臭,或者在相似的平均水平上表達的特征,不太可能有差異表達燕锥。min.pct辜贵、logfc的示例用例。閾值,min.diff归形。pct和max.cells.per托慨。ident參數(shù)如下所示。

# 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.

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末暇榴,一起剝皮案震驚了整個濱河市厚棵,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌蔼紧,老刑警劉巖婆硬,帶你破解...
    沈念sama閱讀 206,013評論 6 481
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異奸例,居然都是意外死亡彬犯,警方通過查閱死者的電腦和手機,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 88,205評論 2 382
  • 文/潘曉璐 我一進店門查吊,熙熙樓的掌柜王于貴愁眉苦臉地迎上來谐区,“玉大人,你說我怎么就攤上這事逻卖∷瘟校” “怎么了?”我有些...
    開封第一講書人閱讀 152,370評論 0 342
  • 文/不壞的土叔 我叫張陵评也,是天一觀的道長虚茶。 經(jīng)常有香客問我,道長仇参,這世上最難降的妖魔是什么嘹叫? 我笑而不...
    開封第一講書人閱讀 55,168評論 1 278
  • 正文 為了忘掉前任,我火速辦了婚禮诈乒,結(jié)果婚禮上罩扇,老公的妹妹穿的比我還像新娘。我一直安慰自己,他們只是感情好喂饥,可當我...
    茶點故事閱讀 64,153評論 5 371
  • 文/花漫 我一把揭開白布消约。 她就那樣靜靜地躺著,像睡著了一般员帮。 火紅的嫁衣襯著肌膚如雪或粮。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 48,954評論 1 283
  • 那天捞高,我揣著相機與錄音氯材,去河邊找鬼。 笑死硝岗,一個胖子當著我的面吹牛氢哮,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播型檀,決...
    沈念sama閱讀 38,271評論 3 399
  • 文/蒼蘭香墨 我猛地睜開眼冗尤,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了胀溺?” 一聲冷哼從身側(cè)響起裂七,我...
    開封第一講書人閱讀 36,916評論 0 259
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎仓坞,沒想到半個月后背零,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 43,382評論 1 300
  • 正文 獨居荒郊野嶺守林人離奇死亡扯躺,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 35,877評論 2 323
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發(fā)現(xiàn)自己被綠了蝎困。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片录语。...
    茶點故事閱讀 37,989評論 1 333
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖禾乘,靈堂內(nèi)的尸體忽然破棺而出澎埠,到底是詐尸還是另有隱情,我是刑警寧澤始藕,帶...
    沈念sama閱讀 33,624評論 4 322
  • 正文 年R本政府宣布蒲稳,位于F島的核電站,受9級特大地震影響伍派,放射性物質(zhì)發(fā)生泄漏江耀。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點故事閱讀 39,209評論 3 307
  • 文/蒙蒙 一诉植、第九天 我趴在偏房一處隱蔽的房頂上張望祥国。 院中可真熱鬧,春花似錦、人聲如沸舌稀。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,199評論 0 19
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽壁查。三九已至觉至,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間睡腿,已是汗流浹背语御。 一陣腳步聲響...
    開封第一講書人閱讀 31,418評論 1 260
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留嫉到,地道東北人沃暗。 一個月前我還...
    沈念sama閱讀 45,401評論 2 352
  • 正文 我出身青樓,卻偏偏與公主長得像何恶,于是被迫代替她去往敵國和親孽锥。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當晚...
    茶點故事閱讀 42,700評論 2 345

推薦閱讀更多精彩內(nèi)容