## id the treatments
unique(iMGL_Seurat_v3_withConditions$orig.ident)
## Loading required package: Seurat
## Loading required package: SeuratObject
## Loading required package: sp
## 
## Attaching package: 'SeuratObject'
## The following objects are masked from 'package:base':
## 
##     intersect, t
## [1] "Ctrl" "Apop" "Myln" "Syn"  "Ab"
## id differentially expressed genes in treatment with apoptotic neurons vs control
de_apop_v_ctrl <- FindMarkers(iMGL_Seurat_v3_withConditions, ident.1="Apop", ident.2="Ctrl", group.by = "orig.ident")
# Note, by setting ident.2="ctrl", we are benchmarking against control. So avg_log2F>0 mean genes identified are upregulated in apop. 

# See most differentially expressed genes in apoptotic neuron treatment vs control
head(sort_by(de_apop_v_ctrl, de_apop_v_ctrl$avg_log2FC, decreasing=TRUE))
##               p_val avg_log2FC pct.1 pct.2     p_val_adj
## NEFM   0.000000e+00   698.2300 0.124 0.000  0.000000e+00
## SAT1  5.911374e-196   536.1890 1.000 0.999 1.418552e-191
## MAP1B 6.414340e-134   362.3457 0.052 0.000 1.539249e-129
## SST   4.001545e-151   350.5405 0.057 0.000 9.602507e-147
## CTSB   0.000000e+00   345.8450 0.989 0.966  0.000000e+00
## APOC1 6.122015e-153   344.7697 0.726 0.640 1.469100e-148
## Plot most differentially expressed genes for apop vs ctrl
VlnPlot(iMGL_Seurat_v3_withConditions, features = rownames(head(sort_by(de_apop_v_ctrl, de_apop_v_ctrl$avg_log2FC, decreasing=TRUE))), group.by = "orig.ident", combine = FALSE)
## [[1]]

## 
## [[2]]

## 
## [[3]]

## 
## [[4]]

## 
## [[5]]

## 
## [[6]]

## id differentially expressed genes in treatment with myln neurons vs control
de_myln_v_ctrl <- FindMarkers(iMGL_Seurat_v3_withConditions, ident.1="Myln", ident.2="Ctrl", group.by = "orig.ident")
# Note, by setting ident.2="ctrl", we are benchmarking against control. So avg_log2F>0 mean genes identified are upregulated in myln. 

# See most differentially expressed genes in myln treatment vs control
head(sort_by(de_myln_v_ctrl, de_myln_v_ctrl$avg_log2FC, decreasing=TRUE))
##                p_val avg_log2FC pct.1 pct.2     p_val_adj
## S100A9  0.000000e+00   340.5788 0.974 0.979  0.000000e+00
## APOC1  1.098365e-111   252.5744 0.691 0.640 2.635748e-107
## APOE   8.635735e-130   210.6662 0.635 0.527 2.072317e-125
## CTSL   8.387829e-139   190.3542 0.710 0.650 2.012827e-134
## LYZ     8.595729e-75   180.4397 0.826 0.876  2.062717e-70
## S100A8 3.613475e-102   171.7835 0.705 0.817  8.671256e-98
## Plot most differentially expressed genes for myln vs ctrl
VlnPlot(iMGL_Seurat_v3_withConditions, features = rownames(head(sort_by(de_myln_v_ctrl, de_myln_v_ctrl$avg_log2FC, decreasing=TRUE))), group.by = "orig.ident", combine = FALSE)
## [[1]]

## 
## [[2]]

## 
## [[3]]

## 
## [[4]]

## 
## [[5]]

## 
## [[6]]

## id differentially expressed genes in treatment with syn vs control
de_syn_v_ctrl <- FindMarkers(iMGL_Seurat_v3_withConditions, ident.1="Syn", ident.2="Ctrl", group.by = "orig.ident")
# Note, by setting ident.2="ctrl", we are benchmarking against control. So avg_log2F>0 mean genes identified are upregulated in syn. 

# See most differentially expressed genes in syn treatment vs control
head(sort_by(de_syn_v_ctrl, de_syn_v_ctrl$avg_log2FC, decreasing=TRUE))
##                p_val avg_log2FC pct.1 pct.2    p_val_adj
## CCL4L2  1.864481e-46   538.1584 0.039 0.010 4.474196e-42
## CCL4    1.232323e-65   421.1170 0.102 0.044 2.957205e-61
## APOE   8.343527e-103   380.8345 0.634 0.527 2.002196e-98
## LYZ     4.031031e-60   292.9002 0.839 0.876 9.673264e-56
## CCL3L1  4.922972e-45   265.4888 0.052 0.018 1.181366e-40
## CCL3    5.245354e-90   233.7497 0.221 0.124 1.258728e-85
## Plot most differentially expressed genes for syn vs ctrl
VlnPlot(iMGL_Seurat_v3_withConditions, features = rownames(head(sort_by(de_syn_v_ctrl, de_syn_v_ctrl$avg_log2FC, decreasing=TRUE))), group.by = "orig.ident", combine = FALSE)
## [[1]]

## 
## [[2]]

## 
## [[3]]

## 
## [[4]]

## 
## [[5]]

## 
## [[6]]

## id differentially expressed genes in treatment with ab vs control
de_ab_v_ctrl <- FindMarkers(iMGL_Seurat_v3_withConditions, ident.1="Ab", ident.2="Ctrl", group.by = "orig.ident")
# Note, by setting ident.2="ctrl", we are benchmarking against control. So avg_log2F>0 mean genes identified are upregulated in ab. 

# See most differentially expressed genes in Ab treatment vs control
head(sort_by(de_ab_v_ctrl, de_ab_v_ctrl$avg_log2FC, decreasing=TRUE))
##                p_val avg_log2FC pct.1 pct.2     p_val_adj
## CCL4L2  0.000000e+00   630.5763 0.213 0.010  0.000000e+00
## CCL4    0.000000e+00   510.6495 0.338 0.044  0.000000e+00
## FABP5  1.039995e-144   477.6471 0.964 0.935 2.495677e-140
## TIMP3  8.080429e-126   445.1144 0.066 0.007 1.939061e-121
## CCL20   9.607734e-33   427.0613 0.206 0.149  2.305568e-28
## CCL3    0.000000e+00   421.3855 0.375 0.124  0.000000e+00
## Plot most differentially expressed genes for Ab vs ctrl
VlnPlot(iMGL_Seurat_v3_withConditions, features = rownames(head(sort_by(de_ab_v_ctrl, de_ab_v_ctrl$avg_log2FC, decreasing=TRUE))), group.by = "orig.ident", combine = FALSE)
## [[1]]

## 
## [[2]]

## 
## [[3]]

## 
## [[4]]

## 
## [[5]]

## 
## [[6]]