Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

intensityMatrix-functions

Converts a list of MassPeaks objects into a matrix.


Description

This function converts a list of MassPeaks objects into a matrix.

Usage

intensityMatrix(peaks, spectra)

Arguments

peaks

list, list of MassPeaks objects.

spectra

list, list of MassSpectrum objects. If a peak is missing the corresponding intensity value of the spectrum is used. If spectra is missing NA is used instead.

Details

peaks have to be binned by binPeaks before calling intensityMatrix.

Value

Returns a matrix containing intensities of all MassPeaks objects of peaks and interpolated intensity values for missing peaks if spectra was given or NA otherwise.
The matrix has length(peaks) rows (one row for each sample) and length(unique(mass)) columns. There is an additional attribute "mass" that stores the mass values.

Author(s)

Sebastian Gibb mail@sebastiangibb.de

See Also

Examples

## load package
library("MALDIquant")

## create example MassPeaks objects
p <- list(createMassPeaks(mass=1:4,
                          intensity=11:14,
                          metaData=list(name="test mass peaks 1")),
          createMassPeaks(mass=2:5,
                          intensity=22:25,
                          metaData=list(name="test mass peaks 2")))

## converts MassPeaks objects into a matrix
intensityMatrix(p)


## realistic example

## load example data
data("fiedler2009subset", package="MALDIquant")

## transform intensities
s <- transformIntensity(fiedler2009subset, method="sqrt")

## smoothing spectrum
s <- smoothIntensity(s, method="MovingAverage")

## remove baseline
s <- removeBaseline(s)

## call peak detection
p <- detectPeaks(s)

## bin peaks
p <- binPeaks(p)

## convert MassPeaks objects into a matrix with missing intensity
## values
intensityMatrix(p)

## convert MassPeaks and MassSpectrum objects into a matrix without
## missing intensity values
intensityMatrix(p, s)

MALDIquant

Quantitative Analysis of Mass Spectrometry Data

v1.19.3
GPL (>= 3)
Authors
Sebastian Gibb [aut, cre] (<https://orcid.org/0000-0001-7406-4443>), Korbinian Strimmer [ths] (<https://orcid.org/0000-0001-7917-2056>)
Initial release
2019-05-12

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.