From 3b1bea1451f3e3e3a5bc4d4d6c93d5bf07c5cd7f Mon Sep 17 00:00:00 2001 From: Philippine Louail Date: Thu, 14 Mar 2024 14:43:57 +0100 Subject: [PATCH] fix --- R/DataClasses.R | 2 + R/do_adjustRtime-functions.R | 4 +- R/functions-Params.R | 2 +- R/methods-Params.R | 2 +- man/adjustRtime.Rd | 60 +++++++++++++++++++++++++---- man/matchLamaChromPeaks.Rd | 75 ------------------------------------ 6 files changed, 59 insertions(+), 86 deletions(-) delete mode 100644 man/matchLamaChromPeaks.Rd diff --git a/R/DataClasses.R b/R/DataClasses.R index af46beb80..e2eb635b5 100644 --- a/R/DataClasses.R +++ b/R/DataClasses.R @@ -1467,6 +1467,8 @@ setClass("PeakGroupsParam", else TRUE }) +#' @slot rtMap,nChrompeaks slots that should not be accessed by the user. +#' @rdname adjustRtime setClass("LamaParama", slots = c(lamas = "matrix", method = "character", diff --git a/R/do_adjustRtime-functions.R b/R/do_adjustRtime-functions.R index 6e22656a4..ce2ae33b9 100644 --- a/R/do_adjustRtime-functions.R +++ b/R/do_adjustRtime-functions.R @@ -759,7 +759,7 @@ adjustRtimeSubset <- function(rtraw, rtadj, subset, #' #' @author Philippine Louail, Carl Brunius #' -#' @rdname matchLamaChromPeaks +#' @rdname adjustRtime matchLamasChromPeaks <- function(object, param, BPPARAM = bpparam()){ if (!hasChromPeaks(object)) stop("'object' needs to have detected ChromPeaks. ", @@ -796,7 +796,7 @@ matchLamasChromPeaks <- function(object, param, BPPARAM = bpparam()){ #' #' @author Philippine Louail, Carl Brunius #' -#' @rdname matchLamaChromPeaks +#' @rdname adjustRtime summarizeLamaMatch <- function(param){ if (!inherits(param, "LamaParama")) stop("The input needs to be of class 'LamaParama'") diff --git a/R/functions-Params.R b/R/functions-Params.R index 73f9ad0e8..d67a414d2 100644 --- a/R/functions-Params.R +++ b/R/functions-Params.R @@ -312,7 +312,7 @@ LamaParama <- function(lamas = matrix(ncol = 2, nrow = 0, #' Function to access rtMap from `LamaParama` object #' @export #' -#' @rdname matchLamaChromPeaks +#' @rdname adjustRtime rtMap <- function(param){ if(!inherits(param, "LamaParama")) stop("The inputs need to be of class LamaParama") diff --git a/R/methods-Params.R b/R/methods-Params.R index 70a378bfb..a358450c7 100644 --- a/R/methods-Params.R +++ b/R/methods-Params.R @@ -1266,7 +1266,7 @@ setReplaceMethod("subsetAdjust", "PeakGroupsParam", function(object, value) { #' #' @export #' -#' @rdname matchLamaChromPeaks +#' @noRd setMethod("plot", "LamaParama", function(x, index = 1L, colPoints = "#00000060", colFit = "#00000080", xlab = "Matched Chromatographic peaks", diff --git a/man/adjustRtime.Rd b/man/adjustRtime.Rd index ae6c41681..11712f6f5 100644 --- a/man/adjustRtime.Rd +++ b/man/adjustRtime.Rd @@ -1,7 +1,9 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/AllGenerics.R, R/XcmsExperiment.R, -% R/functions-Params.R, R/functions-XCMSnExp.R, R/methods-OnDiskMSnExp.R, -% R/methods-Params.R, R/methods-XCMSnExp.R +% Please edit documentation in R/AllGenerics.R, R/DataClasses.R, +% R/XcmsExperiment.R, R/do_adjustRtime-functions.R, R/functions-Params.R, +% R/functions-XCMSnExp.R, R/methods-OnDiskMSnExp.R, R/methods-Params.R, +% R/methods-XCMSnExp.R +\docType{class} \name{adjustRtime} \alias{adjustRtime} \alias{ObiwarpParam-class} @@ -10,8 +12,11 @@ \alias{adjustRtime,MsExperiment,ObiwarpParam-method} \alias{adjustRtime,MsExperiment,PeakGroupsParam-method} \alias{adjustRtime,XcmsExperiment,LamaParama-method} +\alias{matchLamasChromPeaks} +\alias{summarizeLamaMatch} \alias{PeakGroupsParam} \alias{LamaParama} +\alias{rtMap} \alias{ObiwarpParam} \alias{adjustRtimePeakGroups} \alias{adjustRtime,OnDiskMSnExp,ObiwarpParam-method} @@ -99,6 +104,10 @@ adjustRtime(object, param, ...) \S4method{adjustRtime}{XcmsExperiment,LamaParama}(object, param, BPPARAM = bpparam(), ...) +matchLamasChromPeaks(object, param, BPPARAM = bpparam()) + +summarizeLamaMatch(param) + PeakGroupsParam( minFraction = 0.9, extraPeaks = 1, @@ -124,6 +133,8 @@ LamaParama( nChromPeaks = numeric() ) +rtMap(param) + ObiwarpParam( binSize = 1, centerSample = integer(), @@ -228,11 +239,10 @@ adjustRtimePeakGroups(object, param = PeakGroupsParam(), msLevel = 1L) \S4method{adjustRtime}{XCMSnExp,ObiwarpParam}(object, param, msLevel = 1L) } \arguments{ -\item{object}{For \code{adjustRtime}: an \code{\link[=OnDiskMSnExp]{OnDiskMSnExp()}}, \code{\link[=XCMSnExp]{XCMSnExp()}}, -\code{\link[=MsExperiment]{MsExperiment()}} or \code{\link[=XcmsExperiment]{XcmsExperiment()}} object.} +\item{object}{An object of class `XcmsExperiment` with defined ChromPeaks.} -\item{param}{The parameter object defining the alignment method (and its -setting).} +\item{param}{An object of class `LamaParama` that will later be used for +adjustment using the `[adjustRtime()]` function.} \item{...}{ignored.} @@ -386,6 +396,10 @@ initiating an alignment (for local alignment only).} \item{value}{The value for the slot.} \item{x}{An \code{ObiwarpParam}, \code{PeakGroupsParam} or \code{LamaParama} object.} + +\item{`LamaParama`}{same object that will be passed to the `adjustRtime()` +function. To run this function the `matchLamasChromPeaks()` need to be run +on this first.} } \value{ \code{adjustRtime} on an \code{OnDiskMSnExp} or \code{XCMSnExp} object will return an @@ -400,6 +414,17 @@ parameter object. \code{adjustRtimeGroups} returns a \code{matrix} with the retention times of \emph{marker} features in each sample (each row one feature, each row one sample). + +A `LamaParama` object with new slot rtMap composed of a list of +matrices representing the 1:1 matches between Lamas (ref) and ChromPeaks +(obs). + +A `data.frame` with: + +- Total_peaks: total number of chromatographic peaks in the file +- Matched_peak: The number of matched peaks to Lamas +- Total_Lamas: Total number of Lamas +- Model_summary: `summary.loess` or `summary.gam` object for each file. } \description{ The \code{adjustRtime} method(s) perform retention time correction (alignment) @@ -471,6 +496,25 @@ in fine-tuning how the matching chromatographic peaks are fitted to the lamas, thereby generating a model to align the overall retention time for a single file. } + +The `matchLamasChromPeaks()` function quickly matches each file's ChromPeaks +to Lamas, allowing the user to evaluate the matches for each file. + +The `summarizeLamaMatch()` generates a summary of the LamaParama method. +Composed of coverage % of the chrompeaks match over the total chrompeaks of +the object. as well as a summary of the model that will be applied to the +file to adjust the retention times +} +\section{Slots}{ + +\describe{ +\item{\code{rtMap,nChrompeaks}}{slots that should not be accessed by the user.} +}} + +\note{ +If there are no matches, the file retention will not be adjusted when +calling [adjustRtime()] with the same `LamaParama` and `XcmsExperiment` +object. } \section{Subset-based alignment}{ @@ -513,5 +557,7 @@ Nonlinear Peak Alignment, Matching, and Identification" \emph{Anal. Chem.} } \author{ Colin Smith, Johannes Rainer, Philippine Louail, Carl Brunius + +Philippine Louail, Carl Brunius } \concept{retention time correction methods} diff --git a/man/matchLamaChromPeaks.Rd b/man/matchLamaChromPeaks.Rd deleted file mode 100644 index d1867b8c4..000000000 --- a/man/matchLamaChromPeaks.Rd +++ /dev/null @@ -1,75 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/do_adjustRtime-functions.R, -% R/functions-Params.R, R/methods-Params.R -\name{matchLamasChromPeaks} -\alias{matchLamasChromPeaks} -\alias{summarizeLamaMatch} -\alias{rtMap} -\alias{plot,LamaParama,ANY-method} -\title{Match reference Lamas to ChromPeaks for evaluation prior to alignment} -\usage{ -matchLamasChromPeaks(object, param, BPPARAM = bpparam()) - -summarizeLamaMatch(param) - -rtMap(param) - -\S4method{plot}{LamaParama,ANY}( - x, - index = 1L, - colPoints = "#00000060", - colFit = "#00000080", - xlab = "Matched Chromatographic peaks", - ylab = "Lamas", - main = NULL, - ... -) -} -\arguments{ -\item{object}{An object of class `XcmsExperiment` with defined ChromPeaks.} - -\item{param}{An object of class `LamaParama` that will later be used for -adjustment using the `[adjustRtime()]` function.} - -\item{`LamaParama`}{same object that will be passed to the `adjustRtime()` -function. To run this function the `matchLamasChromPeaks()` need to be run -on this first.} - -\item{assay}{`numeric(1)`, assay that should be plotted.} -} -\value{ -A `LamaParama` object with new slot rtMap composed of a list of -matrices representing the 1:1 matches between Lamas (ref) and ChromPeaks -(obs). - -A `data.frame` with: - -- Total_peaks: total number of chromatographic peaks in the file -- Matched_peak: The number of matched peaks to Lamas -- Total_Lamas: Total number of Lamas -- Model_summary: `summary.loess` or `summary.gam` object for each file. - -A plot -} -\description{ -The `matchLamasChromPeaks()` function quickly matches each file's ChromPeaks -to Lamas, allowing the user to evaluate the matches for each file. - -The `summarizeLamaMatch()` generates a summary of the LamaParama method. -Composed of coverage % of the chrompeaks match over the total chrompeaks of -the object. as well as a summary of the model that will be applied to the -file to adjust the retention times - -the `plot()` function for `LamaParama` object allows to plot the obs -chromatographic peaks versus the reference lamas as well as the fitting -line for the chosen model type. The user can decide what file to inspect by -specifying the assay number with the parameter `assay` -} -\note{ -If there are no matches, the file retention will not be adjusted when -calling [adjustRtime()] with the same `LamaParama` and `XcmsExperiment` -object. -} -\author{ -Philippine Louail, Carl Brunius -}