R/classes.R

# massFlowTemplate ------------------------------------------------------------------------------------------------
#' @aliases massFlowTemplate
#'
#' @title massFlowTemplate, a class for sample alignment and annotation
#'
#' @description This class enables the alignment of LC-MS samples.
#' It takes files containing groups of structurally related peaks, generated by \code{\link{groupPEAKS}} function, and aligns them in their original sample acquisition order.
#' It validates peak groups obtained during alignment by correlating peak intensities in all samples.
#' Finally, it fills in missing peak intensity values using raw data.
#'
#' @details \code{massFlowTemplate} object stores sample alignment data.
#'
#' \itemize{
#' \item Slot @@tmp is the template, listing information for every detected peak, such as the \emph{m/z}, \emph{rt}, \emph{into} values and the assigned peak-group.
#' \item Template is first built using the first datafile in the study.
#' To initiate template built, constructor function \code{\link{buildTMP}} must be called, providing a "filepath" to the csv file with the details on the study samples.
#' \item Template is updated with every round of sample alignment.
#' Alignment results are stored in slot @@data for each sample separately.
#' }
#'
#' @slot filepath \code{character} specifying the absolute path to a \code{csv} file with study sample names and their acquisition (run) order.
#' @slot samples \code{data.frame} storing study sample names and their acquisition order.
#' @slot tmp \code{data.frame} storing sample alignment and annotation template.
#' @slot data \code{list} containg annotated and aligned peak tables for the already processed samples.
#' @slot params \code{list} containg alignment and annotation parameters.
#' @slot valid \code{data.frame} storing validated sample alignment template with peakids and corresponding Pseudo Chemical Spectra id.
#' @slot peaks \code{list} containing peak intergration values for every peak (NA if peak was not detected), listead peak-wise.
#' @slot values \code{list} containing peak intergration values for every sample  (NA if peak was not detected), listed sample-wise.
#' @slot history \code{list} containg names of methods that have already been applied to the object.
#'
#' @seealso \code{\link{buildTMP}}, \code{\link{alignPEAKS}}, \code{\link{validPEAKS}}
#'
#' @rdname massFlowTemplate-class
#'
#' @export
#'
setClass(
  "massFlowTemplate",
  slots = c(
    filepath = "character",
    samples = "data.frame",
    tmp = "data.frame",
    data = "list",
    params = "list",
    valid = "data.frame",
    peaks = "list",
    values = "list",
    history = "list"
  )
)

# massFlowAnno ------------------------------------------------------------
#' @aliases massFlowAnno
#'
#' @title massFlowAnno, a class for peak table annotation with a chemical standards database.
#'
#' @description This class enables annotation of the final peak table obtained with massFlowR pipeline.
#'
#' @slot filepath \code{character} specifying the absolute path to \code{csv} file with peak intensity table.
#' @slot samples \code{data.frame} storing study sample names and their acquisition order.
#' @slot data \code{data.frame} with peak intensity values for each sample.
#' @slot ds \code{data.frame} with pseudo-chemical-spectra intensity values of samples with the highest intensity for that PCS.
#' @slot db \code{data.frame} storing chemical standards database table, obtained with \code{\link{buildDB}}.
#' @slot anno \code{data.frame} storing peak table with database annotations (if any).
#' @slot mat \code{matrix} with peak annotation results, rows are chemid (database chemicals) and columns are PCS.
#' @slot params \code{list} containg database matching parameters.
#'
#' @seealso \code{\link{buildDB}}, \code{\link{annotateDS}}
#'
#' @rdname massFlowAnno-class
#'
#' @export
#'
setClass(
  "massFlowAnno",
  slots = c(
    filepath = "character",
    samples = "data.frame",
    data = "data.frame",
    ds = "data.frame",
    db = "data.frame",
    anno = "data.frame",
    mat = "matrix",
    params = "list"
  )
)
lauzikaite/massFlowR documentation built on April 29, 2020, 9:45 a.m.