MSImagingExperiment-class {Cardinal} | R Documentation

## MSImagingExperiment: Mass spectrometry imaging experiments

### Description

The `MSImagingExperiment` class is designed for mass spectrometry imaging experimental data and metadata. It is designed to contain full MSI experiments, including multiple runs and replicates, potentially across multiple files. Both 2D and 3D imaging experiments are supported, as well as any type of experimental metadata such as diagnosis, subject, time point, etc.

### Usage

    ## Instance creation
    MSImagingExperiment(
        imageData = matrix(nrow=0, ncol=0),
        featureData = MassDataFrame(),
        pixelData = PositionDataFrame(),
        metadata = list(),
        processing = SimpleList(),
        centroided = FALSE)

    ## Additional methods documented below

### Arguments

`imageData` | Either a matrix-like object with number of rows equal to the number of features and number of columns equal to the number of pixels, or an `ImageArrayList`.
`featureData` | A `MassDataFrame` with feature metadata, with a row for each m/z value.
`pixelData` | A `PositionDataFrame` with pixel metadata, with a row for each pixel.
`metadata` | A `list` with experimental-level metadata.
`processing` | A `SimpleList` with processing steps. This should typically be empty for new objects.
`centroided` | `FALSE` if the object contains profile spectra and `TRUE` if the spectra have been peak-picked and centroided.

### Details

The `MSImagingExperiment` class is designed as a replacement for the `MSImageSet` class, using a simplified, robust implementation that should be more future-proof and enable better support for large, high-resolution experiments, multimodal experiments, and experiments with specialized needs such as non-gridded pixel coordinates.

Subclasses `MSContinuousImagingExperiment` and `MSProcessedImagingExperiment` exist to allow downstream methods to make assumptions about the underlying data storage (dense matrices for 'continous' format and sparse matrices for 'processed' format), which can sometimes allow more efficient computations.

### Slots

`imageData`:

  An object inheriting from `ImageArrayList`, storing one or more array-like data elements with conformable dimensions.

`featureData`:

  Contains feature information in a `MassDataFrame`. Each row includes the metadata associated with an m/z value.

`elementMetadata`:

  Contains pixel information in a `PositionDataFrame`. Each row includes the metadata for a single observation (e.g., a pixel), including specialized slot-columns for tracking pixel coordinates and experimental runs.

`metadata`:

  A `list` containing experiment-level metadata.

`processing`:

  A `SimpleList` containing processing steps (including both queued and previously executed processing steps).

`centroided`:

  `FALSE` if the object contains profile spectra and `TRUE` if the spectra have been peak-picked and centroided.

### Methods

All methods for `ImagingExperiment` and `SparseImagingExperiment` also work on `MSImagingExperiment` objects. Additional methods are documented below:

`spectraData(object)`, `spectraData(object) <- value`:

  Get or set the spectra list (alias for `imageData(object)`).

`spectra(object)`, `spectra(object) <- value`:

  Get or set the spectra (alias for `iData(object)`).

`mz(object)`, `mz(object) <- value`:

  Get or set the m/z values from `pixelData`.

`resolution(object)`, `resolution(object) <- value`:

  Get or set the m/z resolution of the dataset. Typically, this should not be set manually.

`centroided(object)`, `centroided(object) <- value`:

  Get or set the spatial position slot-columns from `pixelData`.

`pixels(object, ..., coord, run)`:

  Returns the row indices of `pixelData` corresponding to conditions passed via ....

`features(object, ..., mz)`:

  Returns the row indices of `featureData` corresponding to conditions passed via ....

`collect(x, ...)`:

  Pull all data elements of `imageData` into memory as matrices.

`peaks(object)`, `peaks(object) <- value`:

  Attempt to get or set the matrix of peaks. Alias for `spectra()` if `centroided()` is TRUE; replacement version also sets `centroided` to TRUE.

`peakData(object)`, `peakData(object) <- value`:

  Attempt to get or set the underlying m/z and intensity arrays of the peak data in processed experiments. (Currently only implemented for `MSProcessedImagingExperiment`).

`isCentroided(object)`:

  Attempts to infer if the mass spectra are centroided or not (without referencing the `centroided` slot.

`msiInfo(object, ...)`:

  Returns metadata for writing the object to imzML.

`rbind(...)`, `cbind(...)`:

  Combine `MSImagingExperiment` objects by row or column.

### Author(s)

Kylie A. Bemis

### See Also

`ImagingExperiment`, `SparseImagingExperiment`, `MSContinuousImagingExperiment`, `MSProcessedImagingExperiment`

### Examples

    mz <- mz(from=200, to=220, by=400)
    coord <- expand.grid(x=1:3, y=1:3)
    data <- matrix(runif(length(mz) * nrow(coord)),
        nrow=length(mz), ncol=nrow(coord))

    idata <- ImageArrayList(data)
    fdata <- MassDataFrame(mz=mz)
    pdata <- PositionDataFrame(coord=coord)

    x <- MSImagingExperiment(
        imageData=idata,
        featureData=fdata,
        pixelData=pdata)

    print(x)

[Package Cardinal version 2.4.0 Index]