Skip to content

Commit

Permalink
docs: convert documentation to markdown format
Browse files Browse the repository at this point in the history
  • Loading branch information
jorainer committed Feb 12, 2025
1 parent 30b1633 commit a8c9cef
Show file tree
Hide file tree
Showing 28 changed files with 843 additions and 660 deletions.
2 changes: 1 addition & 1 deletion R/DataClasses.R
Original file line number Diff line number Diff line change
Expand Up @@ -1738,7 +1738,7 @@ setClass("MsFeatureData", contains = c("environment"),
#' - [overlappingFeatures()] identify features that are overlapping or close
#' in the m/z - rt space (see respective help page).
#'
#' - [quantify()]: extract feature intensities and put them, along
#' - [xcms::quantify()]: extract feature intensities and put them, along
#' with feature definitions and phenodata information, into a
#' [SummarizedExperiment::SummarizedExperiment()]. See help page for details.
#'
Expand Down
5 changes: 3 additions & 2 deletions R/XcmsExperiment.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' @title Next Generation `xcms` Result Object
#'
#' @aliases XcmsExperiment-class show,XcmsExperiment-method filterChromPeaks
#' @aliases featureArea
#' @aliases featureArea quantify
#'
#' @description
#'
Expand Down Expand Up @@ -1216,7 +1216,8 @@ setMethod(
colnames(chromPeaks)))
stop("'chromPeaks' lacks one or more of the required colums ",
"\"mzmin\", \"mzmax\", \"rtmin\" and \"rtmax\".")
chromPeaks <- chromPeaks[, c("mzmin", "mzmax", "rtmin", "rtmax")]
chromPeaks <- chromPeaks[, c("mzmin", "mzmax", "rtmin", "rtmax"),
drop = FALSE]
if (!all(samples %in% seq_along(object)))
stop("'samples' out of bounds")
if (hasFeatures(object))
Expand Down
20 changes: 10 additions & 10 deletions R/do_findChromPeaks-functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -2379,14 +2379,14 @@ do_findPeaks_MSW <- function(mz, int, snthresh = 3,
## }

## Tuned from the original code.
#' @param peaks. \code{matrix} or \code{data.frame} with peaks for which
#' isotopes should be predicted. Required columns are \code{"mz"},
#' \code{"mzmin"}, \code{"mzmax"}, \code{"scmin"}, \code{"scmax"},
#' \code{"intb"} and \code{"scale"}.
#'
#' @return a \code{matrix} with columns \code{"mz"}, \code{"mzmin"},
#' \code{"mzmax"}, \code{"scmin"}, \code{"scmax"}, \code{"length"} (always -1),
#' \code{"intensity"} (always -1) and \code{"scale"}.
#' @param peaks. `matrix` or `data.frame` with peaks for which
#' isotopes should be predicted. Required columns are `"mz"`,
#' `"mzmin"`, `"mzmax"`, `"scmin"`, `"scmax"`,
#' `"intb"` and `"scale"`.
#'
#' @return a `matrix` with columns `"mz"`, `"mzmin"`,
#' `"mzmax"`, `"scmin"`, `"scmax"`, `"length"` (always -1),
#' `"intensity"` (always -1) and `"scale"`.
#' @noRd
do_define_isotopes <- function(peaks., maxCharge = 3, maxIso = 5,
mzIntervalExtension = TRUE) {
Expand Down Expand Up @@ -2430,8 +2430,8 @@ do_define_isotopes <- function(peaks., maxCharge = 3, maxIso = 5,

#' @param peaks. see do_define_isotopes
#'
#' @param polarity character(1) defining the polarity, either \code{"positive"}
#' or \code{"negative"}.
#' @param polarity character(1) defining the polarity, either `"positive"`
#' or `"negative"`.
#'
#' @note
#'
Expand Down
10 changes: 5 additions & 5 deletions R/functions-MsFeatureData.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#' Validates a 'chromPeaks' matrix or data.frame and ensures that it contains all
#' required columns and that all columns are of numeric data type.
#'
#' @return \code{TRUE} or a \code{character} with the error message.
#' @return `TRUE` or a `character` with the error message.
#'
#' @noRd
.validChromPeaksMatrix <- function(x) {
Expand Down Expand Up @@ -62,7 +62,7 @@
#'
#' @author Johannes Rainer
#'
#' @return \code{TRUE} if object is valid, or a message with the error message.
#' @return `TRUE` if object is valid, or a message with the error message.
#'
#' @noRd
validateMsFeatureData <- function(x) {
Expand Down Expand Up @@ -157,12 +157,12 @@ validateMsFeatureData <- function(x) {
#' @description Filter chromPeaks and sync them with with the present
#' featureDefinitions, i.e. update their peakidx column or remove them.
#'
#' @param x A \code{MsFeatureData} or an \code{XCMSnExp} object.
#' @param x A `MsFeatureData` or an `XCMSnExp` object.
#'
#' @param idx \code{numeric} with the indices of the chromatographic peaks to
#' @param idx `numeric` with the indices of the chromatographic peaks to
#' keep.
#'
#' @return A \code{MsFeatureData}.
#' @return A `MsFeatureData`.
#'
#' @author Johannes Rainer
#'
Expand Down
22 changes: 11 additions & 11 deletions R/functions-OnDiskMSnExp.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#' @param param A class extending Param containing all parameters for the
#' peak detection method.
#'
#' @return a list of length 2, \code{peaks} containing a matrix with the
#' identified peaks and \code{date} the time stamp when the peak detection
#' @return a list of length 2, `peaks` containing a matrix with the
#' identified peaks and `date` the time stamp when the peak detection
#' was started.
#'
#' @noRd
Expand Down Expand Up @@ -42,8 +42,8 @@ findChromPeaks_OnDiskMSnExp <- function(object, method = "centWave",
#' @param rt Numeric with the retention times for the spectra. If not provided
#' it is extracted from the spectra.
#'
#' @return a list of length 2, \code{peaks} containing a matrix with the
#' identified peaks and \code{date} the time stamp when the peak detection
#' @return a list of length 2, `peaks` containing a matrix with the
#' identified peaks and `date` the time stamp when the peak detection
#' was started.
#'
#' @author Johannes Rainer
Expand Down Expand Up @@ -314,9 +314,9 @@ findPeaks_MSW_Spectrum_list <- function(x, method = "MSW", param) {

#' @description Processes the result list returned by an lapply/bplapply to
#' findChromPeaks_Spectrum_list or findChromPeaks_OnDiskMSnExp and returns a
#' list with two elements: \code{$peaks} the peaks matrix of identified
#' peaks and \code{$procHist} a list of ProcessHistory objects (empty if
#' \code{getProcHist = FALSE}).
#' list with two elements: `$peaks` the peaks matrix of identified
#' peaks and `$procHist` a list of ProcessHistory objects (empty if
#' `getProcHist = FALSE`).
#'
#' @param x See description above.
#'
Expand Down Expand Up @@ -363,14 +363,14 @@ findPeaks_MSW_Spectrum_list <- function(x, method = "MSW", param) {
#' @note Adjustment should be performed only on spectra from the same MS level!
#' It's up to the calling function to ensure that.
#'
#' @param object An \code{OnDiskMSnExp}.
#' @param object An `OnDiskMSnExp`.
#'
#' @param param An \code{ObiwarpParam}.
#' @param param An `ObiwarpParam`.
#'
#' @param msLevel \code{integer} defining the MS level on which the adjustment
#' @param msLevel `integer` defining the MS level on which the adjustment
#' should be performed.
#'
#' @return The function returns a \code{list} of adjusted retention times
#' @return The function returns a `list` of adjusted retention times
#' grouped by file.
#'
#' @noRd
Expand Down
72 changes: 43 additions & 29 deletions R/functions-Params.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

##
#' @description Extract all slot values and put them into a list, names being
#' the slot names. If a slot \code{addParams} exist its content will be
#' the slot names. If a slot `addParams` exist its content will be
#' appended to the returned list.
#'
#' @param x A Param class.
Expand Down Expand Up @@ -66,22 +66,26 @@

############################################################
## GenericParam
#' @return The \code{GenericParam} function returns a \code{GenericParam}
#' @return The `GenericParam()` function returns a `GenericParam`
#' object.
#'
#' @param fun \code{character} representing the name of the function.
#' @param fun `character` representing the name of the function.
#'
#' @param args \code{list} (ideally named) with the arguments to the function.
#' @param args `list` (ideally named) with the arguments to the function.
#'
#' @md
#'
#' @rdname GenericParam
GenericParam <- function(fun = character(), args = list()) {
return(new("GenericParam", fun = fun, args = args))
}

#' @return The \code{CentWaveParam} function returns a \code{CentWaveParam}
#' @return The `CentWaveParam()` function returns a `CentWaveParam`
#' class instance with all of the settings specified for chromatographic
#' peak detection by the centWave method.
#'
#' @md
#'
#' @rdname findChromPeaks-centWave
CentWaveParam <- function(ppm = 25, peakwidth = c(20, 50), snthresh = 10,
prefilter = c(3, 100), mzCenterFun = "wMean",
Expand All @@ -99,11 +103,13 @@ CentWaveParam <- function(ppm = 25, peakwidth = c(20, 50), snthresh = 10,
verboseBetaColumns=verboseBetaColumns))
}

#' @return The \code{MatchedFilterParam} function returns a
#' \code{MatchedFilterParam} class instance with all of the settings
#' specified for chromatographic detection by the \emph{matchedFilter}
#' @return The `MatchedFilterParam()` function returns a
#' `MatchedFilterParam` class instance with all of the settings
#' specified for chromatographic detection by the *matchedFilter*
#' method.
#'
#' @md
#'
#' @rdname findChromPeaks-matchedFilter
MatchedFilterParam <- function(binSize = 0.1, impute = "none",
baseValue = numeric(), distance = numeric(),
Expand All @@ -129,11 +135,13 @@ MatchedFilterParam <- function(binSize = 0.1, impute = "none",
return("intlin")
}

#' @return The \code{MassifquantParam} function returns a
#' \code{MassifquantParam} class instance with all of the settings
#' specified for chromatographic peak detection by the \emph{massifquant}
#' @return The `MassifquantParam()` function returns a
#' `MassifquantParam` class instance with all of the settings
#' specified for chromatographic peak detection by the *massifquant*
#' method.
#'
#' @md
#'
#' @rdname findChromPeaks-massifquant
MassifquantParam <- function(ppm = 25, peakwidth = c(20, 50), snthresh = 10,
prefilter = c(3, 100), mzCenterFun = "wMean",
Expand All @@ -156,37 +164,39 @@ MassifquantParam <- function(ppm = 25, peakwidth = c(20, 50), snthresh = 10,
#' @param scales Numeric defining the scales of the continuous wavelet
#' transform (CWT).
#'
#' @param nearbyPeak logical(1) whether to include nearby peaks of
#' @param nearbyPeak `logical(1)` whether to include nearby peaks of
#' major peaks.
#'
#' @param peakScaleRange numeric(1) defining the scale range of the
#' @param peakScaleRange `numeric(1)` defining the scale range of the
#' peak (larger than 5 by default).
#'
#' @param ampTh numeric(1) defining the minimum required relative
#' @param ampTh `numeric(1)` defining the minimum required relative
#' amplitude of the peak (ratio of the maximum of CWT coefficients).
#'
#' @param minNoiseLevel numeric(1) defining the minimum noise level
#' @param minNoiseLevel `numeric(1)` defining the minimum noise level
#' used in computing the SNR.
#'
#' @param ridgeLength numeric(1) defining the minimum highest scale
#' @param ridgeLength `numeric(1)` defining the minimum highest scale
#' of the peak in 2-D CWT coefficient matrix.
#'
#' @param peakThr numeric(1) with the minimum absolute intensity
#' @param peakThr `numeric(1)` with the minimum absolute intensity
#' (above baseline) of peaks to be picked. If provided, the smoothing
#' Savitzky-Golay filter is used (in the \code{MassSpecWavelet})
#' Savitzky-Golay filter is used (in the *MassSpecWavelet*)
#' package to estimate the local intensity.
#'
#' @param tuneIn logical(1) whther to tune in the parameter
#' @param tuneIn `logical(1)` whther to tune in the parameter
#' estimation of the detected peaks.
#'
#' @param ... Additional parameters to be passed to the
#' \code{\link{peakDetectionCWT}} and
#' \code{\link{identifyMajorPeaks}} functions from the
#' \code{MassSpecWavelet} package.
#' `peakDetectionCWT()` and
#' `identifyMajorPeaks()` functions from the
#' *MassSpecWavelet* package.
#'
#' @return The \code{MSWParam} function returns a \code{MSWParam}
#' @return The `MSWParam()` function returns a `MSWParam`
#' class instance with all of the settings specified for peak detection by
#' the \emph{MSW} method.
#' the *MSW* method.
#'
#' @md
#'
#' @rdname findPeaks-MSW
MSWParam <- function(snthresh = 3, verboseColumns = FALSE,
Expand All @@ -205,11 +215,13 @@ MSWParam <- function(snthresh = 3, verboseColumns = FALSE,
peakThr = peakThr, tuneIn = tuneIn, addParams = addParams))
}

#' @return The \code{CentWavePredIsoParam} function returns a
#' \code{CentWavePredIsoParam} class instance with all of the settings
#' @return The `CentWavePredIsoParam()` function returns a
#' `CentWavePredIsoParam` class instance with all of the settings
#' specified for the two-step centWave-based peak detection considering also
#' isotopes.
#'
#' @md
#'
#' @rdname findChromPeaks-centWaveWithPredIsoROIs
CentWavePredIsoParam <- function(ppm = 25, peakwidth = c(20, 50), snthresh = 10,
prefilter = c(3, 100), mzCenterFun = "wMean",
Expand Down Expand Up @@ -323,8 +335,10 @@ ObiwarpParam <- function(binSize = 1, centerSample = integer(), response = 1L,
rtimeDifferenceThreshold = rtimeDifferenceThreshold[1L])
}

#' @return The \code{FillChromPeaksParam} function returns a
#' \code{FillChromPeaksParam} object.
#' @return The `FillChromPeaksParam()` function returns a
#' `FillChromPeaksParam` object.
#'
#' @md
#'
#' @rdname fillChromPeaks
FillChromPeaksParam <- function(expandMz = 0, expandRt = 0, ppm = 0,
Expand All @@ -339,7 +353,7 @@ fixedRt <- function(object) object@fixedRt
#' @rdname fillChromPeaks
fixedMz <- function(object) object@fixedMz

#' @return The `CalibrantMassParam` function returns an instance of
#' @return The `CalibrantMassParam()` function returns an instance of
#' the `CalibrantMassParam` class with all settings and properties set.
#'
#' @md
Expand Down
32 changes: 16 additions & 16 deletions R/functions-XCMSnExp.R
Original file line number Diff line number Diff line change
Expand Up @@ -140,26 +140,26 @@ dropGenericProcessHistory <- function(x, fun) {
#'
#' @note
#'
#' Ideally, \code{x} should be an \code{OnDiskMSnExp} object as subsetting
#' of a \code{XCMSnExp} object is more costly (removing of preprocessing
#' Ideally, `x` should be an `OnDiskMSnExp` object as subsetting
#' of a `XCMSnExp` object is more costly (removing of preprocessing
#' results, restoring data etc). If retention times reported in the
#' featureData are replaced by adjusted retention times, these are set
#' in the Spectrum objects as retention time.
#'
#' @param x An \code{OnDiskMSnExp} object.
#' @param x An `OnDiskMSnExp` object.
#'
#' @param rt \code{numeric(2)} with the retention time range from which the
#' @param rt `numeric(2)` with the retention time range from which the
#' data should be extracted.
#'
#' @param mz \code{numeric(2)} with the mz range.
#' @param mz `numeric(2)` with the mz range.
#'
#' @param msLevel \code{integer} defining the MS level(s) to which the data
#' @param msLevel `integer` defining the MS level(s) to which the data
#' should be restricted prior to data extraction.
#'
#' @return
#'
#' A \code{list} with length equal to the number of files and
#' each element being a \code{data.frame} with the extracted values.
#' A `list` with length equal to the number of files and
#' each element being a `data.frame` with the extracted values.
#'
#' @noRd
#'
Expand Down Expand Up @@ -212,23 +212,23 @@ dropGenericProcessHistory <- function(x, fun) {
#'
#' @note This reads the full data first and does the subsetting later in R.
#'
#' @param object An \code{XCMSnExp} object representing a single sample.
#' @param object An `XCMSnExp` object representing a single sample.
#'
#' @param peakArea A \code{matrix} with the peak definition, i.e.
#' \code{"rtmin"}, \code{"rtmax"}, \code{"mzmin"} and \code{"mzmax"}.
#' @param peakArea A `matrix` with the peak definition, i.e.
#' "rtmin", "rtmax", "mzmin" and "mzmax".
#'
#' @param sample_idx \code{integer(1)} with the index of the sample in the
#' @param sample_idx integer(1) with the index of the sample in the
#' object.
#'
#' @param mzCenterFun Name of the function to be used to calculate the mz value.
#' Defaults to \code{weighted.mean}, i.e. the intensity weighted mean mz.
#' Defaults to weighted.mean, i.e. the intensity weighted mean mz.
#'
#' @param cn \code{character} with the names of the result matrix.
#' @param cn character with the names of the result matrix.
#'
#' @return
#'
#' A \code{matrix} with at least columns \code{"mz"}, \code{"rt"},
#' \code{"into"} and \code{"maxo"} with the by intensity weighted mean of
#' A matrix with at least columns `"mz"`, `"rt"`,
#' `"into"` and `"maxo"` with the by intensity weighted mean of
#' mz, rt or the maximal intensity in the area, the integrated signal in
#' the area and the maximal signal in the area.
#'
Expand Down
Loading

0 comments on commit a8c9cef

Please sign in to comment.