Chromatograms: The Chromatograms class to manage and access chromatographic...

ChromatogramsR Documentation

The Chromatograms class to manage and access chromatographic data

Description

The Chromatograms class encapsules chromatographic data and related metadata. The chromatographic data is represented by a backend extending the virtual ChromBackend class which provides the raw data to the Chromatograms object. Different backends and their properties are decribed in the ChromBackend class documentation.

Usage

## S4 method for signature 'ChromBackendOrMissing'
Chromatograms(object = ChromBackendMemory(), processingQueue = list(), ...)

## S4 method for signature 'Spectra'
Chromatograms(
  object,
  summarize.method = c("sum", "max"),
  chromData = data.frame(),
  factorize.by = c("msLevel", "dataOrigin"),
  ...
)

## S4 method for signature 'Chromatograms,ChromBackend'
setBackend(
  object,
  backend,
  f = processingChunkFactor(object),
  BPPARAM = SerialParam(),
  ...
)

## S4 method for signature 'Chromatograms'
x$name

## S4 replacement method for signature 'Chromatograms'
x$name <- value

## S4 method for signature 'Chromatograms'
x[i, j, ..., drop = FALSE]

## S4 method for signature 'Chromatograms'
x[[i, j, ...]]

## S4 replacement method for signature 'Chromatograms'
x[[i, j, ...]] <- value

## S4 method for signature 'Chromatograms'
factorize(object, factorize.by = c("msLevel", "dataOrigin"), ...)

Arguments

object

A Chromatograms object.

processingQueue

list a list of processing steps (i.e. functions) to be applied to the chromatographic data. The processing steps are applied in the order they are listed in the processingQueue.

...

Additional arguments.

summarize.method

For Chromatograms created with a Spectra object: A character vector with the name of the function to be used to summaries the spectra data intensity. The available methods are "sum" and "max". The default is "sum".

chromData

For Chromatograms() build from a Spectra object backend, a data.frame with the chromatographic data. If not provided (or if empty), a default data.frame with the core chromatographic variables will be created.

factorize.by

A character vector with the names of the variables in the Spectra object and the chromData slot that should be used to factorize the Spectra object data to generate the chromatographic data.

backend

ChromBackend object providing the raw data for the Chromatograms object.

f

factor defining the grouping to split the Chromatograms object.

BPPARAM

Parallel setup configuration. See BiocParallel::bpparam() for more information.

x

A Chromatograms object.

name

A character string specifying the name of the variable to access.

value

The value to replace the variable with.

i

For [: integer, logical or character to subset the object.

j

For [ and [[: ignored.

drop

For [: logical(1) default to FALSE.

Creation of objects

Chromatograms objects can be created using the Chromatograms() construction function. Either by providing a ChromBackend object or by providing a Spectra object. The Spectra object will be used to generate a Chromatograms object with a backend of class ChromBackendSpectra.

Data stored in a Chromatograms object

The Chromatograms object is a container for chromatographic data, which includes peaks data (retention time and related intensity values, also referred to as peaks data variables in the context of Chromatograms) and metadata of individual chromatogram (so called chromatograms variables). While a core set of chromatograms variables (the coreChromatogramsVariables()) and peaks data variables (the corePeaksVariables()) are guaranteed to be provided by a Chromatograms, it is possible to add arbitrary variables to a Chromatograms object.

The Chromatograms object is designed to contain chromatographic data of a (large) set of chromatograms. The data is organized linearly and can be thought of a list of chromatograms, i.e. each element in the Chromatograms is one chromatogram.

The chromatograms variables information in the Chromatograms object can be accessed using the chromData() function. Specific chromatograms variables can be accessed by either precising the "columns" parameter in chromData() or using $. chromData can be accessed, replaced but also filtered/subsetted. Refer to the chromData documentation for more details.

The peaks data variables information in the Chromatograms object can be accessed using the peaksData() function. Specific peaks variables can be accessed by either precising the "columns" parameter in peaksData() or using $. peaksData can be accessed, replaced but also filtered/subsetted. Refer to the peaksData documentation for more details.

Processing of Chromatograms objects

Functions that process the chromatograms data in some ways can be applied to the object either directly or by using the processingQueue mechanism. The processingQueue is a list of processing steps that are stored within the object and only applied when needed. This was created so that the data can be processed in a single step and is very useful for larger datasets. This is even more true as this processing queue will call function that can be applied on the data in a chunk-wise manner. This allows for parallel processing of the data and reduces the memory demand. To read more about the processingQueue, and how to parallelize your processes, see the processingQueue documentation.

Note

This needs to be discussed, if we want for example to be able to set a a backend to ChromBackendMzR we need to implement backendInitialize() better. = Support peaksData and chromData as arguments AND have a way to write .mzml files (which we do not have for chromatographic data).

See Also

chromData for a general description of the chromatographic metadata available in the object, as well as how to access, replace and subset them. peaksData for a general description of the chromatographic peaks data available in the object, as well as how to access, replace and subset them. processingQueue for more information on the queuing of processings and parallelization for larger dataset.

Examples

## Create a Chromatograms object
chroms <- Chromatograms(ChromBackendMemory())


rformassspectrometry/Chromatograms documentation built on April 12, 2025, 6:53 p.m.