From 71039a982f6caf17871b023a46dfe770734131e9 Mon Sep 17 00:00:00 2001 From: Tony Wu Date: Tue, 6 Jan 2026 19:22:31 -0500 Subject: [PATCH 1/4] feat(dataProcessPlots): Add confidence interval bars to profile plots --- R/dataProcessPlots.R | 5 ++++- R/utils_dataprocess_plots.R | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/R/dataProcessPlots.R b/R/dataProcessPlots.R index a0ab4e13..5e8fa9a9 100644 --- a/R/dataProcessPlots.R +++ b/R/dataProcessPlots.R @@ -385,7 +385,10 @@ dataProcessPlots = function( list(PROTEIN = unique(Protein), PEPTIDE = "Run summary", TRANSITION = "Run summary", FEATURE = "Run summary", LABEL = "Endogenous", RUN = RUN, - ABUNDANCE = LogIntensities, FRACTION = 1) + ABUNDANCE = LogIntensities, FRACTION = 1, + UPPERBOUND = if("Variance" %in% names(.SD)) LogIntensities + 1.96 * sqrt(Variance) else NA_real_, + LOWERBOUND = if("Variance" %in% names(.SD)) LogIntensities - 1.96 * sqrt(Variance) else NA_real_ + ) ] if (is_censored) { quant$censored = FALSE diff --git a/R/utils_dataprocess_plots.R b/R/utils_dataprocess_plots.R index d2ecd72d..d5304bd1 100644 --- a/R/utils_dataprocess_plots.R +++ b/R/utils_dataprocess_plots.R @@ -172,6 +172,14 @@ aes(x = .data$RUN, y = .data$newABUNDANCE, color = .data$analysis, size = .data$analysis, shape = .data$censored)) + + geom_errorbar(data = input[input$PEPTIDE == "Run summary"], + aes(x = .data$RUN, + ymin = .data$LOWERBOUND, + ymax = .data$UPPERBOUND, + color = .data$analysis), + width = 0.3, # Probably needs to be adjustable for user + linewidth = 0.5, + linetype = "solid") + scale_shape_manual(values = c(16, 1), labels = c("Detected data", "Censored missing data")) From caf4f87950eecf173fd49b2754c2f554601410c3 Mon Sep 17 00:00:00 2001 From: tonywu1999 Date: Wed, 7 Jan 2026 12:09:54 -0500 Subject: [PATCH 2/4] Adjust plot width parameter in utils_dataprocess_plots --- R/utils_dataprocess_plots.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/utils_dataprocess_plots.R b/R/utils_dataprocess_plots.R index d5304bd1..b0fccb2d 100644 --- a/R/utils_dataprocess_plots.R +++ b/R/utils_dataprocess_plots.R @@ -177,7 +177,7 @@ ymin = .data$LOWERBOUND, ymax = .data$UPPERBOUND, color = .data$analysis), - width = 0.3, # Probably needs to be adjustable for user + width = 0.3, linewidth = 0.5, linetype = "solid") + scale_shape_manual(values = c(16, 1), @@ -296,4 +296,4 @@ theme_msstats("CONDITIONPLOT", x.axis.size, y.axis.size, text_angle = text.angle) plot -} \ No newline at end of file +} From 52670fd70f97bc22cd40977fde6bd564e9038b35 Mon Sep 17 00:00:00 2001 From: tonywu1999 Date: Wed, 7 Jan 2026 12:11:52 -0500 Subject: [PATCH 3/4] Refactor UPPERBOUND calculation in dataProcessPlots.R Updated UPPERBOUND calculation to include a comment for clarity. --- R/dataProcessPlots.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/dataProcessPlots.R b/R/dataProcessPlots.R index 5e8fa9a9..dd3e1f66 100644 --- a/R/dataProcessPlots.R +++ b/R/dataProcessPlots.R @@ -386,10 +386,10 @@ dataProcessPlots = function( TRANSITION = "Run summary", FEATURE = "Run summary", LABEL = "Endogenous", RUN = RUN, ABUNDANCE = LogIntensities, FRACTION = 1, - UPPERBOUND = if("Variance" %in% names(.SD)) LogIntensities + 1.96 * sqrt(Variance) else NA_real_, + UPPERBOUND = if("Variance" %in% names(.SD)) LogIntensities + 1.96 * sqrt(Variance) else NA_real_, # 95% confidence interval LOWERBOUND = if("Variance" %in% names(.SD)) LogIntensities - 1.96 * sqrt(Variance) else NA_real_ - ) - ] + ) + ] if (is_censored) { quant$censored = FALSE } From b5e943c9b4a90fb9ab29d4ec617f67750beb02cd Mon Sep 17 00:00:00 2001 From: tonywu1999 Date: Wed, 7 Jan 2026 12:39:50 -0500 Subject: [PATCH 4/4] add vignette of profile plot --- vignettes/MSstatsPlus.Rmd | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vignettes/MSstatsPlus.Rmd b/vignettes/MSstatsPlus.Rmd index 198c79bf..3a2a052a 100644 --- a/vignettes/MSstatsPlus.Rmd +++ b/vignettes/MSstatsPlus.Rmd @@ -297,6 +297,12 @@ will be included called `Variance` indicating the variance of the underlying protein abundance estimate. This variance is used in the next step of the workflow. +Meanwhile, one can generate a profile plot to visualize the variance of the underlying protein abundance estimates in the form of 95% confidence intervals. For example, with Q9UFW8, one may observe that confidence intervals are wider for runs with more imputed values. + +```{r} +dataProcessPlots(summarized, "ProfilePlot", which.Protein = "Q9UFW8", address = FALSE) +``` + ## Differential analysis The final step of the `MSstats+` workflow is to perform differential analysis.