-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSLC3A2_panel_plotting.R
More file actions
66 lines (51 loc) · 2.85 KB
/
Copy pathSLC3A2_panel_plotting.R
File metadata and controls
66 lines (51 loc) · 2.85 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
library(ggplot2)
library(dplyr)
library(ggpubr)
library(scales)
gain_colors <- c(Gain = "#AE7182", Other = "#bebebe", Amp = "#AE7182")
theme_plot <- theme_classic(base_size = 12) +
theme(
axis.text = element_text(color = "black"),
axis.title = element_text(color = "black"),
plot.title = element_text(hjust = 0.5),
legend.text = element_text(color = "black"),
legend.title = element_text(color = "black")
)
## SLC3A2 copy-number gain proportion by SNF subtype
p_value <- if ("P_value" %in% colnames(df_slc3a2_cnv)) unique(na.omit(df_slc3a2_cnv$P_value))[1] else NA_real_
p_slc3a2_cnv <- ggplot(df_slc3a2_cnv, aes(x = SNF_group, y = Percentage, fill = SLC3A2_status)) +
geom_col(width = 0.75) +
geom_text(aes(label = round(Percentage, 1)), position = position_stack(vjust = 0.5), size = 3.5) +
scale_y_continuous(labels = percent_format(scale = 1), limits = c(0, 110), expand = c(0, 0)) +
scale_fill_manual(values = gain_colors, na.value = "grey80") +
labs(x = NULL, y = "Proportion", fill = NULL, title = "SLC3A2") +
theme_plot
if (!is.na(p_value)) {
p_slc3a2_cnv <- p_slc3a2_cnv +
annotate("text", x = 1.5, y = 105, label = paste("P =", format(p_value, scientific = TRUE, digits = 3)), size = 3.5)
}
ggsave("SLC3A2_CN_gain_proportion_by_SNF.pdf", p_slc3a2_cnv, width = 3.5, height = 3.5)
## SLC3A2 protein abundance by copy-number status
df_slc3a2_protein <- df_slc3a2_protein %>%
mutate(CN_group = factor(CN_group, levels = c("Gain", "Other")))
p_slc3a2_protein <- ggplot(df_slc3a2_protein, aes(x = CN_group, y = SLC3A2, fill = CN_group, color = CN_group)) +
geom_violin(trim = FALSE, alpha = 0.8, color = NA) +
geom_point(position = position_jitter(width = 0.15), shape = 21, size = 2.5, alpha = 0.45) +
stat_summary(fun = median, geom = "crossbar", width = 0.18, color = "black") +
stat_compare_means(method = "wilcox.test", comparisons = list(c("Gain", "Other")), label = "p.format") +
scale_fill_manual(values = gain_colors) +
scale_color_manual(values = gain_colors) +
labs(x = NULL, y = "SLC3A2 protein abundance") +
theme_plot +
theme(legend.position = "none")
ggsave("SLC3A2_protein_abundance_by_CNV.pdf", p_slc3a2_protein, width = 2.6, height = 3.6)
## Correlation between SLC3A2 and SPP1
cor_test <- cor.test(df_slc3a2_spp1$SLC3A2, df_slc3a2_spp1$SPP1, method = "spearman", exact = FALSE)
cor_label <- paste0("Spearman r = ", round(unname(cor_test$estimate), 2), ", P = ", signif(cor_test$p.value, 2))
p_slc3a2_spp1 <- ggplot(df_slc3a2_spp1, aes(x = SPP1, y = SLC3A2)) +
geom_point(size = 2.5, alpha = 0.8, color = "#4c78a8") +
geom_smooth(method = "lm", se = TRUE, color = "black", linewidth = 0.6) +
annotate("text", x = -Inf, y = Inf, hjust = -0.05, vjust = 1.2, label = cor_label, size = 3.6) +
labs(x = "SPP1", y = "SLC3A2") +
theme_plot
ggsave("SLC3A2_SPP1_correlation.pdf", p_slc3a2_spp1, width = 3.5, height = 3.5)