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

plotMsiSlice-methods

Plots a Mass Spectrometry Imaging dataset.


Description

This function allows to plot a slice of a mass spectrometry imaging dataset represented by a list of AbstractMassObject objects or an array or a matrix.

Usage

## S4 method for signature 'list'
plotMsiSlice(x, center, tolerance,
  colRamp=colorRamp(c("black", "blue", "green", "yellow", "red")),
  interpolate=FALSE, legend=TRUE, alignLabels=FALSE, combine=FALSE,
  ...)
## S4 method for signature 'array'
plotMsiSlice(x,
  colRamp=colorRamp(c("black", "blue", "green", "yellow", "red")),
  interpolate=FALSE, legend=TRUE, alignLabels=FALSE, combine=FALSE,
  plotInteractive=FALSE, ...)
## S4 method for signature 'matrix'
plotMsiSlice(x,
  colRamp=colorRamp(c("black", "blue", "green", "yellow", "red")),
  interpolate=FALSE, scale=TRUE, legend=scale, ...)

Arguments

x

The mass spectrometry imaging dataset. It could be a list of MassSpectrum/MassPeaks objects or an array (e.g. generated by msiSlices) or a matrix.

center

double, if x is a list of MassSpectrum/MassPeaks objects this argument represent the center mass value of the slices, see msiSlices for details.

tolerance

double, if center is given tolerance specifies the thickness of the slices (center + c(-tolerance, tolerance)), see msiSlices for details.

colRamp

colours as colorRamp function, see colorRamp for details. If combine=TRUE multiple colour functions must be applied as list with an length that equals the number of given centers.

interpolate

logical, use linear interpolation when drawing the image, see rasterImage for details.

scale

logical, if TRUE all values are divided by the maximal value of the slice to get values between 0 and 1.

legend

logical, if TRUE a reference color gradient is plotted on the right hand side of the plot. The upper color represents the highest value in the slice and the lower color the lowest value respectively. The legend is disabled if scale=FALSE.

alignLabels

logical, if combine=TRUE and alignLabels=TRUE the center positions below the legend are aligned on the right margin otherwise the aligned to their corresponding gradient.

combine

logical, if TRUE multiple centers are plotted in one image. Therefore it would be necessary to apply a list of colRamp functions (one function for each center). The intensity values for each center of each pixel are compared against each other and the highest scaled intensity determines the center (and the corresponding colRamp).

plotInteractive

logical, if the slice array contains multiple centers, combine=FALSE and an interactive plotting device is used a warning is thrown and only the first center would be plotted. Use plotInteractive=TRUE to overwrite this behaviour and to plot multiple centers on an interactive device.

...

arguments to be passed to plot, e.g. main.

Details

Each MassSpectrum/MassPeaks object in x must contain a list named imaging with an element pos that stores the x and y value of the spectrum, e.g.:

> metaData(spectra[[1]])$imaging$pos
x y
1 5

Author(s)

Sebastian Gibb mail@sebastiangibb.de

See Also

Please find real examples on:

Examples

## load package
library("MALDIquant")

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

## please note: this is NOT a MSI data set
## we just add some coordinates for demonstration
coordinates(fiedler2009subset) <- cbind(x=rep(1:4, 2), y=rep(1:2, each=4))

plotMsiSlice(fiedler2009subset, center=8936.97, tolerance=0.25)

plotMsiSlice(fiedler2009subset, center=c(5864.49, 8936.97), tolerance=0.25,
             combine=TRUE,
             colRamp=list(colorRamp(c("#000000", "#FF00FF")),
                          colorRamp(c("#000000", "#00FF00"))))

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.