Learn R Programming

MALDIquant (version 1.1)

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

## S3 method for class 'list':
plotMsiSlice(x, center, tolerance,
  colRamp=colorRamp(c("black", "blue", "green", "yellow", "red")),
  interpolate=FALSE, legend=TRUE, alignLabels=FALSE, combine=FALSE,
  ...)
## S3 method for class 'array':
plotMsiSlice(x,
  colRamp=colorRamp(c("black", "blue", "green", "yellow", "red")),
  interpolate=FALSE, legend=TRUE, alignLabels=FALSE, combine=FALSE,
  plotInteractive=FALSE, ...)
## S3 method for class '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
center
double, if x is a list of MassSpectrum/MassPeaks objects this argument represent the center mass value of the slices,
tolerance
double, if center is given tolerance specifies the thickness of the slices (center + c(-tolerance, tolerance)), see msiSlices for deta
colRamp
colours as colorRamp function, see colorRamp for details. If combine=TRUE multiple colour functions must be applied as list with an len
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<
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 eac
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=TR
...
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

See Also

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

Please find real examples on:

Website: http://strimmerlab.org/software/maldiquant/

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

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

Examples

Run this code
## 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"))))

Run the code above in your browser using DataLab