diff --git a/R/dataProcessPlots.R b/R/dataProcessPlots.R index a0ab4e1..dd3e1f6 100644 --- a/R/dataProcessPlots.R +++ b/R/dataProcessPlots.R @@ -385,8 +385,11 @@ 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_, # 95% confidence interval + 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 d2ecd72..b0fccb2 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, + linewidth = 0.5, + linetype = "solid") + scale_shape_manual(values = c(16, 1), labels = c("Detected data", "Censored missing data")) @@ -288,4 +296,4 @@ theme_msstats("CONDITIONPLOT", x.axis.size, y.axis.size, text_angle = text.angle) plot -} \ No newline at end of file +} diff --git a/vignettes/MSstatsPlus.Rmd b/vignettes/MSstatsPlus.Rmd index 198c79b..3a2a052 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.