-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathv2.5.MEP.Introspection.Rmd
366 lines (241 loc) · 9.86 KB
/
v2.5.MEP.Introspection.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
---
title: "v2.5.MEP.Introspection.Rmd"
author: "D. Ford Hannum Jr."
date: "9/23/2020"
output:
html_document:
toc: true
toc_depth: 3
number_sections: false
theme: united
highlight: tango
---
```{r setup, include=TRUE, message=FALSE}
knitr::opts_chunk$set(echo = FALSE, message = FALSE)
library(Seurat)
library(ggplot2)
library(data.table)
library(MAST)
library(SingleR)
library(dplyr)
library(tidyr)
library(limma)
library(scRNAseq)
```
```{r printing session info, include = T}
sessionInfo()
```
```{r loading data}
# Calling the Seurat variable wbm instead of comb.int which is what it was previously
wbm <- readRDS('./data/v2/lesser.combined.integrated.rds')
DimPlot(wbm, reduction = 'umap')
```
```{r changing idents}
#wbm <- readRDS('./data/v2/lesser.combined.integrated.rds')
wbm$State <- wbm$Condition
wbm$Condition <- ifelse(grepl('enr', wbm$Condition), 'Enriched', 'Not enriched')
wbm$Experiment <- ifelse(grepl('Mpl', wbm$State), 'Mpl',
ifelse(grepl('Migr', wbm$State), 'Migr1', 'Control'))
sumry <- read.table('./data/v2/summary_naming.tsv', header = T, sep = '\t')
# sumry
# new_levels <- sumry$final
new_levels <- c('Gran-1','Gran-2','?GMP','B cell-1','Gran-3','Monocyte','?MEP/Mast',
'?CMP/Neutro','Macrophage','B cell-2','Erythrocyte', 'T cell',
'Megakaryocyte','B cell-3', 'B cell-4')
names(new_levels) <- levels(wbm)
#new_levels
wbm <- RenameIdents(wbm, new_levels)
wbm$new_cluster_IDs <- Idents(wbm)
DimPlot(wbm, reduction = 'umap', label = T, repel = T) + NoLegend()
```
# This File
Going to analyze the MEP cluster, which is of greatest interest to us.
# Goal
To see if this MEP cluster is playing a role in fibrogenesis.
# Distinguishing MEP Cluster
Looking to find what genes distinguish this MEP cluster from all other clusters in the analysis.
```{r mep markers}
#meps <- subset(wbm, new_cluster_IDs %in% '?MEP/Mast')
mep.markers <- FindMarkers(wbm,
ident.1 = '?MEP/Mast',
logfc.threshold = log(2),
test.use = 'MAST')
mep.markers <- mep.markers[mep.markers$p_val_adj < 0.05,]
mep.markers <- mep.markers[order(mep.markers$avg_logFC, decreasing = T),]
```
## MEP Up-regulated markers
Looking at the top 10 up-regulated markers plus Itga2b
```{r mep up-regulated markers 10}
for(i in c(rownames(head(mep.markers,10)), 'Itga2b')){
print(VlnPlot(wbm, features = i, pt.size = 0))
}
DotPlot(wbm, features = c(rownames(mep.markers)[1:10],'Itga2b')) +
theme(axis.text.x = element_text(angle = 90))
```
This was also done for down-regulated markers, but it is not very informative as there are few genes that are widely expressed in all other clusters excluding MEP cluster.
```{r mep down-regulated markers}
# for(i in rev(rownames(tail(mep.markers,10)))){
# print(VlnPlot(wbm, features = i, pt.size = 0))
# }
```
```{r go terms for up-regulated markers}
mep.markers.UP <- rownames(mep.markers[mep.markers$avg_logFC > 0,])
# write.table(mep.markers, './data/v2/mep.DE.markers.txt', quote = F, sep = '\t')
#
# write.table(mep.markers.UP, './data/v2/mep.markers.UP.regulated.txt', quote = F, row.names = F, col.names = F)
```
# Focusing on Itga2b
Looking specfiically at Itga2b expression
```{r itga2b}
VlnPlot(wbm, features = 'Itga2b')
wbm$itga2b.expression <- as.vector(wbm$RNA['Itga2b',])
wbm$itga2b.expression.binary <- wbm$itga2b.expression > 0
table(wbm$new_cluster_IDs, wbm$itga2b.expression.binary)
itga2b.pos <- subset(wbm, itga2b.expression.binary > 0)
itga2b.pos
FeaturePlot(wbm, features = 'itga2b.expression.binary')
DimPlot(itga2b.pos, reduction = 'umap')
VlnPlot(itga2b.pos, features = 'Itga2b')
```
Going to look at a few different subclusterings:
1. MEP + Megakaryocyte + Erythrocyte
2. MEP + ?GMP + ?CMP
3. MEP + Megakaryocyte + Erythrocyte + ?GMP + ?CMP
4. MEP
**Note**: the original plan was to do this in Seurat, but this is where Monocle may be more useful to look at trajectories.
## MEP + Megakaryocyte + Erythrocyte
```{r subclustering s1}
s1 <- subset(wbm, new_cluster_IDs %in% c('Megakaryocyte','Erythrocyte','?MEP/Mast'))
print('Cells in Subset 1')
table(s1$new_cluster_IDs)
table(s1$new_cluster_IDs, s1$State)
DefaultAssay(s1) <- 'RNA'
s1 <- NormalizeData(s1, normalization.method = 'LogNormalize', scale.factor = 10000)
s1 <- FindVariableFeatures(s1, selection.method = 'vst', nfeatures = 2000)
s1 <- ScaleData(s1, features = row.names(s1))
s1 <- RunPCA(s1, features = VariableFeatures(s1), verbose = F)
# ElbowPlot(s1) # could have gone with 8 but decided to just go with 10
s1 <- FindNeighbors(s1, dims = 1:10)
res <- seq(0,1, by = 0.05)
clustrs <- c()
for (i in res){
clst <- FindClusters(s1, resolution = i, verbose = F)
clst <- length(unique(clst$seurat_clusters))
clustrs <- c(clustrs,clst)
}
# plot(res,clustrs)
# # Going with 0.6
s1 <- FindClusters(s1, resolution = 0.3, verbose = F)
s1 <- FindClusters(s1, resolution = 0.6, verbose = F)
s1 <- RunUMAP(s1, dims = 1:10, verbose = F)
DimPlot(s1, reduction = 'umap', group.by = 'new_cluster_IDs')
```
## MEP + ?GMP + ?CMP
## MEP + Megakaryocyte + Erythrocyte + ?GMP + ?CMP
## MEP
```{r subcluster MEPs}
s4 <- subset(wbm, new_cluster_IDs %in% c('?MEP/Mast'))
#s4 <- subset(wbm, new_cluster_IDs %in% c('?MEP/MAST'))
print('Cells in Subset 4 (MEPs)')
table(s4$new_cluster_IDs)
table(s4$new_cluster_IDs, s4$State)
DefaultAssay(s4) <- 'RNA'
s4 <- NormalizeData(s4, normalization.method = 'LogNormalize', scale.factor = 10000)
s4 <- FindVariableFeatures(s4, selection.method = 'vst', nfeatures = 2000)
s4 <- ScaleData(s4, features = row.names(s4))
s4 <- RunPCA(s4, features = VariableFeatures(s4), verbose = F)
# ElbowPlot(s4) # could have gone with 8 but decided to just go with 10
s4 <- FindNeighbors(s4, dims = 1:10)
res <- seq(0,1, by = 0.05)
clustrs <- c()
for (i in res){
clst <- FindClusters(s4, resolution = i, verbose = F)
clst <- length(unique(clst$seurat_clusters))
clustrs <- c(clustrs,clst)
}
plot(res,clustrs)
# # Going with 0.6
s4 <- FindClusters(s4, resolution = 0.15, verbose = F)
s4 <- FindClusters(s4, resolution = 0.2, verbose = F)
s4 <- FindClusters(s4, resolution = 0.5, verbose = F)
s4 <- RunUMAP(s4, dims = 1:10, verbose = F)
DimPlot(s4, reduction = 'umap', group.by = 'RNA_snn_res.0.2')
```
```{r mep/mcp markers}
Vln
```
# Differential Expression
## MEPs
```{r mep table}
table(s4$seurat_clusters, s4$State)
DimPlot(s4, reduction = 'umap', group.by = 'Experiment')
```
### Nbeal vs Migr1
```{r mep DE controls}
table(s4$Experiment)
s4.markers.controls <- FindMarkers(s4,
ident.1 = 'Control',
ident.2 = 'Migr1',
group.by = 'Experiment',
logfc.threshold = log(2),
test.use = 'MAST')
s4.markers.controls <- s4.markers.controls[s4.markers.controls$p_val_adj < 0.05,]
s4.markers.controls <- s4.markers.controls[order(s4.markers.controls$avg_logFC, decreasing = T),]
dim(s4.markers.controls)
for(i in rownames(s4.markers.controls)[1:9]){
print(VlnPlot(s4, features = i, group.by = 'Experiment',pt.size = 0))
}
```
### Mpl vs Migr1
```{r mep DE mpl vs migr1}
#table(s4$Experiment)
s4.markers.controls <- FindMarkers(s4,
ident.1 = 'Mpl',
ident.2 = 'Migr1',
group.by = 'Experiment',
logfc.threshold = log(2),
test.use = 'MAST')
s4.markers.controls <- s4.markers.controls[s4.markers.controls$p_val_adj < 0.05,]
s4.markers.controls <- s4.markers.controls[order(s4.markers.controls$avg_logFC, decreasing = T),]
dim(s4.markers.controls)
head(s4.markers.controls)
for(i in rownames(s4.markers.controls)[1:9]){
print(VlnPlot(s4, features = i, group.by = 'Experiment',pt.size = .5))
}
```
### Mpl vs Migr1 & Nbeal Controls
```{r mep DE mpl vs controls}
s4.markers.controls <- FindMarkers(s4,
ident.1 = 'Mpl',
ident.2 = c('Migr1','Control'),
group.by = 'Experiment',
logfc.threshold = log(2),
test.use = 'MAST')
s4.markers.controls <- s4.markers.controls[s4.markers.controls$p_val_adj < 0.05,]
s4.markers.controls <- s4.markers.controls[order(s4.markers.controls$avg_logFC, decreasing = T),]
dim(s4.markers.controls)
head(s4.markers.controls)
for(i in rownames(s4.markers.controls)[1:9]){
print(VlnPlot(s4, features = i, group.by = 'Experiment',pt.size = .5))
}
# write.table(s4.markers.controls, './data/v2/MEP.mpl.vs.migr1ANDnbeal.txt', quote = F, sep = '\t')
#
# up.markers <- rownames(s4.markers.controls[s4.markers.controls$avg_logFC > 0,])
# write.table(up.markers, './data/v2/go_terms/mep.mpl.vs.migr1ANDnbeal.UP.reg.txt', quote = F, row.names = F, col.names = F)
#
# down.markers <- rownames(s4.markers.controls[s4.markers.controls$avg_logFC < 0,])
# write.table(down.markers, './data/v2/go_terms/mep.mpl.vs.migr1ANDnbeal.DOWN.reg.txt', quote = F, row.names = F, col.names = F)
#
# write.table(rownames(s4), './data/v2/go_terms/mep.all.genes.txt', quote = F, row.names = F, col.names = F)
```
#### GO Terms
Looking at the GO terms that are most associated with up- and down-regulated genes from Mpl compared to Nbeal and Migr1. These will be located in a supplementary excel file. See MEP.mpl.vs.migr1ANDnbeal.xlsx
## MEP Subclusters
```{r mep insight}
mep <- s4
gof <- c('Kit','Gata2')
for(i in gof){
print(VlnPlot(mep, features = i, group.by = 'RNA_snn_res.0.2'))
print(VlnPlot(mep, features = i, split.by = 'Experiment', group.by = 'RNA_snn_res.0.2'))
}
```