From fd9cf65adf0b421bf6fb3ad24487d9051580e904 Mon Sep 17 00:00:00 2001 From: Johannes Rainer Date: Tue, 1 Oct 2024 11:24:03 +0200 Subject: [PATCH] Address William's comments --- R/AllGenerics.R | 23 ++++++++++++----------- R/methods-XChromatogram.R | 2 +- man/XChromatogram.Rd | 2 +- man/chromPeakSummary.Rd | 23 ++++++++++++----------- vignettes/xcms.Rmd | 6 +++--- 5 files changed, 29 insertions(+), 27 deletions(-) diff --git a/R/AllGenerics.R b/R/AllGenerics.R index c1e3ec2b..82a23e6b 100644 --- a/R/AllGenerics.R +++ b/R/AllGenerics.R @@ -541,20 +541,21 @@ setGeneric("chromPeakSpectra", function(object, ...) #' #' @description #' -#' The `chromPeakSummary()` method calculates summary statistic or other -#' metrics for each of the identified chromatographic peaks in an *xcms* -#' result object, such as the [XcmsExperiment()]. Different metrics can be -#' calculated, depending (and configured) using dedicated *parameter* classes. -#' As a result, the method returns a `matrix` or `data.frame` with one row -#' per chromatographic peak. Each column contains calculated values, depending -#' on the used method/parameter class. +#' The `chromPeakSummary()` method calculates summary statistics or other +#' metrics for each of the identified chromatographic peaks in an *xcms* result +#' object, such as the [XcmsExperiment()]. Different metrics can be calculated, +#' depending upon (and configured by) using dedicated *parameter* classes. As a +#' result, the method returns a `matrix` or `data.frame` with one row per +#' chromatographic peak. Each column contains calculated values, depending on +#' the used method/parameter class. #' #' Currently implemented methods/parameter classes are: #' #' - `BetaDistributionParam`: calculates the *beta_cor* and *beta_snr* quality -#' metrics as described in (Kumler 2023) representing the result from a -#' (correlation) test of similarity to a bell curve and the signal-to-noise -#' ratio calculated on the residulas of this test. +#' metrics as described in Kumler 2023 representing the result from a +#' (correlation) test of similarity (using Pearson's correlation coefficient) +#' to a bell curve and the signal-to-noise ratio calculated on the residuals +#' of this test. #' #' @param BPPARAM Parallel processing setup. See [bpparam()] for details. #' @@ -579,7 +580,7 @@ setGeneric("chromPeakSpectra", function(object, ...) #' columns, their names and content depend on the used parameter object. See #' the respective documentation above for more details. #' -#' @author Pablo Vangeenderhuysen, Johannes Rainer +#' @author Pablo Vangeenderhuysen, Johannes Rainer, William Kumler #' #' @md #' diff --git a/R/methods-XChromatogram.R b/R/methods-XChromatogram.R index 8f0f6960..4cab15fc 100644 --- a/R/methods-XChromatogram.R +++ b/R/methods-XChromatogram.R @@ -32,7 +32,7 @@ setMethod("show", "XChromatogram", function(object) { #' value) and `"mzmax"` (maximal m/z value), `"rt"` (retention time of the #' peak apex), `"rtmin"` (the lower peak boundary in retention time #' dimension), `"rtmax"` (the upper peak boundary in retention time -#' dimension), `"into"` (the ingegrated peak signal/area of the peak), +#' dimension), `"into"` (the integrated peak signal/area of the peak), #' `"maxo"` (the maximum instensity of the peak and `"sn"` (the signal to #' noise ratio). #' Note that, depending on the peak detection algorithm, the matrix may diff --git a/man/XChromatogram.Rd b/man/XChromatogram.Rd index ec4ac64c..9e21ad0f 100644 --- a/man/XChromatogram.Rd +++ b/man/XChromatogram.Rd @@ -455,7 +455,7 @@ a \code{matrix} with columns \code{"mz"} (mean m/z value), \code{"mzmin"} (minim value) and \code{"mzmax"} (maximal m/z value), \code{"rt"} (retention time of the peak apex), \code{"rtmin"} (the lower peak boundary in retention time dimension), \code{"rtmax"} (the upper peak boundary in retention time -dimension), \code{"into"} (the ingegrated peak signal/area of the peak), +dimension), \code{"into"} (the integrated peak signal/area of the peak), \code{"maxo"} (the maximum instensity of the peak and \code{"sn"} (the signal to noise ratio). Note that, depending on the peak detection algorithm, the matrix may diff --git a/man/chromPeakSummary.Rd b/man/chromPeakSummary.Rd index a7f6edd3..9fe313d6 100644 --- a/man/chromPeakSummary.Rd +++ b/man/chromPeakSummary.Rd @@ -43,20 +43,21 @@ columns, their names and content depend on the used parameter object. See the respective documentation above for more details. } \description{ -The \code{chromPeakSummary()} method calculates summary statistic or other -metrics for each of the identified chromatographic peaks in an \emph{xcms} -result object, such as the \code{\link[=XcmsExperiment]{XcmsExperiment()}}. Different metrics can be -calculated, depending (and configured) using dedicated \emph{parameter} classes. -As a result, the method returns a \code{matrix} or \code{data.frame} with one row -per chromatographic peak. Each column contains calculated values, depending -on the used method/parameter class. +The \code{chromPeakSummary()} method calculates summary statistics or other +metrics for each of the identified chromatographic peaks in an \emph{xcms} result +object, such as the \code{\link[=XcmsExperiment]{XcmsExperiment()}}. Different metrics can be calculated, +depending upon (and configured by) using dedicated \emph{parameter} classes. As a +result, the method returns a \code{matrix} or \code{data.frame} with one row per +chromatographic peak. Each column contains calculated values, depending on +the used method/parameter class. Currently implemented methods/parameter classes are: \itemize{ \item \code{BetaDistributionParam}: calculates the \emph{beta_cor} and \emph{beta_snr} quality -metrics as described in (Kumler 2023) representing the result from a -(correlation) test of similarity to a bell curve and the signal-to-noise -ratio calculated on the residulas of this test. +metrics as described in Kumler 2023 representing the result from a +(correlation) test of similarity (using Pearson's correlation coefficient) +to a bell curve and the signal-to-noise ratio calculated on the residuals +of this test. } } \references{ @@ -65,5 +66,5 @@ assessing chromatographic peak quality with simple metrics in metabolomics" \emph{BMC Bioinformatics} 24(1):404. doi: 10.1186/s12859-023-05533-4 } \author{ -Pablo Vangeenderhuysen, Johannes Rainer +Pablo Vangeenderhuysen, Johannes Rainer, William Kumler } diff --git a/vignettes/xcms.Rmd b/vignettes/xcms.Rmd index 41a031c8..ba16810b 100644 --- a/vignettes/xcms.Rmd +++ b/vignettes/xcms.Rmd @@ -470,7 +470,7 @@ eics <- chromPeakChromatograms( faahko, peaks = rownames(chromPeaks(faahko))[c(4, 6)]) ``` -```{r peak-quality-metrics, fig.widht = 10, fig.height = 5, fig.cap = "Plots of high and low quality peaks. Left: peak CP0004 with a beta_cor = 0.98, right: peak CP0006 with a beta_cor = 0.13."} +```{r peak-quality-metrics, fig.width = 10, fig.height = 5, fig.cap = "Plots of high and low quality peaks. Left: peak CP0004 with a beta_cor = 0.98, right: peak CP0006 with a beta_cor = 0.13."} peak_1 <- eics[1] peak_2 <- eics[2] par(mfrow = c(1, 2)) @@ -509,7 +509,7 @@ faahko_pp <- refineChromPeaks(faahko, mpp) An example for a merged peak is given below. -```{r peak-postprocessing-merged, fig.widht = 10, fig.height = 5, fig.cap = "Result from the peak refinement step. Left: data before processing, right: after refinement. The splitted peak was merged into one."} +```{r peak-postprocessing-merged, fig.width = 10, fig.height = 5, fig.cap = "Result from the peak refinement step. Left: data before processing, right: after refinement. The splitted peak was merged into one."} mzr_1 <- 305.1 + c(-0.01, 0.01) chr_1 <- chromatogram(faahko[1], mz = mzr_1) chr_2 <- chromatogram(faahko_pp[1], mz = mzr_1) @@ -524,7 +524,7 @@ plot(chr_2) peaks into a single one (right panel in the figure above). Other close peaks, with a lower intensity between them, were however not merged (see below). -```{r peak-postprocessing-not-merged, fig.widht = 10, fig.height = 5, fig.cap = "Result from the peak refinement step. Left: data before processing, right: after refinement. The peaks were not merged."} +```{r peak-postprocessing-not-merged, fig.width = 10, fig.height = 5, fig.cap = "Result from the peak refinement step. Left: data before processing, right: after refinement. The peaks were not merged."} mzr_1 <- 496.2 + c(-0.01, 0.01) chr_1 <- chromatogram(faahko[1], mz = mzr_1) chr_2 <- chromatogram(faahko_pp[1], mz = mzr_1)