-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTomato_scRNAseq_full_ds.R
230 lines (161 loc) · 7.74 KB
/
Tomato_scRNAseq_full_ds.R
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
suppressMessages(library(ggbeeswarm))
suppressMessages(library(dplyr))
suppressMessages(library(Seurat))
suppressMessages(library(Matrix))
suppressMessages(library(gplots))
suppressMessages(library(ggplot2))
suppressMessages(library(openxlsx))
suppressMessages(library(cowplot))
suppressMessages(library(patchwork))
library(pheatmap)
library(reshape2)
library(scales)
library(viridis)
library(SeuratWrappers)
library(slingshot)
require(BiocStyle)
library(SingleCellExperiment)
#function to plot gene signature sum/mean/median over UMAP.
#alternative to seurat module score
Plot_sign <- function(Seraut.object, signature, operator = sum, titlename) {
x <- Seraut.object
DefaultAssay(x) <- "RNA"
x[["Sign_exp"]] <- apply(FetchData(object = x,
vars = signature),
1,
operator)
FP <- FeaturePlot(x, reduction = "umap",
features = 'Sign_exp',
label = T,
pt.size = 2,
order = T,
repel = T,
cols = c("lightgrey", "blue")) +
theme(plot.title = element_text(color="blue", size=20, face="bold.italic"),
plot.subtitle = element_text(color="dodgerblue2", size=8, face="italic"),
axis.text.x = element_text(angle = 90, face = "bold", color = 'dodgerblue4', size=7, hjust =1),
axis.title.x = element_text(face = "bold", color = "dodgerblue2", size = 10),
axis.text.y = element_text(angle = 0, face = "bold", color = 'dodgerblue4', size=10),
axis.title.y = element_text(face = "bold", color = "dodgerblue2", size = 10),
legend.text = element_text(face = "bold", color = "dodgerblue2", size = 6),
panel.background = element_rect(fill = "white",colour = "black", size = 1, linetype = "solid")) +
#labs(title= titlename, subtitle = paste('',toString(signature), sep=''),
labs(title=titlename)
#,
# x = "tSNE 1", y = "tSNE 2")
return(FP)
}
############## Intact sample preproc
sample1_Td='/Users/maurizio.aurora/Dropbox (HSR Global)/WORKSPACE/Bonanomi/Bonanomi_1287_scRNA_injury/7_bioinfo/COUNTS_reads_mapped_over_mm10_plus_Tomato/1/filtered_feature_bc_matrix'
CellRanger_sample1_Td.count <- Read10X(data.dir = sample1_Td)
S1_Td <- CreateSeuratObject(counts = CellRanger_sample1_Td.count, project = "1", min.cells = 5, min.features = 200)
S1_Td[["percent.mt"]] <- PercentageFeatureSet(S1_Td, pattern = "^mt-")
S1_Td[["percent.Rpl"]] <- PercentageFeatureSet(S1_Td, pattern = "Rpl")
S1_Td$stim <- "1"
VlnPlot(S1_Td, features = c("nFeature_RNA", "nCount_RNA", "percent.mt"), ncol = 3)
min_nFeature_RNA = 200
max_nFeature_RNA = 7000
max_percent_MT = 20
S1_Td.subset <- subset(S1_Td,
subset = nFeature_RNA > min_nFeature_RNA & nFeature_RNA < max_nFeature_RNA & percent.mt < max_percent_MT)
FeatureScatter(S1_Td.subset, feature1 = "nCount_RNA", feature2 = "percent.mt",cols = NULL)
FeatureScatter(S1_Td.subset, feature1 = "nCount_RNA", feature2 = "nFeature_RNA")
######################### 7D post Injury sample preproc
sample2_Td='/Users/maurizio.aurora/Dropbox (HSR Global)/WORKSPACE/Bonanomi/Bonanomi_1287_scRNA_injury/7_bioinfo/COUNTS_reads_mapped_over_mm10_plus_Tomato/2/filtered_feature_bc_matrix'
CellRanger_sample2_Td.count <- Read10X(data.dir = sample2_Td)
S2_Td <- CreateSeuratObject(counts = CellRanger_sample2_Td.count, project = "2", min.cells = 5, min.features = 200)
S2_Td[["percent.mt"]] <- PercentageFeatureSet(S2_Td, pattern = "^mt-")
S2_Td[["percent.Rpl"]] <- PercentageFeatureSet(S2_Td, pattern = "^Rpl-")
S2_Td$stim <- "2"
VlnPlot(S2_Td, features = c("nFeature_RNA", "nCount_RNA", "percent.mt"), ncol = 3)
min_nFeature_RNA = 200
max_nFeature_RNA = 8000
max_percent_MT = 20
S2_Td.subset <- subset(S2_Td,
subset = nFeature_RNA > min_nFeature_RNA & nFeature_RNA < max_nFeature_RNA & percent.mt < max_percent_MT)
FeatureScatter(S2_Td.subset, feature1 = "nCount_RNA", feature2 = "percent.mt",cols = NULL)
FeatureScatter(S2_Td.subset, feature1 = "nCount_RNA", feature2 = "nFeature_RNA")
######## INTEGRATED ##########################################
#Integrate intact and injury samples and run the standard workflow for visualization and clustering
#seurat version 3.2.2
integrated_bon1T <- FindIntegrationAnchors(object.list = list(S1_Td.subset, S2_Td.subset), dims = 1:20)
features.to.integrate = integrated_bon1T@anchor.features
integrated_bon1T <- IntegrateData(anchorset = integrated_bon1T, dims = 1:20, features.to.integrate = features.to.integrate)
DefaultAssay(integrated_bon1T) <- "integrated"
integrated_bon1T <- CellCycleScoring(integrated_bon1T, s.features = s_genes, g2m.features = g2m_genes, set.ident = TRUE)
integrated_bon1T <- ScaleData(integrated_bon1T, vars.to.regress = c("percent.mt", "nFeature_RNA", "S.Score", "G2M.Score"), features = features.to.integrate, verbose = FALSE)
integrated_bon1T <- RunPCA(integrated_bon1T, npcs = 30, verbose = FALSE)
# t-SNE and Clustering
integrated_bon1T <- RunUMAP(integrated_bon1T, reduction = "pca", dims = 1:20)
integrated_bon1T <- FindNeighbors(integrated_bon1T, reduction = "pca", dims = 1:20)
integrated_bon1T <- FindClusters(integrated_bon1T, resolution = 0.3)
DimPlot(integrated_bon1T, reduction = "umap")
#FigS1 K
# check reporter gene
FeaturePlot(integrated_bon1T, "TdTomato", order = T)
# check EC
FeaturePlot(integrated_bon1T, "Pecam1", order = T)
FeaturePlot(integrated_bon1T, "Cdh5", order = T)
# check pericytes
FeaturePlot(integrated_bon1T, "Rgs5", order = T)
# check LEC
FeaturePlot(integrated_bon1T, "Lyve1", order = T)
# check MES
FeaturePlot(integrated_bon1T, "Pdgfra", order = T)
FeaturePlot(integrated_bon1T, "Pdgfrb", order = T)
# check NK
FeaturePlot(integrated_bon1T, "Nkg7", order = T)
# check cell proliferation signature genes
dividing = c("Cdk1", "Birc1", "Mki67", "Top2a")
Plot_sign(integrated_bon1T,
signature= dividing,
operator = sum, titlename = "dividing")
# assign names to macroclusters
new.cluster.ids.lit1 <- c('EC',
'EC',
'EC',
'FRC',
'FRC',
'EC',
'EC',
'LEC',
'TCELLS')
names(new.cluster.ids.lit1) <- levels(integrated_bon1T)
renamed <- RenameIdents(integrated_bon1T, new.cluster.ids.lit1)
renamed <- RenameIdents(integrated_bon1T, new.cluster.ids.lit1)
# remove T cells
renamed <- subset(object = renamed, idents = "TCELLS", invert = TRUE)
# FigS1 UMAPs
# FigS1 I
pdf("all_cells_integrated_newcols_newred.pdf", 12, 10)
DimPlot(renamed, cols = c('EC' = '#f56947',
'FIBRO' = '#9FE2BF',
'PERI'= '#0099CC',
'LEC'= '#ffcc00'), pt.size = 5) +
theme(legend.position = "none")
dev.off()
#Fig S1 J
pdf("all_cells_integrated_group_by_stim.pdf", 12, 10)
DimPlot(renamed, group.by = "stim", pt.size = 5) +
theme(legend.position = "none") +
theme(plot.title = element_blank())
dev.off()
# FigS1 FeaturePlots
pdf("FP_all_cells_integrated_newcols_Lyve1.pdf")
FeaturePlot(renamed, "Lyve1", order = T, pt.size = 5)
dev.off()
pdf("FP_all_cells_integrated_newcols_Pecam1.pdf")
FeaturePlot(renamed, "Pecam1", order = T, pt.size = 5)
dev.off()
pdf("FP_all_cells_integrated_newcols_Pdgfra.pdf")
FeaturePlot(renamed, "Pdgfra", order = T, pt.size = 5)
dev.off()
pdf("FP_all_cells_integrated_newcols_Tomato.pdf")
FeaturePlot(renamed, "TdTomato", order = T, pt.size = 5)
dev.off()
pdf("FP_all_cells_integrated_newcols_Cdh5.pdf")
FeaturePlot(renamed, "Cdh5", order = T, pt.size = 5)
dev.off()
pdf("FP_all_cells_integrated_newcols_Rgs5.pdf")
FeaturePlot(renamed, "Rgs5", order = T, pt.size = 5)
dev.off()