這個教程突出顯示了在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.