From e4d30aea1c65b09e4ce4adcf56d59d1d90f39189 Mon Sep 17 00:00:00 2001 From: Tony Wu Date: Thu, 23 Apr 2026 19:37:46 -0400 Subject: [PATCH] fix(comparisonPlot): Add 95% CI description in tooltip --- R/groupComparisonPlots.R | 4 ++-- R/utils_groupcomparison_plots.R | 8 ++++---- man/dot-makeComparison.Rd | 5 ++++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/R/groupComparisonPlots.R b/R/groupComparisonPlots.R index 087b8206..8dec5e40 100644 --- a/R/groupComparisonPlots.R +++ b/R/groupComparisonPlots.R @@ -421,8 +421,8 @@ groupComparisonPlots = function( vjust = ifelse(text.angle != 0, 1, 0.5) plot = .makeComparison(single_protein, log_base_FC, dot.size, x.axis.size, - y.axis.size, text.angle, hjust, vjust, y.limdown, - y.limup) + y.axis.size, text.angle, hjust, vjust, y.limdown, + y.limup, sig) print(plot) plots[[i]] = plot } diff --git a/R/utils_groupcomparison_plots.R b/R/utils_groupcomparison_plots.R index ffb340c4..e5687fed 100644 --- a/R/utils_groupcomparison_plots.R +++ b/R/utils_groupcomparison_plots.R @@ -282,18 +282,18 @@ colMin <- function(data) sapply(data, min, na.rm = TRUE) #' @inheritParams groupComparisonPlots #' @keywords internal .makeComparison = function( - input, log_base, dot.size, x.axis.size, y.axis.size, - text.angle, hjust, vjust, y.limdown, y.limup + input, log_base, dot.size, x.axis.size, y.axis.size, + text.angle, hjust, vjust, y.limdown, y.limup, sig ) { logFC = ciw = NULL - + ci_label = paste0("(", (1 - sig) * 100, "% CI)") protein = unique(input$Protein) plot = ggplot(input, aes(x = .data$Label, y = .data$logFC)) + geom_errorbar(aes(ymax = .data$logFC + .data$ciw, ymin = .data$logFC - .data$ciw), data = input, width = 0.1, colour = "red") + - geom_point(aes(text = paste0("logFC: ", round(.data$logFC, 4), " ± ", round(.data$ciw, 4))), + geom_point(aes(text = paste0("logFC: ", round(.data$logFC, 4), " ± ", round(.data$ciw, 4), " ", ci_label)), size = dot.size, colour = "darkred") + scale_x_discrete('Comparison') + diff --git a/man/dot-makeComparison.Rd b/man/dot-makeComparison.Rd index 714e4343..917a73aa 100644 --- a/man/dot-makeComparison.Rd +++ b/man/dot-makeComparison.Rd @@ -14,7 +14,8 @@ hjust, vjust, y.limdown, - y.limup + y.limup, + sig ) } \arguments{ @@ -29,6 +30,8 @@ \item{y.axis.size}{size of axes labels, e.g. name of targeted proteins in heatmap. Default is 10.} \item{text.angle}{angle of x-axis labels represented each comparison at the bottom of graph in comparison plot. Default is 0.} + +\item{sig}{FDR cutoff for the adjusted p-values in heatmap and volcano plot. level of significance for comparison plot. 100(1-sig)\% confidence interval will be drawn. sig=0.05 is default.} } \description{ Create comparison plot