diff --git a/R/volcano_plots.R b/R/volcano_plots.R index fb379c3..9d51c9b 100644 --- a/R/volcano_plots.R +++ b/R/volcano_plots.R @@ -11,7 +11,7 @@ plot_volcano <- function(df, p_adj_col = "padj", lfc_col = "log2FoldChange", label_col = "mgi_symbol", p_adj_treshold = 0.05, lfc_treshold = 1, - labels_n = 20, labels = NULL) { + labels_n = 20, labels = NULL, labels_fun = ggrepel::geom_label_repel) { df <- mutate(df, significant = !!sym(p_adj_col) < p_adj_treshold, change = case_when( @@ -71,7 +71,7 @@ plot_volcano <- function(df, p_adj_col = "padj", lfc_col = "log2FoldChange", values = c("steelblue2", "gray", "orangered3"), breaks = c("down", "not sig.", "up") ) + - geom_label_repel( + labels_fun( aes(label = !!sym(label_col)), data = labels_data, show.legend = FALSE, max.overlaps = 30 ) +