Skip to content

Commit 1702768

Browse files
csonesonhrhotz
andcommitted
Update helper scripts
Co-authored-by: Hans-Rudolf Hotz <hrhotz@googlemail.com> Co-authored-by: Charlotte Soneson <charlottesoneson@gmail.com>
1 parent 848b624 commit 1702768

File tree

2 files changed

+96
-12
lines changed

2 files changed

+96
-12
lines changed

helpers.R

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ get_legend2 <- function(plot, legend = NULL) {
3434

3535
# Function to create normalized dot plots
3636
.makeDotPlot <- function(dat, markers, cluster_column, cluster_order,
37-
cluster_colors, transpose = TRUE,
37+
cluster_colors, cluster_labels = NULL, transpose = TRUE,
3838
split_by_ciliated = FALSE, normalize = TRUE,
3939
subset_to_clusters = NULL,
4040
min_fraction = 0) {
@@ -85,16 +85,29 @@ get_legend2 <- function(plot, legend = NULL) {
8585
}
8686

8787
# reorder groups
88-
plot.data <- plot.data |>
89-
mutate(Group = factor(Group, levels = rev(cluster_order))) |>
90-
arrange(Group) |>
91-
mutate(Group = as.character(Group)) |>
92-
mutate(Group = paste("<span style = 'color: ",
93-
cluster_colors[Group],
94-
";'>",
95-
Group,
96-
"</span>", sep = "")) |>
97-
mutate(Group = factor(Group, levels = unique(Group)))
88+
if (is.null(cluster_labels)) {
89+
plot.data <- plot.data |>
90+
mutate(Group = factor(Group, levels = rev(cluster_order))) |>
91+
arrange(Group) |>
92+
mutate(Group = as.character(Group)) |>
93+
mutate(Group = paste("<span style = 'color: ",
94+
cluster_colors[Group],
95+
";'>",
96+
Group,
97+
"</span>", sep = "")) |>
98+
mutate(Group = factor(Group, levels = unique(Group)))
99+
} else {
100+
plot.data <- plot.data |>
101+
mutate(Group = factor(Group, levels = rev(cluster_order))) |>
102+
arrange(Group) |>
103+
mutate(Group = as.character(Group)) |>
104+
mutate(Group = paste("<span style = 'color: ",
105+
cluster_colors[Group],
106+
";'>",
107+
cluster_labels[Group],
108+
"</span>", sep = "")) |>
109+
mutate(Group = factor(Group, levels = unique(Group)))
110+
}
98111

99112
# plot
100113
gg <- ggplot(plot.data) +

params.R

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,25 @@ sc_timecourse_markers <- c(
122122
"CDC20B", "MAD2L1", "CRELD2", "DNAJB11", "NEK2", "PIFO", "FOXJ1",
123123
"RSPH1", "TPPP3")
124124

125+
sc_leiden_res0.125_annot_labels <- c(
126+
"ciliated" = "ciliated",
127+
"ciliated immunomodulatory" = "ciliated immunomodulatory",
128+
"ciliated wound responsive 24h" = "ciliated wound responsive 24h",
129+
"ciliated wound responsive 12h" = "ciliated wound responsive 12h",
130+
"ciliated stress responsive" = "ciliated stress responsive",
131+
"ciliated cycling" = "ciliated cycling",
132+
"pre-ciliated" = "pre-ciliated",
133+
"secretory late" = "secretory PAEP<sup>+</sup>",
134+
"secretory early" = "secretory SCGB<sup>high</sup>",
135+
"hormone responsive" = "hormone responsive",
136+
"immunomodulatory" = "immunomodulatory",
137+
"OxPhos high" = "OxPhos high",
138+
"wound responsive 24h" = "wound responsive 24h",
139+
"wound responsive 12h" = "wound responsive 12h",
140+
"stress responsive" = "stress responsive",
141+
"cycling" = "cycling"
142+
)
143+
125144
# ------------------------------------------------------------------------------
126145
# scRNAseq tissue atlas (epithelial)
127146
# ------------------------------------------------------------------------------
@@ -143,6 +162,23 @@ tissue_leiden_res0.4_annot_colors <- c(
143162
)
144163
tissue_leiden_res0.4_annot_order <- names(tissue_leiden_res0.4_annot_colors)
145164

165+
tissue_leiden_res0.4_annot_labels <- c(
166+
"ciliated" = "ciliated",
167+
"pre-ciliated" = "pre-ciliated",
168+
"secretory late" = "secretory late",
169+
"secretory mid" = "secretory mid",
170+
"secretory early" = "secretory early",
171+
"hormone responsive late" = "hormone responsive PGR<sup>low</sup>",
172+
"hormone responsive early" = "hormone responsive PGR<sup>high</sup>",
173+
"luminal late" = "receptivity associated luminal",
174+
"luminal early" = "regeneration associated luminal",
175+
"KRT5+" = "KRT5<sup>+</sup>",
176+
"MUC5B+" = "MUC5B<sup>+</sup>",
177+
"transcriptionally active" = "transcriptionally active",
178+
"remodeling" = "VIM<sup>+</sup>",
179+
"cycling" = "cycling"
180+
)
181+
146182
tissue_markers <- c(
147183
"PAX8", "EPCAM", "FOXA2", "MKI67", "STMN1", "PCNA", "VIM", "NABP1",
148184
"TEAD1", "NKTR", "PNN", "MACF1", "PHLDA1", "KRT5", "KRT17", "CLU",
@@ -153,7 +189,7 @@ tissue_markers <- c(
153189
"COL1A2", "MMP26", "SOX17", "SCGB1D2", "SCGB2A1", "SCGB2A2", "IL6ST",
154190
"VEGFA", "VCAN", "DYNLT3", "MAOA", "PPIB", "GPX3", "PAEP", "TSPAN8",
155191
"NUPR1", "SOD3", "FGF7", "IGFBP7", "CCNO", "CDC20B", "MAD2L1", "NEK2",
156-
"PIFO", "FOXJ1", "RSPH1", "TPPP3")
192+
"MCIDAS", "GMNC", "PIFO", "FOXJ1", "RSPH1", "TPPP3")
157193

158194
tissue_goterms <- list(
159195
"luminal early" = c("epithelium development", "cell-cell junction organization",
@@ -263,6 +299,41 @@ tissue_all_lineages_celltype_lineage <- c(
263299
sHormones = "Epithelial",
264300
dHormones = "Epithelial"
265301
)
302+
tissue_all_lineages_celltype_labels <- c(
303+
Venous = "Venous",
304+
Arterial = "Arterial",
305+
Lymphatic = "Lymphatic",
306+
Mast_cell = "Mast_cell",
307+
pDC = "pDC",
308+
cDC1 = "cDC1",
309+
cDC2 = "cDC2",
310+
Monocyte = "Monocyte",
311+
eM1 = "eM1",
312+
eM2 = "eM2",
313+
ILC3 = "ILC3",
314+
Peripheral_lymphocyte = "Peripheral_lymphocyte",
315+
T_cell_CD4 = "T_cell_CD4",
316+
T_cell_CD8 = "T_cell_CD8",
317+
T_cell_cycling = "T_cell_cycling",
318+
T_Reg = "T_Reg",
319+
uNK1_cycling = "uNK1_cycling",
320+
uNK1 = "uNK1",
321+
uNK2 = "uNK2",
322+
uNK3 = "uNK3",
323+
B_cell = "B_cell",
324+
Plasma_B_cell = "Plasma_B_cell",
325+
Red_blood_cell = "Red_blood_cell",
326+
uSMCs = "uSMCs",
327+
ePV = "ePV",
328+
mPV = "mPV",
329+
eStromal = "eStromal",
330+
dStromal = "dStromal",
331+
Fibroblast_basalis = "Fibroblast_basalis",
332+
tissue_leiden_res0.4_annot_labels,
333+
HOXA13 = "HOXA13",
334+
sHormones = "sHormones",
335+
dHormones = "dHormones"
336+
)
266337

267338
# ------------------------------------------------------------------------------
268339
# other

0 commit comments

Comments
 (0)