plotMsiSlice-methods: Plots a Mass Spectrometry Imaging dataset.

plotMsiSlice-methodsR Documentation

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

AbstractMassObject, MassSpectrum, MassPeaks, coordinates,AbstractMassObject-method, msiSlices, plot,MassSpectrum,missing-method

Please find real examples on:

Website: https://strimmerlab.github.io/software/maldiquant/

Vignette: https://github.com/sgibb/MALDIquantExamples/raw/master/inst/doc/nyakas2013.pdf

Shiny: https://github.com/sgibb/ims-shiny/

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 documentation built on March 31, 2023, 10:40 p.m.