Spaces:
Build error
Build error
Update PFCapp.qmd
Browse files- PFCapp.qmd +537 -537
PFCapp.qmd
CHANGED
@@ -1,537 +1,537 @@
|
|
1 |
-
---
|
2 |
-
title: "SPIDER-web"
|
3 |
-
author: "Cao Lab"
|
4 |
-
server: shiny
|
5 |
-
format:
|
6 |
-
dashboard:
|
7 |
-
logo: https://ZhengTiger.github.io/picx-images-hosting/PFCapp/Logo-circle.7sn4nqapcl.png
|
8 |
-
nav-buttons:
|
9 |
-
- icon: github
|
10 |
-
href: https://github.com/ZhengTiger/SPIDER-seq
|
11 |
-
---
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
# Home
|
16 |
-
|
17 |
-
<p style="font-size: 50px; font-weight: bold; text-align: center;">
|
18 |
-
|
19 |
-
<br>
|
20 |
-
|
21 |
-
<img src="https://ZhengTiger.github.io/picx-images-hosting/PFCapp/
|
22 |
-
|
23 |
-
<br>
|
24 |
-
<br>
|
25 |
-
|
26 |
-
<p style="font-size: 30px; font-weight: bold; text-align: left;">
|
27 |
-
|
28 |
-
</p>
|
29 |
-
|
30 |
-
<p style="font-size: 20px; text-align: justify;">
|
31 |
-
|
32 |
-
</p>
|
33 |
-
|
34 |
-
|
35 |
-
<br>
|
36 |
-
|
37 |
-
<p style="font-size: 30px; font-weight: bold; text-align: left;">
|
38 |
-
Interactively exploring our data
|
39 |
-
</p>
|
40 |
-
|
41 |
-
<p style="font-size: 20px; font-weight: bold; text-align: left;">
|
42 |
-
scRNAseq
|
43 |
-
</p>
|
44 |
-
|
45 |
-
<p style="font-size: 20px; text-align: justify;">
|
46 |
-
Our scRNAseq dataset sequenced the PFC of 3 mice. It contains the transcriptome of mouse PFC and the projectome information of 24 PFC targets. Users can browse the following content through the
|
47 |
-
</p>
|
48 |
-
|
49 |
-
- scRNAseq Clustering: Select different resolutions to view cell clusters on UMAP
|
50 |
-
- Gene Expression: Select different genes to view their expression on UMAP
|
51 |
-
- Barcode Expression: Select different projections to view their expression on UMAP
|
52 |
-
- Barcode Cell Numbers: View PFC projection cell numbers in different cell clusters
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
<p style="font-size: 20px; font-weight: bold; text-align: left;">
|
57 |
-
Spatial data
|
58 |
-
</p>
|
59 |
-
|
60 |
-
<p style="font-size: 20px; text-align: justify;">
|
61 |
-
Our spatial dataset sequenced 36 slices of mouse PFC. It contains 32 genes and 15 targets information of mouse PFC. Users can browse the following content through the spatial page:
|
62 |
-
</p>
|
63 |
-
|
64 |
-
- Spatial Clustering: Select different resolutions to view the spatial distribution of cell clusters
|
65 |
-
- Spatial Gene Expression: Select different genes to view their spatial expression
|
66 |
-
- Spatial Barcode Expression: Select different projections to view their spatial expression
|
67 |
-
- Barcode Spatial Distribution: View the spatial distribution of PFC projection neurons along anterior-posterior and ventralis-dorsalis axes
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
<p style="font-size: 20px; font-weight: bold; text-align: left;">
|
72 |
-
3D
|
73 |
-
</p>
|
74 |
-
|
75 |
-
<p style="font-size: 20px; text-align: justify;">
|
76 |
-
3D interactive visualization of mouse PFC. Users can browse the following content through the 3D page:
|
77 |
-
</p>
|
78 |
-
|
79 |
-
- Transcriptome 3D Visualization: Select different transcriptome cell clusters to interactively view them in 3D
|
80 |
-
- Projectome 3D Visualization: Select different Projectome targets to interactively view them in 3D
|
81 |
-
|
82 |
-
|
83 |
-
<p style="font-size: 20px; font-weight: bold; text-align: left;">
|
84 |
-
Download
|
85 |
-
</p>
|
86 |
-
|
87 |
-
<p style="font-size: 20px; text-align: justify;">
|
88 |
-
Download the raw and processed data from this study.
|
89 |
-
</p>
|
90 |
-
|
91 |
-
|
92 |
-
```{r}
|
93 |
-
#| context: setup
|
94 |
-
#| warning: false
|
95 |
-
#| message: false
|
96 |
-
|
97 |
-
library(ggplot2)
|
98 |
-
library(Seurat)
|
99 |
-
library(shiny)
|
100 |
-
library(rgl)
|
101 |
-
library(ggdark)
|
102 |
-
library(viridis)
|
103 |
-
library(dplyr)
|
104 |
-
|
105 |
-
source("R/Palettes.R")
|
106 |
-
source('R/includes.R')
|
107 |
-
Adult.Ex <- readRDS('data/Adult.Ex.rds')
|
108 |
-
sp.PFC <- readRDS('data/sp.PFC.rds')
|
109 |
-
|
110 |
-
clean_cells <- colnames(Adult.Ex)[!(
|
111 |
-
(Adult.Ex$Ex_subtype %in% c("CT","NP") & Adult.Ex$BC_num>0) |
|
112 |
-
(Adult.Ex$sample %in% c("Adult2","Adult3") & Adult.Ex$Ex_subtype=="PT" & Adult.Ex$BC_num>0)
|
113 |
-
)]
|
114 |
-
Adult.Ex.clean <- subset(Adult.Ex, cells = clean_cells)
|
115 |
-
|
116 |
-
options(rgl.useNULL = TRUE)
|
117 |
-
```
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
# scRNAseq {scrolling="true"}
|
124 |
-
|
125 |
-
## {.sidebar}
|
126 |
-
|
127 |
-
```{r}
|
128 |
-
selectInput('cluster', 'Select Cluster', c("SubType_Layer","SubType"))
|
129 |
-
```
|
130 |
-
|
131 |
-
```{r}
|
132 |
-
selectInput('gene', 'Select Gene', rownames(Adult.Ex),
|
133 |
-
selected = "Cux2")
|
134 |
-
```
|
135 |
-
|
136 |
-
```{r}
|
137 |
-
Barcode <- c(
|
138 |
-
"ITi-D", "ITi-V", "ITc", "PTi",
|
139 |
-
'VIS-I','SSp-I','CP-I','AUD-I','RSP-I',
|
140 |
-
'BLA-I','ACB-I','ENTl-I','AId-I','ECT-I',
|
141 |
-
'ACB-C','PL-C','ECT-C','ENTl-C',
|
142 |
-
'BLA-C','CP-C','AId-C','RSP-C',
|
143 |
-
'MD-I','RE-I','DR-I','VTA-I','LHA-I','SC-I')
|
144 |
-
selectInput('target', 'Select Target', Barcode, selected = "CP-I")
|
145 |
-
```
|
146 |
-
|
147 |
-
|
148 |
-
## Column
|
149 |
-
|
150 |
-
### Row
|
151 |
-
|
152 |
-
#### Column
|
153 |
-
|
154 |
-
```{r}
|
155 |
-
plotOutput('cluster_plot')
|
156 |
-
```
|
157 |
-
|
158 |
-
#### Column
|
159 |
-
|
160 |
-
```{r}
|
161 |
-
plotOutput('gene_plot')
|
162 |
-
```
|
163 |
-
|
164 |
-
### Row
|
165 |
-
|
166 |
-
#### Column
|
167 |
-
|
168 |
-
```{r}
|
169 |
-
plotOutput('target_plot')
|
170 |
-
```
|
171 |
-
|
172 |
-
#### Column
|
173 |
-
|
174 |
-
```{r}
|
175 |
-
plotOutput('target_bar_plot')
|
176 |
-
```
|
177 |
-
|
178 |
-
|
179 |
-
```{r}
|
180 |
-
#| context: server
|
181 |
-
|
182 |
-
output$cluster_plot <- renderPlot({
|
183 |
-
DimPlot(
|
184 |
-
Adult.Ex,
|
185 |
-
reduction = 'umap',
|
186 |
-
group.by = input$cluster,
|
187 |
-
cols = col_cluster[[input$cluster]],
|
188 |
-
label = T
|
189 |
-
) +
|
190 |
-
coord_fixed()
|
191 |
-
})
|
192 |
-
|
193 |
-
output$gene_plot <- renderPlot({
|
194 |
-
FeaturePlot(
|
195 |
-
Adult.Ex,
|
196 |
-
features = input$gene) +
|
197 |
-
coord_fixed()
|
198 |
-
})
|
199 |
-
|
200 |
-
output$target_plot <- renderPlot({
|
201 |
-
Barcode <- c(
|
202 |
-
"ITi-D", "ITi-V", "ITc", "PTi",
|
203 |
-
'VIS-I','SSp-I','CP-I','AUD-I','RSP-I',
|
204 |
-
'BLA-I','ACB-I','ENTl-I','AId-I','ECT-I',
|
205 |
-
'ACB-C','PL-C','ECT-C','ENTl-C',
|
206 |
-
'BLA-C','CP-C','AId-C','RSP-C',
|
207 |
-
'MD-I','RE-I','DR-I','VTA-I','LHA-I','SC-I'
|
208 |
-
)
|
209 |
-
seu <- Adult.Ex.clean
|
210 |
-
colnames([email protected])[match(c("ITi_D_score", "ITi_V_score", "ITc_score", "PTi_score"),colnames([email protected]))] <- c("ITi-D", "ITi-V","ITc","PTi")
|
211 |
-
[email protected][,Barcode][is.na([email protected][,Barcode])] <- 0
|
212 |
-
FeaturePlot(
|
213 |
-
seu, features = input$target, order = T) +
|
214 |
-
coord_fixed()
|
215 |
-
})
|
216 |
-
|
217 |
-
output$target_bar_plot <- renderPlot({
|
218 |
-
seu <- Adult.Ex.clean
|
219 |
-
if (input$target %in% c("ITi-D", "ITi-V","ITc","PTi")){
|
220 |
-
df <- as.data.frame(table([email protected][,input$cluster][which(seu$Proj_module==input$target)]))
|
221 |
-
}else{
|
222 |
-
df <- as.data.frame(table([email protected][,input$cluster][which([email protected][,input$target]>0)]))
|
223 |
-
}
|
224 |
-
colnames(df) <- c("Celltypes","Cellnum")
|
225 |
-
|
226 |
-
ggplot(df, aes(x=Celltypes, y=Cellnum, fill=Celltypes)) +
|
227 |
-
geom_col() +
|
228 |
-
scale_fill_manual(values = col_cluster[[input$cluster]]) +
|
229 |
-
theme_classic() +
|
230 |
-
theme(axis.text.x = element_text(angle = 25, hjust = 1),
|
231 |
-
plot.title = element_text(hjust = 0.5)) +
|
232 |
-
labs(title = paste("PFC → ",input$target," cell numbers in different cell type",
|
233 |
-
sep=""))
|
234 |
-
})
|
235 |
-
```
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
# Spatial {scrolling="true"}
|
242 |
-
|
243 |
-
## {.sidebar}
|
244 |
-
|
245 |
-
```{r}
|
246 |
-
selectInput('sp_slice', 'Select Slice', unique(sp.PFC$slice),
|
247 |
-
selected = "IT_slice_10")
|
248 |
-
```
|
249 |
-
|
250 |
-
```{r}
|
251 |
-
selectInput('sp_cluster', 'Select Cluster', c("SubType_Layer","SubType"))
|
252 |
-
```
|
253 |
-
|
254 |
-
```{r}
|
255 |
-
selectInput('sp_gene', 'Select Gene', rownames(sp.PFC),
|
256 |
-
selected = "Cux2")
|
257 |
-
```
|
258 |
-
|
259 |
-
```{r}
|
260 |
-
sp_Barcode <- c(
|
261 |
-
"ITi-D", "ITi-V", "ITc", "PTi",
|
262 |
-
'VIS-I','SSp-I','CP-I','AUD-I','RSP-I',
|
263 |
-
'BLA-I','ACB-I','AId-I','ECT-I',
|
264 |
-
'ACB-C','ECT-C','CP-C','AId-C','RSP-C',
|
265 |
-
'LHA-I')
|
266 |
-
selectInput('sp_target', 'Select Target', sp_Barcode)
|
267 |
-
```
|
268 |
-
|
269 |
-
|
270 |
-
## Column
|
271 |
-
|
272 |
-
### Row
|
273 |
-
|
274 |
-
#### Column
|
275 |
-
|
276 |
-
```{r}
|
277 |
-
#| fig-width: 10
|
278 |
-
|
279 |
-
plotOutput('sp_cluster_plot')
|
280 |
-
```
|
281 |
-
|
282 |
-
#### Column
|
283 |
-
|
284 |
-
```{r}
|
285 |
-
#| fig-width: 10
|
286 |
-
|
287 |
-
plotOutput('sp_gene_plot')
|
288 |
-
```
|
289 |
-
|
290 |
-
### Row
|
291 |
-
|
292 |
-
#### Column
|
293 |
-
|
294 |
-
```{r}
|
295 |
-
#| fig-width: 10
|
296 |
-
|
297 |
-
plotOutput('sp_target_plot')
|
298 |
-
```
|
299 |
-
|
300 |
-
#### Column
|
301 |
-
|
302 |
-
```{r}
|
303 |
-
#| fig-width: 10
|
304 |
-
|
305 |
-
plotOutput('sp_target_line_plot')
|
306 |
-
```
|
307 |
-
|
308 |
-
```{r}
|
309 |
-
#| context: server
|
310 |
-
|
311 |
-
output$sp_cluster_plot <- renderPlot({
|
312 |
-
df <- data.frame(
|
313 |
-
x = sp.PFC$ML_new[sp.PFC$slice==input$sp_slice],
|
314 |
-
y = sp.PFC$DV_new[sp.PFC$slice==input$sp_slice],
|
315 |
-
type = [email protected][sp.PFC$slice==input$sp_slice, input$sp_cluster]
|
316 |
-
)
|
317 |
-
ggplot(df, aes(x=x, y=y, color=type)) +
|
318 |
-
geom_point(size=1) +
|
319 |
-
scale_color_manual(values = col_cluster[[input$sp_cluster]]) +
|
320 |
-
labs(title = paste(input$slice,'cell types in spatial')) +
|
321 |
-
guides(color=guide_legend(nrow = 2, byrow = TRUE, reverse = T,
|
322 |
-
override.aes = list(size=2))) +
|
323 |
-
coord_fixed() +
|
324 |
-
ggdark::dark_theme_void() +
|
325 |
-
theme(plot.title = element_text(size = 20, hjust = 0.5),
|
326 |
-
legend.position = 'bottom', legend.title=element_blank(),
|
327 |
-
legend.text = element_text(size=10))
|
328 |
-
})
|
329 |
-
|
330 |
-
output$sp_gene_plot <- renderPlot({
|
331 |
-
df <- data.frame(
|
332 |
-
X = sp.PFC$ML_new,
|
333 |
-
Y = sp.PFC$DV_new,
|
334 |
-
Zscore = scale(log1p(sp.PFC@assays$RNA@counts[input$sp_gene,]))
|
335 |
-
)
|
336 |
-
df <- df[which(sp.PFC$slice==input$sp_slice),]
|
337 |
-
df$Zscore[df$Zscore<0] <- 0
|
338 |
-
df$Zscore[df$Zscore>3] <- 3
|
339 |
-
df <- df[order(df$Zscore),]
|
340 |
-
ggplot(df,aes(x=X,y=Y)) +
|
341 |
-
geom_point(aes(colour=Zscore), size=1) +
|
342 |
-
scale_color_gradientn(colours = viridis(n = 256, option = "D", direction = 1)) +
|
343 |
-
ggdark::dark_theme_void() +
|
344 |
-
labs(title = input$sp_gene) +
|
345 |
-
theme(plot.title = element_text(size = 20, hjust = 0.5),
|
346 |
-
legend.position = 'bottom') +
|
347 |
-
coord_fixed()
|
348 |
-
})
|
349 |
-
|
350 |
-
output$sp_target_plot <- renderPlot({
|
351 |
-
seu <- sp.PFC
|
352 |
-
seu$PTi[is.na(seu$PTi)] <- 0
|
353 |
-
seu$ITi_D[is.na(seu$ITi_D)] <- 0
|
354 |
-
seu$ITi_V[is.na(seu$ITi_V)] <- 0
|
355 |
-
seu$ITc[is.na(seu$ITc)] <- 0
|
356 |
-
colnames([email protected])[match(c("ITi_D","ITi_V"),colnames([email protected]))] <- c("ITi-D","ITi-V")
|
357 |
-
df <- data.frame(
|
358 |
-
X = seu$ML_new,
|
359 |
-
Y = seu$DV_new,
|
360 |
-
Zscore = scale(log1p([email protected][,input$sp_target]))
|
361 |
-
)
|
362 |
-
df <- df[which(seu$slice==input$sp_slice),]
|
363 |
-
df$Zscore[df$Zscore<0] <- 0
|
364 |
-
df$Zscore[df$Zscore>3] <- 3
|
365 |
-
df <- df[order(df$Zscore),]
|
366 |
-
ggplot(df, aes(x=X,y=Y)) +
|
367 |
-
geom_point(aes(colour=Zscore), size=1) +
|
368 |
-
scale_color_gradientn(colours = viridis(n = 256, option = "E", direction = 1)) +
|
369 |
-
ggdark::dark_theme_void() +
|
370 |
-
labs(title = input$sp_target) +
|
371 |
-
theme(plot.title = element_text(size = 20, hjust = 0.5),
|
372 |
-
legend.position = 'bottom') +
|
373 |
-
coord_fixed()
|
374 |
-
})
|
375 |
-
|
376 |
-
output$sp_target_line_plot <- renderPlot({
|
377 |
-
# AP
|
378 |
-
seu <- subset(sp.PFC, cells=colnames(sp.PFC)[which(sp.PFC$ABA_hemisphere=="Left")])
|
379 |
-
slice <- unique(seu$slice)
|
380 |
-
df <- data.frame('slice'=slice)
|
381 |
-
for (i in 1:length(slice)){
|
382 |
-
if (input$sp_target %in% c("ITi-D","ITi-V","ITc","PTi")){
|
383 |
-
df$cellnum[i] <- length(which(seu$slice==slice[i] & seu$Proj_module==input$sp_target))/length(which(seu$slice==slice[i] & seu$BC_num>0))
|
384 |
-
}else{
|
385 |
-
df$cellnum[i] <- length(which(seu$slice==slice[i] & [email protected][,input$sp_target]>0))/length(which(seu$slice==slice[i] & seu$BC_num>0))
|
386 |
-
}
|
387 |
-
}
|
388 |
-
df$x <- c(1:36)
|
389 |
-
p1 <- ggplot(df, aes(x=x, y=cellnum)) +
|
390 |
-
geom_point(alpha=0.5, size=3, color=col_subtype_target[input$sp_target]) +
|
391 |
-
geom_smooth(se = F, linewidth=1.5, color=col_subtype_target[input$sp_target]) +
|
392 |
-
theme_bw() +
|
393 |
-
scale_x_continuous(breaks = seq(0,35,5)) +
|
394 |
-
theme(text = element_text(size=15),
|
395 |
-
plot.title = element_text(size = 20, hjust = 0.5)) +
|
396 |
-
labs(x='A → P',y='Cell proportion')
|
397 |
-
|
398 |
-
# DV
|
399 |
-
sp_Barcode <- c("ITi-D", "ITi-V", "ITc", "PTi",
|
400 |
-
'VIS-I','SSp-I','CP-I','AUD-I','RSP-I',
|
401 |
-
'BLA-I','ACB-I','AId-I','ECT-I',
|
402 |
-
'ACB-C','ECT-C','CP-C','AId-C','RSP-C',
|
403 |
-
'LHA-I')
|
404 |
-
seu <- subset(sp.PFC, cells=colnames(sp.PFC)[which(sp.PFC$ABA_hemisphere=="Left")])
|
405 |
-
colnames([email protected])[match(c("ITi_D","ITi_V"),colnames([email protected]))] <- c("ITi-D","ITi-V")
|
406 |
-
bc_slice <- [email protected][,c(sp_Barcode, 'Y','BC_num')]
|
407 |
-
bc_slice <-
|
408 |
-
bc_slice |>
|
409 |
-
mutate(bin = cut(Y, breaks = 36))
|
410 |
-
bin <- sort(unique(bc_slice$bin))
|
411 |
-
bc_slice$bin_index <- match(bc_slice$bin, bin)
|
412 |
-
df <- data.frame('bin_index'=c(1:36))
|
413 |
-
for (i in 1:36){
|
414 |
-
df$cellnum[i] <- length(which(bc_slice$bin_index==i &
|
415 |
-
bc_slice[,input$sp_target]>0))/
|
416 |
-
length(which(bc_slice$bin_index==i & bc_slice$BC_num>0))
|
417 |
-
}
|
418 |
-
df$x <- c(1:36)
|
419 |
-
p2 <- ggplot(df, aes(x=x, y=cellnum)) +
|
420 |
-
geom_point(alpha=0.5, size=3, color=col_subtype_target[input$sp_target]) +
|
421 |
-
geom_smooth(se = F, linewidth=1.5, color=col_subtype_target[input$sp_target]) +
|
422 |
-
theme_bw() +
|
423 |
-
scale_x_continuous(breaks = seq(0,35,5)) +
|
424 |
-
theme(text = element_text(size=15),
|
425 |
-
plot.title = element_text(size = 20, hjust = 0.5)) +
|
426 |
-
labs(x='V → D',y='Cell proportion')
|
427 |
-
p1/p2
|
428 |
-
})
|
429 |
-
```
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
# 3D
|
437 |
-
|
438 |
-
## {.sidebar}
|
439 |
-
|
440 |
-
```{r}
|
441 |
-
sp_Barcode <- c("ITi-D", "ITi-V", "ITc", "PTi",
|
442 |
-
'VIS-I','SSp-I','CP-I','AUD-I','RSP-I',
|
443 |
-
'BLA-I','ACB-I','AId-I','ECT-I',
|
444 |
-
'ACB-C','ECT-C','CP-C','AId-C','RSP-C',
|
445 |
-
'LHA-I')
|
446 |
-
waiter::use_waiter()
|
447 |
-
selectInput('subtype_3d', 'Select SubType', sort(unique(sp.PFC$SubType)))
|
448 |
-
selectInput('target_3d', 'Select Target', sp_Barcode)
|
449 |
-
```
|
450 |
-
|
451 |
-
|
452 |
-
## Column
|
453 |
-
|
454 |
-
```{r}
|
455 |
-
rglwidgetOutput('spatial_subtype', width = "100%")
|
456 |
-
```
|
457 |
-
|
458 |
-
|
459 |
-
```{r}
|
460 |
-
#| context: server
|
461 |
-
|
462 |
-
observeEvent(input$target_3d,{
|
463 |
-
waiter::Waiter$new(id = "spatial_subtype", color="black")$show()
|
464 |
-
output$spatial_subtype <- renderRglwidget({
|
465 |
-
if (input$target_3d %in% c("ITi-D", "ITi-V", "ITc", "PTi")){
|
466 |
-
df_plot <- [email protected][which(sp.PFC$Proj_module==input$target_3d),]
|
467 |
-
}else{
|
468 |
-
df_plot <- [email protected][which([email protected][,input$target_3d] > 0),]
|
469 |
-
}
|
470 |
-
|
471 |
-
open3d()
|
472 |
-
bg3d(color = "black")
|
473 |
-
par3d(userMatrix = rotationMatrix(-pi/6, -1, 1, 0), zoom = 0.6)
|
474 |
-
acr.list <- c("MOs","PL","ORBm","ACAd","ILA","DP","ACAv")
|
475 |
-
|
476 |
-
for(acr in acr.list){
|
477 |
-
mesh <- mesh3d.allen.annot.from.id(get.id.from.acronym(acr))
|
478 |
-
col <- "lightgray"
|
479 |
-
shade3d(mesh, col = col, material = list(lit=FALSE), alpha = 0.1)
|
480 |
-
}
|
481 |
-
|
482 |
-
spheres3d(x = df_plot$ML_new,
|
483 |
-
y = df_plot$DV_new,
|
484 |
-
z = df_plot$AP_new,
|
485 |
-
col = col_subtype_target[input$target_3d], radius=0.01, alpha=1)
|
486 |
-
rglwidget()
|
487 |
-
})
|
488 |
-
})
|
489 |
-
|
490 |
-
observeEvent(input$subtype_3d,{
|
491 |
-
waiter::Waiter$new(id = "spatial_subtype", color="black")$show()
|
492 |
-
output$spatial_subtype <- renderRglwidget({
|
493 |
-
df_plot <- [email protected][which(sp.PFC$SubType == input$subtype_3d),]
|
494 |
-
|
495 |
-
open3d()
|
496 |
-
bg3d(color = "black")
|
497 |
-
par3d(userMatrix = rotationMatrix(-pi/6, -1, 1, 0), zoom = 0.6)
|
498 |
-
acr.list <- c("MOs","PL","ORBm","ACAd","ILA","DP","ACAv")
|
499 |
-
|
500 |
-
for(acr in acr.list){
|
501 |
-
mesh <- mesh3d.allen.annot.from.id(get.id.from.acronym(acr))
|
502 |
-
col <- "lightgray"
|
503 |
-
shade3d(mesh, col = col, material = list(lit=FALSE), alpha = 0.1)
|
504 |
-
}
|
505 |
-
|
506 |
-
spheres3d(x = df_plot$ML_new,
|
507 |
-
y = df_plot$DV_new,
|
508 |
-
z = df_plot$AP_new,
|
509 |
-
col = col_subtype_target[input$subtype_3d], radius=0.01, alpha=1)
|
510 |
-
rglwidget()
|
511 |
-
})
|
512 |
-
})
|
513 |
-
```
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
# Download
|
519 |
-
|
520 |
-
<p style="font-size: 20px; text-align: justify;">
|
521 |
-
The raw single cell RNA-seq data are available from GEO (<a href="https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE273066">GSE273066</a>).
|
522 |
-
</p>
|
523 |
-
|
524 |
-
<p style="font-size: 20px; text-align: justify;">
|
525 |
-
The raw image data for this study are available via Hugging Face at <a href="https://huggingface.co/TigerZheng/SPIDER-STdata">TigerZheng/SPIDER-STdata</a>. You can download and unzip the .zip file and then use <a href="https://github.com/hms-dbmi/viv">viv</a> to visualize our raw data.
|
526 |
-
An example: <a href="https://avivator.gehlenborglab.org/?image_url=https://huggingface.co/TigerZheng/SPIDER-STdata/resolve/main/IT_slice_36_reordered.ome.tiff">IT_slice_36</a>.</p>
|
527 |
-
|
528 |
-
<p style="font-size: 20px; text-align: justify;">
|
529 |
-
The processed data can be downloaded here:</p>
|
530 |
-
|
531 |
-
- All cells data: <a href="https://huggingface.co/spaces/TigerZheng/SPIDER-web/resolve/main/data/all.Adult.rds?download=true">all.Adult.rds</a>
|
532 |
-
- Excitatory data: <a href="https://huggingface.co/spaces/TigerZheng/SPIDER-web/resolve/main/data/Adult.Ex.rds?download=true">Adult.Ex.rds</a>
|
533 |
-
- Spatial data: <a href="https://huggingface.co/spaces/TigerZheng/SPIDER-web/resolve/main/data/sp.PFC.rds?download=true">sp.PFC.rds</a>
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
|
|
1 |
+
---
|
2 |
+
title: "SPIDER-web"
|
3 |
+
author: "Cao Lab"
|
4 |
+
server: shiny
|
5 |
+
format:
|
6 |
+
dashboard:
|
7 |
+
logo: https://ZhengTiger.github.io/picx-images-hosting/PFCapp/Logo-circle.7sn4nqapcl.png
|
8 |
+
nav-buttons:
|
9 |
+
- icon: github
|
10 |
+
href: https://github.com/ZhengTiger/SPIDER-seq
|
11 |
+
---
|
12 |
+
|
13 |
+
|
14 |
+
|
15 |
+
# Home
|
16 |
+
|
17 |
+
<p style="font-size: 50px; font-weight: bold; text-align: center;">Deciphering the single-cell spatial projectomics and transcriptomics organization in PFC by SPIDER-Seq</p>
|
18 |
+
|
19 |
+
<br>
|
20 |
+
|
21 |
+
<img src="https://ZhengTiger.github.io/picx-images-hosting/PFCapp/Figure1A.26lgt5fr15.jpg" style="width: 100%;">
|
22 |
+
|
23 |
+
<br>
|
24 |
+
<br>
|
25 |
+
|
26 |
+
<p style="font-size: 30px; font-weight: bold; text-align: left;">
|
27 |
+
Summary
|
28 |
+
</p>
|
29 |
+
|
30 |
+
<p style="font-size: 20px; text-align: justify;">
|
31 |
+
Deciphering the connectivity, transcriptome, and spatial-omics integrated multi-module brain atlas and the underlying organization principles remains challenging. We developed a cost-effective Single-cell Projectome-transcriptome In situ Deciphering Sequencing (SPIDER-Seq) method by combining viral barcoding tracing with single-cell sequencing and spatial-omics. Leveraging SPIDER-Seq, we delineated a comprehensive integrated single-cell spatial molecular, cellular and projectomic atlas of mouse prefrontal cortex (PFC). The projectomic and transcriptomic cell clusters display distinct organization principle, but are coordinately configured in PFC. These projection neurons gradiently distributed in PFC aligning with their wiring patterns, and importantly, show higher co-projection probability to the downstream nuclei with reciprocal circuit connections. Moreover, we depicted PFC neural transmission map, in which neural transmission molecues (neurotransmitter/neuropeptide and the receptors) distinctly express in different circuits. Finally, we predicted neuron projections by integrated gene profile and spatial information with high accuracy via machine learning. Our study could greatly facilitate to delineating brain multi-module network and understanding neural computation.
|
32 |
+
</p>
|
33 |
+
|
34 |
+
|
35 |
+
<br>
|
36 |
+
|
37 |
+
<p style="font-size: 30px; font-weight: bold; text-align: left;">
|
38 |
+
Interactively exploring our data
|
39 |
+
</p>
|
40 |
+
|
41 |
+
<p style="font-size: 20px; font-weight: bold; text-align: left;">
|
42 |
+
scRNAseq
|
43 |
+
</p>
|
44 |
+
|
45 |
+
<p style="font-size: 20px; text-align: justify;">
|
46 |
+
Our scRNAseq dataset sequenced the PFC of 3 mice. It contains the transcriptome of mouse PFC and the projectome information of 24 PFC targets. Users can browse the following content through the scRNAseq page:
|
47 |
+
</p>
|
48 |
+
|
49 |
+
- scRNAseq Clustering: Select different resolutions to view cell clusters on UMAP
|
50 |
+
- Gene Expression: Select different genes to view their expression on UMAP
|
51 |
+
- Barcode Expression: Select different projections to view their expression on UMAP
|
52 |
+
- Barcode Cell Numbers: View PFC projection cell numbers in different cell clusters
|
53 |
+
|
54 |
+
|
55 |
+
|
56 |
+
<p style="font-size: 20px; font-weight: bold; text-align: left;">
|
57 |
+
Spatial data
|
58 |
+
</p>
|
59 |
+
|
60 |
+
<p style="font-size: 20px; text-align: justify;">
|
61 |
+
Our spatial dataset sequenced 36 slices of mouse PFC. It contains 32 genes and 15 targets information of mouse PFC. Users can browse the following content through the spatial page:
|
62 |
+
</p>
|
63 |
+
|
64 |
+
- Spatial Clustering: Select different resolutions to view the spatial distribution of cell clusters
|
65 |
+
- Spatial Gene Expression: Select different genes to view their spatial expression
|
66 |
+
- Spatial Barcode Expression: Select different projections to view their spatial expression
|
67 |
+
- Barcode Spatial Distribution: View the spatial distribution of PFC projection neurons along anterior-posterior and ventralis-dorsalis axes
|
68 |
+
|
69 |
+
|
70 |
+
|
71 |
+
<p style="font-size: 20px; font-weight: bold; text-align: left;">
|
72 |
+
3D
|
73 |
+
</p>
|
74 |
+
|
75 |
+
<p style="font-size: 20px; text-align: justify;">
|
76 |
+
3D interactive visualization of mouse PFC. Users can browse the following content through the 3D page:
|
77 |
+
</p>
|
78 |
+
|
79 |
+
- Transcriptome 3D Visualization: Select different transcriptome cell clusters to interactively view them in 3D
|
80 |
+
- Projectome 3D Visualization: Select different Projectome targets to interactively view them in 3D
|
81 |
+
|
82 |
+
|
83 |
+
<p style="font-size: 20px; font-weight: bold; text-align: left;">
|
84 |
+
Download
|
85 |
+
</p>
|
86 |
+
|
87 |
+
<p style="font-size: 20px; text-align: justify;">
|
88 |
+
Download the raw and processed data from this study.
|
89 |
+
</p>
|
90 |
+
|
91 |
+
|
92 |
+
```{r}
|
93 |
+
#| context: setup
|
94 |
+
#| warning: false
|
95 |
+
#| message: false
|
96 |
+
|
97 |
+
library(ggplot2)
|
98 |
+
library(Seurat)
|
99 |
+
library(shiny)
|
100 |
+
library(rgl)
|
101 |
+
library(ggdark)
|
102 |
+
library(viridis)
|
103 |
+
library(dplyr)
|
104 |
+
|
105 |
+
source("R/Palettes.R")
|
106 |
+
source('R/includes.R')
|
107 |
+
Adult.Ex <- readRDS('data/Adult.Ex.rds')
|
108 |
+
sp.PFC <- readRDS('data/sp.PFC.rds')
|
109 |
+
|
110 |
+
clean_cells <- colnames(Adult.Ex)[!(
|
111 |
+
(Adult.Ex$Ex_subtype %in% c("CT","NP") & Adult.Ex$BC_num>0) |
|
112 |
+
(Adult.Ex$sample %in% c("Adult2","Adult3") & Adult.Ex$Ex_subtype=="PT" & Adult.Ex$BC_num>0)
|
113 |
+
)]
|
114 |
+
Adult.Ex.clean <- subset(Adult.Ex, cells = clean_cells)
|
115 |
+
|
116 |
+
options(rgl.useNULL = TRUE)
|
117 |
+
```
|
118 |
+
|
119 |
+
|
120 |
+
|
121 |
+
|
122 |
+
|
123 |
+
# scRNAseq {scrolling="true"}
|
124 |
+
|
125 |
+
## {.sidebar}
|
126 |
+
|
127 |
+
```{r}
|
128 |
+
selectInput('cluster', 'Select Cluster', c("SubType_Layer","SubType"))
|
129 |
+
```
|
130 |
+
|
131 |
+
```{r}
|
132 |
+
selectInput('gene', 'Select Gene', rownames(Adult.Ex),
|
133 |
+
selected = "Cux2")
|
134 |
+
```
|
135 |
+
|
136 |
+
```{r}
|
137 |
+
Barcode <- c(
|
138 |
+
"ITi-D", "ITi-V", "ITc", "PTi",
|
139 |
+
'VIS-I','SSp-I','CP-I','AUD-I','RSP-I',
|
140 |
+
'BLA-I','ACB-I','ENTl-I','AId-I','ECT-I',
|
141 |
+
'ACB-C','PL-C','ECT-C','ENTl-C',
|
142 |
+
'BLA-C','CP-C','AId-C','RSP-C',
|
143 |
+
'MD-I','RE-I','DR-I','VTA-I','LHA-I','SC-I')
|
144 |
+
selectInput('target', 'Select Target', Barcode, selected = "CP-I")
|
145 |
+
```
|
146 |
+
|
147 |
+
|
148 |
+
## Column
|
149 |
+
|
150 |
+
### Row
|
151 |
+
|
152 |
+
#### Column
|
153 |
+
|
154 |
+
```{r}
|
155 |
+
plotOutput('cluster_plot')
|
156 |
+
```
|
157 |
+
|
158 |
+
#### Column
|
159 |
+
|
160 |
+
```{r}
|
161 |
+
plotOutput('gene_plot')
|
162 |
+
```
|
163 |
+
|
164 |
+
### Row
|
165 |
+
|
166 |
+
#### Column
|
167 |
+
|
168 |
+
```{r}
|
169 |
+
plotOutput('target_plot')
|
170 |
+
```
|
171 |
+
|
172 |
+
#### Column
|
173 |
+
|
174 |
+
```{r}
|
175 |
+
plotOutput('target_bar_plot')
|
176 |
+
```
|
177 |
+
|
178 |
+
|
179 |
+
```{r}
|
180 |
+
#| context: server
|
181 |
+
|
182 |
+
output$cluster_plot <- renderPlot({
|
183 |
+
DimPlot(
|
184 |
+
Adult.Ex,
|
185 |
+
reduction = 'umap',
|
186 |
+
group.by = input$cluster,
|
187 |
+
cols = col_cluster[[input$cluster]],
|
188 |
+
label = T
|
189 |
+
) +
|
190 |
+
coord_fixed()
|
191 |
+
})
|
192 |
+
|
193 |
+
output$gene_plot <- renderPlot({
|
194 |
+
FeaturePlot(
|
195 |
+
Adult.Ex,
|
196 |
+
features = input$gene) +
|
197 |
+
coord_fixed()
|
198 |
+
})
|
199 |
+
|
200 |
+
output$target_plot <- renderPlot({
|
201 |
+
Barcode <- c(
|
202 |
+
"ITi-D", "ITi-V", "ITc", "PTi",
|
203 |
+
'VIS-I','SSp-I','CP-I','AUD-I','RSP-I',
|
204 |
+
'BLA-I','ACB-I','ENTl-I','AId-I','ECT-I',
|
205 |
+
'ACB-C','PL-C','ECT-C','ENTl-C',
|
206 |
+
'BLA-C','CP-C','AId-C','RSP-C',
|
207 |
+
'MD-I','RE-I','DR-I','VTA-I','LHA-I','SC-I'
|
208 |
+
)
|
209 |
+
seu <- Adult.Ex.clean
|
210 |
+
colnames([email protected])[match(c("ITi_D_score", "ITi_V_score", "ITc_score", "PTi_score"),colnames([email protected]))] <- c("ITi-D", "ITi-V","ITc","PTi")
|
211 |
+
[email protected][,Barcode][is.na([email protected][,Barcode])] <- 0
|
212 |
+
FeaturePlot(
|
213 |
+
seu, features = input$target, order = T) +
|
214 |
+
coord_fixed()
|
215 |
+
})
|
216 |
+
|
217 |
+
output$target_bar_plot <- renderPlot({
|
218 |
+
seu <- Adult.Ex.clean
|
219 |
+
if (input$target %in% c("ITi-D", "ITi-V","ITc","PTi")){
|
220 |
+
df <- as.data.frame(table([email protected][,input$cluster][which(seu$Proj_module==input$target)]))
|
221 |
+
}else{
|
222 |
+
df <- as.data.frame(table([email protected][,input$cluster][which([email protected][,input$target]>0)]))
|
223 |
+
}
|
224 |
+
colnames(df) <- c("Celltypes","Cellnum")
|
225 |
+
|
226 |
+
ggplot(df, aes(x=Celltypes, y=Cellnum, fill=Celltypes)) +
|
227 |
+
geom_col() +
|
228 |
+
scale_fill_manual(values = col_cluster[[input$cluster]]) +
|
229 |
+
theme_classic() +
|
230 |
+
theme(axis.text.x = element_text(angle = 25, hjust = 1),
|
231 |
+
plot.title = element_text(hjust = 0.5)) +
|
232 |
+
labs(title = paste("PFC → ",input$target," cell numbers in different cell type",
|
233 |
+
sep=""))
|
234 |
+
})
|
235 |
+
```
|
236 |
+
|
237 |
+
|
238 |
+
|
239 |
+
|
240 |
+
|
241 |
+
# Spatial {scrolling="true"}
|
242 |
+
|
243 |
+
## {.sidebar}
|
244 |
+
|
245 |
+
```{r}
|
246 |
+
selectInput('sp_slice', 'Select Slice', unique(sp.PFC$slice),
|
247 |
+
selected = "IT_slice_10")
|
248 |
+
```
|
249 |
+
|
250 |
+
```{r}
|
251 |
+
selectInput('sp_cluster', 'Select Cluster', c("SubType_Layer","SubType"))
|
252 |
+
```
|
253 |
+
|
254 |
+
```{r}
|
255 |
+
selectInput('sp_gene', 'Select Gene', rownames(sp.PFC),
|
256 |
+
selected = "Cux2")
|
257 |
+
```
|
258 |
+
|
259 |
+
```{r}
|
260 |
+
sp_Barcode <- c(
|
261 |
+
"ITi-D", "ITi-V", "ITc", "PTi",
|
262 |
+
'VIS-I','SSp-I','CP-I','AUD-I','RSP-I',
|
263 |
+
'BLA-I','ACB-I','AId-I','ECT-I',
|
264 |
+
'ACB-C','ECT-C','CP-C','AId-C','RSP-C',
|
265 |
+
'LHA-I')
|
266 |
+
selectInput('sp_target', 'Select Target', sp_Barcode)
|
267 |
+
```
|
268 |
+
|
269 |
+
|
270 |
+
## Column
|
271 |
+
|
272 |
+
### Row
|
273 |
+
|
274 |
+
#### Column
|
275 |
+
|
276 |
+
```{r}
|
277 |
+
#| fig-width: 10
|
278 |
+
|
279 |
+
plotOutput('sp_cluster_plot')
|
280 |
+
```
|
281 |
+
|
282 |
+
#### Column
|
283 |
+
|
284 |
+
```{r}
|
285 |
+
#| fig-width: 10
|
286 |
+
|
287 |
+
plotOutput('sp_gene_plot')
|
288 |
+
```
|
289 |
+
|
290 |
+
### Row
|
291 |
+
|
292 |
+
#### Column
|
293 |
+
|
294 |
+
```{r}
|
295 |
+
#| fig-width: 10
|
296 |
+
|
297 |
+
plotOutput('sp_target_plot')
|
298 |
+
```
|
299 |
+
|
300 |
+
#### Column
|
301 |
+
|
302 |
+
```{r}
|
303 |
+
#| fig-width: 10
|
304 |
+
|
305 |
+
plotOutput('sp_target_line_plot')
|
306 |
+
```
|
307 |
+
|
308 |
+
```{r}
|
309 |
+
#| context: server
|
310 |
+
|
311 |
+
output$sp_cluster_plot <- renderPlot({
|
312 |
+
df <- data.frame(
|
313 |
+
x = sp.PFC$ML_new[sp.PFC$slice==input$sp_slice],
|
314 |
+
y = sp.PFC$DV_new[sp.PFC$slice==input$sp_slice],
|
315 |
+
type = [email protected][sp.PFC$slice==input$sp_slice, input$sp_cluster]
|
316 |
+
)
|
317 |
+
ggplot(df, aes(x=x, y=y, color=type)) +
|
318 |
+
geom_point(size=1) +
|
319 |
+
scale_color_manual(values = col_cluster[[input$sp_cluster]]) +
|
320 |
+
labs(title = paste(input$slice,'cell types in spatial')) +
|
321 |
+
guides(color=guide_legend(nrow = 2, byrow = TRUE, reverse = T,
|
322 |
+
override.aes = list(size=2))) +
|
323 |
+
coord_fixed() +
|
324 |
+
ggdark::dark_theme_void() +
|
325 |
+
theme(plot.title = element_text(size = 20, hjust = 0.5),
|
326 |
+
legend.position = 'bottom', legend.title=element_blank(),
|
327 |
+
legend.text = element_text(size=10))
|
328 |
+
})
|
329 |
+
|
330 |
+
output$sp_gene_plot <- renderPlot({
|
331 |
+
df <- data.frame(
|
332 |
+
X = sp.PFC$ML_new,
|
333 |
+
Y = sp.PFC$DV_new,
|
334 |
+
Zscore = scale(log1p(sp.PFC@assays$RNA@counts[input$sp_gene,]))
|
335 |
+
)
|
336 |
+
df <- df[which(sp.PFC$slice==input$sp_slice),]
|
337 |
+
df$Zscore[df$Zscore<0] <- 0
|
338 |
+
df$Zscore[df$Zscore>3] <- 3
|
339 |
+
df <- df[order(df$Zscore),]
|
340 |
+
ggplot(df,aes(x=X,y=Y)) +
|
341 |
+
geom_point(aes(colour=Zscore), size=1) +
|
342 |
+
scale_color_gradientn(colours = viridis(n = 256, option = "D", direction = 1)) +
|
343 |
+
ggdark::dark_theme_void() +
|
344 |
+
labs(title = input$sp_gene) +
|
345 |
+
theme(plot.title = element_text(size = 20, hjust = 0.5),
|
346 |
+
legend.position = 'bottom') +
|
347 |
+
coord_fixed()
|
348 |
+
})
|
349 |
+
|
350 |
+
output$sp_target_plot <- renderPlot({
|
351 |
+
seu <- sp.PFC
|
352 |
+
seu$PTi[is.na(seu$PTi)] <- 0
|
353 |
+
seu$ITi_D[is.na(seu$ITi_D)] <- 0
|
354 |
+
seu$ITi_V[is.na(seu$ITi_V)] <- 0
|
355 |
+
seu$ITc[is.na(seu$ITc)] <- 0
|
356 |
+
colnames([email protected])[match(c("ITi_D","ITi_V"),colnames([email protected]))] <- c("ITi-D","ITi-V")
|
357 |
+
df <- data.frame(
|
358 |
+
X = seu$ML_new,
|
359 |
+
Y = seu$DV_new,
|
360 |
+
Zscore = scale(log1p([email protected][,input$sp_target]))
|
361 |
+
)
|
362 |
+
df <- df[which(seu$slice==input$sp_slice),]
|
363 |
+
df$Zscore[df$Zscore<0] <- 0
|
364 |
+
df$Zscore[df$Zscore>3] <- 3
|
365 |
+
df <- df[order(df$Zscore),]
|
366 |
+
ggplot(df, aes(x=X,y=Y)) +
|
367 |
+
geom_point(aes(colour=Zscore), size=1) +
|
368 |
+
scale_color_gradientn(colours = viridis(n = 256, option = "E", direction = 1)) +
|
369 |
+
ggdark::dark_theme_void() +
|
370 |
+
labs(title = input$sp_target) +
|
371 |
+
theme(plot.title = element_text(size = 20, hjust = 0.5),
|
372 |
+
legend.position = 'bottom') +
|
373 |
+
coord_fixed()
|
374 |
+
})
|
375 |
+
|
376 |
+
output$sp_target_line_plot <- renderPlot({
|
377 |
+
# AP
|
378 |
+
seu <- subset(sp.PFC, cells=colnames(sp.PFC)[which(sp.PFC$ABA_hemisphere=="Left")])
|
379 |
+
slice <- unique(seu$slice)
|
380 |
+
df <- data.frame('slice'=slice)
|
381 |
+
for (i in 1:length(slice)){
|
382 |
+
if (input$sp_target %in% c("ITi-D","ITi-V","ITc","PTi")){
|
383 |
+
df$cellnum[i] <- length(which(seu$slice==slice[i] & seu$Proj_module==input$sp_target))/length(which(seu$slice==slice[i] & seu$BC_num>0))
|
384 |
+
}else{
|
385 |
+
df$cellnum[i] <- length(which(seu$slice==slice[i] & [email protected][,input$sp_target]>0))/length(which(seu$slice==slice[i] & seu$BC_num>0))
|
386 |
+
}
|
387 |
+
}
|
388 |
+
df$x <- c(1:36)
|
389 |
+
p1 <- ggplot(df, aes(x=x, y=cellnum)) +
|
390 |
+
geom_point(alpha=0.5, size=3, color=col_subtype_target[input$sp_target]) +
|
391 |
+
geom_smooth(se = F, linewidth=1.5, color=col_subtype_target[input$sp_target]) +
|
392 |
+
theme_bw() +
|
393 |
+
scale_x_continuous(breaks = seq(0,35,5)) +
|
394 |
+
theme(text = element_text(size=15),
|
395 |
+
plot.title = element_text(size = 20, hjust = 0.5)) +
|
396 |
+
labs(x='A → P',y='Cell proportion')
|
397 |
+
|
398 |
+
# DV
|
399 |
+
sp_Barcode <- c("ITi-D", "ITi-V", "ITc", "PTi",
|
400 |
+
'VIS-I','SSp-I','CP-I','AUD-I','RSP-I',
|
401 |
+
'BLA-I','ACB-I','AId-I','ECT-I',
|
402 |
+
'ACB-C','ECT-C','CP-C','AId-C','RSP-C',
|
403 |
+
'LHA-I')
|
404 |
+
seu <- subset(sp.PFC, cells=colnames(sp.PFC)[which(sp.PFC$ABA_hemisphere=="Left")])
|
405 |
+
colnames([email protected])[match(c("ITi_D","ITi_V"),colnames([email protected]))] <- c("ITi-D","ITi-V")
|
406 |
+
bc_slice <- [email protected][,c(sp_Barcode, 'Y','BC_num')]
|
407 |
+
bc_slice <-
|
408 |
+
bc_slice |>
|
409 |
+
mutate(bin = cut(Y, breaks = 36))
|
410 |
+
bin <- sort(unique(bc_slice$bin))
|
411 |
+
bc_slice$bin_index <- match(bc_slice$bin, bin)
|
412 |
+
df <- data.frame('bin_index'=c(1:36))
|
413 |
+
for (i in 1:36){
|
414 |
+
df$cellnum[i] <- length(which(bc_slice$bin_index==i &
|
415 |
+
bc_slice[,input$sp_target]>0))/
|
416 |
+
length(which(bc_slice$bin_index==i & bc_slice$BC_num>0))
|
417 |
+
}
|
418 |
+
df$x <- c(1:36)
|
419 |
+
p2 <- ggplot(df, aes(x=x, y=cellnum)) +
|
420 |
+
geom_point(alpha=0.5, size=3, color=col_subtype_target[input$sp_target]) +
|
421 |
+
geom_smooth(se = F, linewidth=1.5, color=col_subtype_target[input$sp_target]) +
|
422 |
+
theme_bw() +
|
423 |
+
scale_x_continuous(breaks = seq(0,35,5)) +
|
424 |
+
theme(text = element_text(size=15),
|
425 |
+
plot.title = element_text(size = 20, hjust = 0.5)) +
|
426 |
+
labs(x='V → D',y='Cell proportion')
|
427 |
+
p1/p2
|
428 |
+
})
|
429 |
+
```
|
430 |
+
|
431 |
+
|
432 |
+
|
433 |
+
|
434 |
+
|
435 |
+
|
436 |
+
# 3D
|
437 |
+
|
438 |
+
## {.sidebar}
|
439 |
+
|
440 |
+
```{r}
|
441 |
+
sp_Barcode <- c("ITi-D", "ITi-V", "ITc", "PTi",
|
442 |
+
'VIS-I','SSp-I','CP-I','AUD-I','RSP-I',
|
443 |
+
'BLA-I','ACB-I','AId-I','ECT-I',
|
444 |
+
'ACB-C','ECT-C','CP-C','AId-C','RSP-C',
|
445 |
+
'LHA-I')
|
446 |
+
waiter::use_waiter()
|
447 |
+
selectInput('subtype_3d', 'Select SubType', sort(unique(sp.PFC$SubType)))
|
448 |
+
selectInput('target_3d', 'Select Target', sp_Barcode)
|
449 |
+
```
|
450 |
+
|
451 |
+
|
452 |
+
## Column
|
453 |
+
|
454 |
+
```{r}
|
455 |
+
rglwidgetOutput('spatial_subtype', width = "100%")
|
456 |
+
```
|
457 |
+
|
458 |
+
|
459 |
+
```{r}
|
460 |
+
#| context: server
|
461 |
+
|
462 |
+
observeEvent(input$target_3d,{
|
463 |
+
waiter::Waiter$new(id = "spatial_subtype", color="black")$show()
|
464 |
+
output$spatial_subtype <- renderRglwidget({
|
465 |
+
if (input$target_3d %in% c("ITi-D", "ITi-V", "ITc", "PTi")){
|
466 |
+
df_plot <- [email protected][which(sp.PFC$Proj_module==input$target_3d),]
|
467 |
+
}else{
|
468 |
+
df_plot <- [email protected][which([email protected][,input$target_3d] > 0),]
|
469 |
+
}
|
470 |
+
|
471 |
+
open3d()
|
472 |
+
bg3d(color = "black")
|
473 |
+
par3d(userMatrix = rotationMatrix(-pi/6, -1, 1, 0), zoom = 0.6)
|
474 |
+
acr.list <- c("MOs","PL","ORBm","ACAd","ILA","DP","ACAv")
|
475 |
+
|
476 |
+
for(acr in acr.list){
|
477 |
+
mesh <- mesh3d.allen.annot.from.id(get.id.from.acronym(acr))
|
478 |
+
col <- "lightgray"
|
479 |
+
shade3d(mesh, col = col, material = list(lit=FALSE), alpha = 0.1)
|
480 |
+
}
|
481 |
+
|
482 |
+
spheres3d(x = df_plot$ML_new,
|
483 |
+
y = df_plot$DV_new,
|
484 |
+
z = df_plot$AP_new,
|
485 |
+
col = col_subtype_target[input$target_3d], radius=0.01, alpha=1)
|
486 |
+
rglwidget()
|
487 |
+
})
|
488 |
+
})
|
489 |
+
|
490 |
+
observeEvent(input$subtype_3d,{
|
491 |
+
waiter::Waiter$new(id = "spatial_subtype", color="black")$show()
|
492 |
+
output$spatial_subtype <- renderRglwidget({
|
493 |
+
df_plot <- [email protected][which(sp.PFC$SubType == input$subtype_3d),]
|
494 |
+
|
495 |
+
open3d()
|
496 |
+
bg3d(color = "black")
|
497 |
+
par3d(userMatrix = rotationMatrix(-pi/6, -1, 1, 0), zoom = 0.6)
|
498 |
+
acr.list <- c("MOs","PL","ORBm","ACAd","ILA","DP","ACAv")
|
499 |
+
|
500 |
+
for(acr in acr.list){
|
501 |
+
mesh <- mesh3d.allen.annot.from.id(get.id.from.acronym(acr))
|
502 |
+
col <- "lightgray"
|
503 |
+
shade3d(mesh, col = col, material = list(lit=FALSE), alpha = 0.1)
|
504 |
+
}
|
505 |
+
|
506 |
+
spheres3d(x = df_plot$ML_new,
|
507 |
+
y = df_plot$DV_new,
|
508 |
+
z = df_plot$AP_new,
|
509 |
+
col = col_subtype_target[input$subtype_3d], radius=0.01, alpha=1)
|
510 |
+
rglwidget()
|
511 |
+
})
|
512 |
+
})
|
513 |
+
```
|
514 |
+
|
515 |
+
|
516 |
+
|
517 |
+
|
518 |
+
# Download
|
519 |
+
|
520 |
+
<p style="font-size: 20px; text-align: justify;">
|
521 |
+
The raw single cell RNA-seq data are available from GEO (<a href="https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE273066">GSE273066</a>).
|
522 |
+
</p>
|
523 |
+
|
524 |
+
<p style="font-size: 20px; text-align: justify;">
|
525 |
+
The raw image data for this study are available via Hugging Face at <a href="https://huggingface.co/TigerZheng/SPIDER-STdata">TigerZheng/SPIDER-STdata</a>. You can download and unzip the .zip file and then use <a href="https://github.com/hms-dbmi/viv">viv</a> to visualize our raw data.
|
526 |
+
An example: <a href="https://avivator.gehlenborglab.org/?image_url=https://huggingface.co/TigerZheng/SPIDER-STdata/resolve/main/IT_slice_36_reordered.ome.tiff">IT_slice_36</a>.</p>
|
527 |
+
|
528 |
+
<p style="font-size: 20px; text-align: justify;">
|
529 |
+
The processed data can be downloaded here:</p>
|
530 |
+
|
531 |
+
- All cells data: <a href="https://huggingface.co/spaces/TigerZheng/SPIDER-web/resolve/main/data/all.Adult.rds?download=true">all.Adult.rds</a>
|
532 |
+
- Excitatory data: <a href="https://huggingface.co/spaces/TigerZheng/SPIDER-web/resolve/main/data/Adult.Ex.rds?download=true">Adult.Ex.rds</a>
|
533 |
+
- Spatial data: <a href="https://huggingface.co/spaces/TigerZheng/SPIDER-web/resolve/main/data/sp.PFC.rds?download=true">sp.PFC.rds</a>
|
534 |
+
|
535 |
+
|
536 |
+
|
537 |
+
|