-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path16_fig_S5_deconvolution.R
More file actions
81 lines (68 loc) · 1.86 KB
/
16_fig_S5_deconvolution.R
File metadata and controls
81 lines (68 loc) · 1.86 KB
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
library(spacedeconv)
library(SpatialExperiment)
library(ggplot2)
figures_dir <- "./export/figures"
objects_dir <- "./export/objects"
dir.create(figures_dir, showWarnings = FALSE, recursive = TRUE)
dir.create(objects_dir, showWarnings = FALSE, recursive = TRUE)
spe <- read10xVisium("./data/renal/frozen_b1/")
annot <- read.csv(
"./data/renal/frozen_b1/outs/spatial/GSM5924046_frozen_b_1_TLS_annotation.csv"
)
spe$tls <- annot$TLS_2_cat
spe <- preprocess(spe)
spe <- spacedeconv::normalize(spe)
rownames(spe) <- rowData(spe)$symbol
deconv <- deconvolute(
spe,
method = "quantiseq",
assay_sp = "cpm",
tumor = TRUE
)
geneset <- c(
"IGHA1","IGHG1","IGHG2","IGHG3","IGHG4","IGHGP","IGHM",
"IGKG","IGLC1","IGLC2","IGLC3","JCHAIN","CD79A","FCRL5",
"MZB1","SSR4","XBP1","TRBC2","IL7R","CXCL12","LUM",
"C1QA","C7","CD52","APOE","PTLP","PTGSD","PIM2","DERL3"
)
deconv <- gene_set_score(deconv, genes = geneset, assay = "cpm")
title_size <- 22
font_size <- 18
legend_size <- 20
patho <- plot_spatial(
deconv,
result = "tls",
density = FALSE,
palette = "BluYl",
offset_rotation = TRUE,
title = "Pathology annotation",
title_size = title_size,
font_size = font_size,
legend_size = legend_size,
spot_size = 1.03
)
geneSet <- plot_spatial(
deconv,
result = "geneSet",
density = FALSE,
offset_rotation = TRUE,
title = "TLS score",
title_size = title_size,
font_size = font_size,
legend_size = legend_size,
spot_size = 1.03
)
qBcells <- plot_spatial(
deconv,
result = "quantiseq_B.cell",
density = FALSE,
offset_rotation = TRUE,
smooth = TRUE,
title = "B cells (sm.)",
title_size = title_size,
font_size = font_size,
legend_size = legend_size,
spot_size = 1.03
)
plots_5A <- list(patho, geneSet, qBcells)
saveRDS(plots_5A, file = "./export/objects/fig_S5_panels.rds")