Last data update: 2014.03.03

R: Turn a list of AbstractMassObjects into a mass spectrometry...
msiSlicesR Documentation

Turn a list of AbstractMassObjects into a mass spectrometry imaging slice.

Description

This function turns a mass spectrometry imaging dataset represented by a list of AbstractMassObject objects into an intensityMatrix for each slice (stored in an array).

Usage

msiSlices(x, center, tolerance, method=c("sum", "mean", "median"), adjust=TRUE)

Arguments

x

a list of MassSpectrum/ MassPeaks objects.

center

double, the center mas value of each slice.

tolerance

double, specifies the thickness of the slices (center + c(-tolerance, tolerance)).

method

used aggregation function.

adjust

logical, if TRUE the lowest coordinates of the mass spectrometry imaging dataset are set to c(x=1, y=1) to avoid NA values at the borders.

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

Value

Returns an array of three dimensions. The first and second dimensions contains the x and y coordinates of the image. The third dimension represents the index of the center of each slice. There are two additional attributes, namely "center" and "tolerance" which store the original center and tolerance information.

Author(s)

Sebastian Gibb mail@sebastiangibb.de

See Also

AbstractMassObject, MassSpectrum, MassPeaks, coordinates,AbstractMassObject-method, plotMsiSlice,list-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

## 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))

slices <- msiSlices(fiedler2009subset, center=c(5864.49, 8936.97),
                    tolerance=0.25)

slices

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(MALDIquant)

This is MALDIquant version 1.15
Quantitative Analysis of Mass Spectrometry Data
 See '?MALDIquant' for more information about this package.

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/MALDIquant/msiSlices-functions.Rd_%03d_medium.png", width=480, height=480)
> ### Name: msiSlices
> ### Title: Turn a list of AbstractMassObjects into a mass spectrometry
> ###   imaging slice.
> ### Aliases: msiSlices
> 
> ### ** 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))
> 
> slices <- msiSlices(fiedler2009subset, center=c(5864.49, 8936.97),
+                     tolerance=0.25)
> 
> slices
, , 1

      [,1] [,2]
[1,]  9018 2072
[2,]  9873 2772
[3,]  9135 3617
[4,] 12729 3338

, , 2

     [,1] [,2]
[1,]  931 4397
[2,] 1026 4801
[3,] 1665 2675
[4,] 2071 3223

attr(,"center")
[1] 5864.49 8936.97
attr(,"tolerance")
[1] 0.25
attr(,"method")
[1] "sum"
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>