Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass...

143
Package ‘Cardinal’ March 20, 2020 Type Package Title A mass spectrometry imaging toolbox for statistical analysis Version 2.4.0 Date 2015-1-12 Author Kylie A. Bemis <[email protected]> Maintainer Kylie A. Bemis <[email protected]> Description Implements statistical & computational tools for analyzing mass spectrometry imaging datasets, including methods for efficient pre-processing, spatial segmentation, and classification. License Artistic-2.0 Depends BiocGenerics, BiocParallel, EBImage, graphics, methods, S4Vectors (>= 0.23.18), stats, ProtGenerics Imports Biobase, dplyr, irlba, lattice, Matrix, matter, magrittr, mclust, nlme, parallel, signal, sp, stats4, utils, viridisLite Suggests BiocStyle, testthat, knitr, rmarkdown VignetteBuilder knitr biocViews Software, Infrastructure, Proteomics, Lipidomics, MassSpectrometry, ImagingMassSpectrometry, ImmunoOncology, Normalization, Clustering, Classification, Regression URL http://www.cardinalmsi.org git_url https://git.bioconductor.org/packages/Cardinal git_branch RELEASE_3_10 git_last_commit 5f5c0c9 git_last_commit_date 2019-10-29 Date/Publication 2020-03-19 R topics documented: Cardinal-package ...................................... 3 AnnotatedImage-class .................................... 4 AnnotatedImagingExperiment-class ............................ 5 batchProcess-methods .................................... 7 colocalized-methods .................................... 8 1

Transcript of Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass...

Page 1: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

Package ‘Cardinal’March 20, 2020

Type Package

Title A mass spectrometry imaging toolbox for statistical analysis

Version 2.4.0

Date 2015-1-12

Author Kylie A. Bemis <[email protected]>

Maintainer Kylie A. Bemis <[email protected]>

Description Implements statistical & computational tools for analyzingmass spectrometry imaging datasets, including methods for efficientpre-processing, spatial segmentation, and classification.

License Artistic-2.0

Depends BiocGenerics, BiocParallel, EBImage, graphics, methods,S4Vectors (>= 0.23.18), stats, ProtGenerics

Imports Biobase, dplyr, irlba, lattice, Matrix, matter, magrittr,mclust, nlme, parallel, signal, sp, stats4, utils, viridisLite

Suggests BiocStyle, testthat, knitr, rmarkdown

VignetteBuilder knitr

biocViews Software, Infrastructure, Proteomics, Lipidomics,MassSpectrometry, ImagingMassSpectrometry, ImmunoOncology,Normalization, Clustering, Classification, Regression

URL http://www.cardinalmsi.org

git_url https://git.bioconductor.org/packages/Cardinal

git_branch RELEASE_3_10

git_last_commit 5f5c0c9

git_last_commit_date 2019-10-29

Date/Publication 2020-03-19

R topics documented:Cardinal-package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3AnnotatedImage-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4AnnotatedImagingExperiment-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5batchProcess-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7colocalized-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

1

Page 2: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

2 R topics documented:

coregister-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9cvApply-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10defunct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12deprecated . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12dplyr-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13findNeighbors-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14Hashmat-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16IAnnotatedDataFrame-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19image-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21ImageData-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28ImageList-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30ImagingExperiment-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32ImagingResult-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33intensity.colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34iSet-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36MassDataFrame-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38meansTest-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39MIAPE-Imaging-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41MSContinuousImagingExperiment-class . . . . . . . . . . . . . . . . . . . . . . . . . . 44MSImageData-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44MSImageProcess-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47MSImageSet-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49MSImagingExperiment-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52MSImagingInfo-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54MSProcessedImagingExperiment-class . . . . . . . . . . . . . . . . . . . . . . . . . . 55mz-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56mzAlign-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57mzBin-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58mzFilter-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60normalize-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62PCA-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63peakAlign-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65peakBin-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67peakPick-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68pixelApply-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70plot-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74PLS-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80PositionDataFrame-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82process-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84readMSIData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86reduceBaseline-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87reduceDimension-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89reexports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91ResultSet-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91selectROI-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92SImageData-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93SImageSet-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96simulateSpectrum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99slice-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102smoothSignal-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103SparseImagingExperiment-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105spatialDGMM-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107

Page 3: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

Cardinal-package 3

spatialFastmap-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109spatialKMeans-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111spatialShrunkenCentroids-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113standardizeRuns-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115SummaryDataFrame-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116topFeatures-methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117writeMSIData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119XDataFrame-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120

Index 122

Cardinal-package Mass spectrometry imaging tools

Description

Implements statistical & computational tools for analyzing mass spectrometry imaging datasets,including methods for efficient pre-processing, spatial segmentation, and classification.

Details

Cardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim-plifying most of the basic programmatic tasks encountered during the statistical analysis of imagingdata. These include image manipulation and processing of both images and mass spectra, and dy-namic plotting of both.

While pre-processing steps including normalization, baseline correction, and peak-picking are pro-vided, the core functionality of the package is statistical analysis. The package includes classifi-cation and clustering methods based on nearest shrunken centroids, as well as traditional tools likePCA and PLS.

Type browseVignettes("Cardinal") to view a user’s guide and vignettes of common workflows.

Options

The following options can be set via options().

• options(Cardinal.verbose=interactive()): Should detailed messages be printed?

• options(Cardinal.progress=interactive()): Should a progress bar be shown?

• options(Cardinal.numblocks=20): The default number of data chunks used by pixelApply(),featureApply(), and spatialApply() when .blocks=TRUE. Used by many methods inter-nally.

• options(Cardinal.delay=TRUE): Should pre-processing functions like normalize() andpeakPeak() be delayed (until process() is called)?

• options(Cardinal.dark=FALSE): Should the default theme for new plots use dark mode?

Author(s)

Kylie A. Bemis

Maintainer: Kylie A. Bemis <[email protected]>

Page 4: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

4 AnnotatedImage-class

AnnotatedImage-class AnnotatedImage: Optical images with annotations

Description

AnnotatedImage extends the Image class from the EBImage package with metadata columns andplotting in arbitrary coordinate systems. This facilitates annotations such as region-of-interest la-beling, and plotting with axes reflective of real-world coordinates.

Usage

AnnotatedImage(data = array(0, dim=c(1,1)), dim, colormode, ...)

Arguments

data A vector or array with pixel intensities of an image.

dim The final dimensions of the image.

colormode Either ’Grayscale’ or ’Color’.

... Additional arguments passed to the constructor. May be used to set the offsetor resolution slots.

Details

AnnotatedImage is extends Image, so all methods defined on that class also work here.

Metadata columns with annotations can be set via mcols(). The object’s length is defined asthe product of the first two dimensions. It is assumed any additional frames represent differentmeasurement channels on the same spatial locations.

AnnotatedImage also facilitates integration with other imaging data such as a SparseImagingExperimentor MSImagingExperiment by allowing plotting of the image on arbitrary coordinate systems. Thisis controlled via an offset slot designating the absolute position of the top-left corner of the imagein the current plotting coordinates. The height and width of the image (as plotted) are then con-trolled by its resolution. This is most easily changed by setting the height() and width() of theobject.

Slots

.Data: An array with the image data.

offset: The absolute offset of the x/y position of the top-left corner of the image when plotted.

resolution: The absolute offset of the x/y position of the top-left corner of the image when plot-ted.

colormode: The color mode of the image. Either ’Grayscale’ or ’Color’.

elementMetadata: An optional DataFrame containing pixel-level annotations.

metadata: A list containing general metadata (such as filename, etc.).

Page 5: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

AnnotatedImagingExperiment-class 5

Methods

All methods for Image also work on AnnotatedImage objects. Additional methods are documentedbelow:

mcols(x), mcols(x) <- value: Get or set the metadata columns.

coord(object), coord(object) <- value: Get or set the absolute offset of the top-left corner ofthe image.

resolution(object), resolution(object) <- value: Get or set the pixel resolution of the im-age. This corresponds to the number of pixels per unit step on the x/y axes when plotted.

height(x), height(x) <- value: Get or set the height of the image (as plotted).

width(x), width(x) <- value: Get or set the width of the image (as plotted).

Author(s)

Kylie A. Bemis

See Also

Image

AnnotatedImagingExperiment-class

AnnotatedImagingExperiment: Mass spectrometry imaging experi-ments

Description

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

Usage

## AnnotatedImage listAnnotatedImageList(...)

## Instance creationAnnotatedImagingExperiment(

imageData = AnnotatedImageList(),featureData = DataFrame(),phenoData = DataFrame(),metadata = list())

## Additional methods documented below

Page 6: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

6 AnnotatedImagingExperiment-class

Arguments

... Either Image or AnnotatedImage objects used to create the AnnotatedImageList.

imageData An Image, an AnnotatedImage, or an AnnotatedImageList.

featureData A DataFrame with feature metadata, with a row for each channel/frame.

phenoData A DataFrame with phenotype metadata, with a row for each sample.

metadata A list with experimental-level metadata.

Details

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

Subclasses MSContinuousImagingExperiment and MSProcessedImagingExperiment exist to al-low downstream methods to make assumptions about the underlying data storage (dense matricesfor ’continous’ format and sparse matrices for ’processed’ format), which can sometimes allowmore efficient computations.

Slots

imageData: An object inheriting from AnnotatedImageList, storing one or more AnnotatedImageelements.

featureData: Contains feature information in a DataFrame. Each row includes the metadata as-sociated with frame/channel of the images.

elementMetadata: Contains phenotype information in a DataFrame. Each row includes the meta-data for a single observation (e.g., a sample).

metadata: A list containing experiment-level metadata.

Methods

All methods for ImagingExperiment also work on AnnotatedImagingExperiment objects. Ad-ditional methods are documented below:

coord(object): Get the absolute offsets of the top-left corner of the images.

resolution(object): Get the pixel resolutions of the images. This corresponds to the number ofpixels per unit step on the x/y axes when plotted.

height(x): Get the heights of the images (as plotted).

width(x): Get the widths of the images (as plotted).

Author(s)

Kylie A. Bemis

See Also

ImagingExperiment, AnnotatedImage

Page 7: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

batchProcess-methods 7

Examples

x <- readImage(system.file('images', 'nuclei.tif', package='EBImage'))

y <- AnnotatedImagingExperiment(x)

print(y)

batchProcess-methods Batch Pre-Processing on an Imaging Dataset

Description

Batch apply multiple pre-processing steps on an imaging dataset.

Usage

## S4 method for signature 'MSImageSet'batchProcess(object,

normalize = NULL,smoothSignal = NULL,reduceBaseline = NULL,reduceDimension = NULL,peakPick = NULL,peakAlign = NULL,...,layout,pixel = pixels(object),plot = FALSE)

Arguments

object An object of class MSImageSet.normalize Either ’TRUE’ or a list of arguments to be passed to the normalize method.

Use ’FALSE’ or ’NULL’ to skip this pre-processing step.smoothSignal Either ’TRUE’ or a list of arguments to be passed to the smoothSignal method.

Use ’FALSE’ or ’NULL’ to skip this pre-processing step.reduceBaseline Either ’TRUE’ or a list of arguments to be passed to the reduceBaseline

method. Use ’FALSE’ or ’NULL’ to skip this pre-processing step.reduceDimension

Either ’TRUE’ or a list of arguments to be passed to the reduceDimensionmethod. Use ’FALSE’ or ’NULL’ to skip this pre-processing step.

peakPick Either ’TRUE’ or a list of arguments to be passed to the peakPick method.Use ’FALSE’ or ’NULL’ to skip this pre-processing step.

peakAlign Either ’TRUE’ or a list of arguments to be passed to the peakAlign method.Use ’FALSE’ or ’NULL’ to skip this pre-processing step.

layout The layout of the plots, given by a length 2 numeric as c(ncol,nrow).pixel The pixels to process. If less than the extent of the dataset, this will result in a

subset of the data being processed.plot Plot the pre-processing step for each pixel while it is being processed?... Ignored.

Page 8: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

8 colocalized-methods

Details

One of the primary purposes of this method (besides streamlining pre-processing steps) is to allowsingle-step reduction of larger-than-memory on-disk datasets to a smaller peak picked form with-out fully loading the data into memory. Therefore, the behavior for peakPick differs somewhatfrom when the peakPick method is called on its own. Typically, the spectra are preserved untilpeakAlign is called. However, to save memory, only the peaks are returned by batchProcess.

Additionally, when performing batch pre-processing, the mean spectrum is also calculated and re-turned as part of the ’featureData’ of the result, to be used by subsequent calls to peakAlign.

Internally, pixelApply is used to apply the pre-processing steps, as with other pre-processing meth-ods.

Note that reduceDimension and peakPick cannot appear in the same batchProcess call together,and peakAlign cannot appear in a batchProcess call without peakPick.

The peakAlign step is performed separately from every other step.

Value

An object of class MSImageSet with the processed spectra.

Author(s)

Kylie A. Bemis

See Also

MSImageSet, normalize, smoothSignal, reduceBaseline, peakPick, pixelApply

colocalized-methods Colocalized features

Description

Find colocalized features in an imaging dataset.

Usage

## S4 method for signature 'MSImagingExperiment,missing'colocalized(object, mz, ...)

## S4 method for signature 'SparseImagingExperiment,ANY'colocalized(object, ref, n = 10,sort.by = c("correlation", "M1", "M2"),threshold = median,BPPARAM = bpparam(), ...)

## S4 method for signature 'SpatialDGMM,ANY'colocalized(object, ref, n = 10,sort.by = c("Mscore", "M1", "M2"),threshold = median,BPPARAM = bpparam(), ...)

Page 9: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

coregister-methods 9

Arguments

object An imaging experiment.mz An m/z value giving the image to use as a reference.ref Either a numeric vector or logical mask of a region-of-interest, or the feature to

use as a reference.n The number of top-ranked colocalized features to return.sort.by The colocalization measure used to rank colocalized features. Possible options

include Pearson’s correlation ("correlation"), match score ("Mscore"), and Man-ders’ colocalization coefficients ("M1" and "M2").

threshold A function that returns the cutoff to use for creating logical masks of numericreferences.

BPPARAM An optional instance of BiocParallelParam. See documentation for bplapply.... ignored.

Value

A data frame with the colocalized features.

Author(s)

Kylie A. Bemis

See Also

topFeatures

Examples

register(SerialParam())

set.seed(1)data <- simulateImage(preset=2, npeaks=10, representation="centroid")

# find features colocalized with first featurecolocalized(data, ref=1)

coregister-methods Coregister images

Description

Coregister images of an imaging dataset. Currently this is only used to coregister the class as-signments for clustering methods, but additional functionality may be added in the future for 3Dexperiments and registration of optical images.

Usage

## S4 method for signature 'SpatialShrunkenCentroids,missing'coregister(object, ref, ...)

## S4 method for signature 'SpatialKMeans,missing'coregister(object, ref, ...)

Page 10: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

10 cvApply-methods

Arguments

object An imaging dataset.

ref A reference for the coregistration.

... Ignored.

Value

A new imaging dataset of the same class with coregistered images.

Author(s)

Kylie A. Bemis

See Also

spatialShrunkenCentroids

cvApply-methods Apply cross-validation to imaging analyses

Description

Apply cross-validation with an existing or a user-specified modeling function over an imagingdatasets.

Usage

## S4 method for signature 'MSImagingExperiment'crossValidate(.x, .y, .fun,

.fold = run(.x),

.predict = predict,

.process = FALSE,

.processControl = list(),

.peaks = NULL,BPPARAM = bpparam(), ...)

## S4 method for signature 'SparseImagingExperiment'crossValidate(.x, .y, .fun, .fold = run(.x),

BPPARAM = bpparam(), ...)

## S4 method for signature 'SparseImagingExperiment'cvApply(.x, .y, .fun,

.fold = run(.x),

.predict = predict,

.fitted = fitted,

.simplify = FALSE,BPREDO = list(),BPPARAM = bpparam(), ...)

## S4 method for signature 'CrossValidated2'

Page 11: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

cvApply-methods 11

summary(object, ...)

## S4 method for signature 'SImageSet'cvApply(.x, .y, .fun, .fold = sample, ...)

Arguments

.x An imaging dataset.

.y The response variable for prediction.

.fun A function for training a model where the first two arguments are the dataset andthe response.

.fold A variable determining the cross-validation folds. When specifying customfolds, it is important to make sure that data points from the same experimen-tal run are not split among different folds. I.e., all data points from a run shouldbelong to the same CV fold.

.predict A function for predicting from a trained model. The first two arguments are themodel and a new dataset.

.fitted A function for extracting the predicted values from the result of a call to .predict.

.simplify If FALSE (the default), the output of .predict is returned. If TRUE, then.fitted is applied to the results to extract fitted values. Only the fitted values,observed values, and basic model information is returned.

.process Should pre-processing be applied before each training and test step? This in-cludes peak alignment and peak filtering. Peak binning is also performed if.peaks is given.

.processControl

A list of arguments to be passed to the pre-processing steps.

.peaks A peak-picked version of the full dataset .x, for use with pre-processing betweentraining and test steps.

BPREDO See documentation for bplapply.

BPPARAM An optional instance of BiocParallelParam. See documentation for bplapply.

... Additional arguments passed to .fun.

object A fitted model object to summarize.

Details

This method is designed to be used with the provided classification methods, but can also be usedwith user-provided functions and methods as long as they fulfill certain expectations.

The function or method passed to ’.fun’ must take at least two arguments: the first argument must bea object derived from SparseImagingExperiment or SImageSet, and the second argument must bethe response variable. The function should return an object of a class derived from ImagingResultor ResultSet, which should have a predict method that takes arguments ’newx’ and ’newy’ inaddition to the fitted model.

For MSImagingExperiment objects, pre-processing can be performed. This is particularly useful ifthere is no reference to which to align peaks, except the mean spectrum (which is calculated fromthe whole dataset, and may invalidate cross-validation results).

If .process=TRUE and .peaks=NULL, then either the data should be profile spectra with no peakpicking, or it should be a peak-picked dataset before peak alignment. If the data has no peakpicking, then the pre-processing will consist of peak picking on the mean spectrum of the training

Page 12: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

12 deprecated

sets, followed by peak alignment and peak filtering. If the data has been peak-picked but not aligned,then the pre-processing will consist of peak alignment to the mean spectrum of the training sets, andpeak filtering.

If .process=TRUE and .peaks is given, then the data should be a dataset consisting of profilespectra, and .peaks should be a peak-picked version of the same dataset before peak alignment.The pre-processing will consist of peak alignment to the mean spectrum of the training sets, peakfiltering, and peak binning the full data to the aligned peaks.

The crossValidate function calls cvApply internally and then post-processes the result to be moreeasily-interpretable and space-efficient. Accuracy metrics are reported for each set of modelingparameters.

Value

An object of class ’CrossValidated’, which is derived from ResultSet, or an object of class ’Cross-Validated2’, which is derived from ImagingResult.

Author(s)

Kylie A. Bemis

See Also

spatialShrunkenCentroids, PLS, OPLS

defunct Defunct functions and methods in Cardinal

Description

These functions are defunct and are no longer available.

Binmat: matter_mat

topLabels: topFeatures

deprecated Deprecated functions and methods in Cardinal

Description

These functions are provided for compatibility with older versions of Cardinal, and will be defunctat the next release.

generateSpectrum: simulateSpectrum

generateImage: simulateImage

Page 13: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

dplyr-methods 13

dplyr-methods Data transformation and summarization

Description

These methods provide analogs of data manipulation verbs from the dplyr package, with appro-priate semantics for imaging experiments. Due to the differences between imaging datasets andstandard data frames, they do not always work identically.

See the descriptions below for details.

Usage

## S3 method for class 'SparseImagingExperiment'filter(.data, ..., .preserve=FALSE)

## S3 method for class 'SparseImagingExperiment'select(.data, ...)

## S3 method for class 'SparseImagingExperiment'mutate(.data, ...)

## S3 method for class 'SparseImagingExperiment'summarise(.data, ...,

.by = c("feature", "pixel"), .groups = NULL,

.stat = "mean", .tform = identity,

.as = "ImagingExperiment",BPPARAM = bpparam())

Arguments

.data An imaging dataset.

... Conditions describing rows or columns to be retained, name-value pairs to beadded as metadata columns, or name-value pairs of summary functions. SeeDetails.

.preserve Ignored, provided for compatibility with dplyr.

.by Should the summarization be performed over pixels or features?

.groups A grouping variable for summarization. The summary functions will be appliedwithin each group.

.stat Allowable values are "min", "max", "mean", "sum", "sd", and "var".

.tform How should each feature-vector or image-vector be transformed before summa-rization?

.as What class of object should be returned (ImagingExperiment or DataFrame)?

BPPARAM An optional BiocParallelParam instance to be passed to bplapply().

Page 14: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

14 findNeighbors-methods

Details

filter() keeps only the rows (features) where the conditions are TRUE. Columns of featureData(.data)can be referred to literally in the logical expressions.

select() keeps only the columns (pixels) where the conditions are TRUE. Columns of pixelData(.data)can be referred to literally in the logical expressions.

mutate() adds new columns to the pixel metadata columns (pixelData(.data)).

summarize() calculates statistical summaries over either features or pixels using pixelApply() orfeatureApply(). Several statistical summaries can be chosen via the .stat argument, which willbe efficiently calculated according to the format of the data.

Value

An ImagingExperiment (or subclass) instance for filter(), select(), and mutate(). An XDataFrame(or subclass) instance for summarize().

Author(s)

Kylie A. Bemis

Examples

register(SerialParam())

set.seed(1)mse <- simulateImage(preset=1, npeaks=10, dim=c(10,10))

# filter features to mass range 1000 - 1500filter(mse, 1000 < mz, mz < 1500)

# select pixels to coordinates x = 1..3, y = 1..3select(mse, x <= 3, y <= 3)

# summarize mean spectrumsm1 <- summarize(mse, .stat="mean", .as="DataFrame")

# summarize image by TICsm2 <- summarize(mse, .stat=c(tic="sum"), .by="pixel", .as="DataFrame")

# add a TIC columnmutate(mse, tic=sm2$tic)

# summarize mean spectrum grouped by pixels in/out of circlesm3 <- summarize(mse, .stat="mean", .groups=mse$circle)

findNeighbors-methods Find spatial neighbors and spatial weightst

Description

Methods for calculating the spatial neighbors (pixels within a certain distance) or spatial weightsfor all pixels in a dataset.

Page 15: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

findNeighbors-methods 15

Usage

#### Methods for Cardinal >= 2.x classes ####

## S4 method for signature 'ImagingExperiment'findNeighbors(x, r, groups = run(x), ...)

## S4 method for signature 'PositionDataFrame'findNeighbors(x, r, groups = run(x), dist = "chebyshev",

offsets = FALSE, matrix = FALSE, ...)

## S4 method for signature 'ImagingExperiment'spatialWeights(x, r, method = c("gaussian", "adaptive"),

dist = "chebyshev", matrix = FALSE, BPPARAM = bpparam(), ...)

## S4 method for signature 'PositionDataFrame'spatialWeights(x, r, matrix = FALSE, ...)

#### Methods for Cardinal 1.x classes ####

## S4 method for signature 'iSet'findNeighbors(x, r, groups = x$sample, ...)

## S4 method for signature 'IAnnotatedDataFrame'findNeighbors(x, r, groups = x$sample, dist = "chebyshev",

offsets = FALSE, matrix = FALSE, ...)

## S4 method for signature 'iSet'spatialWeights(x, r, method = c("gaussian", "adaptive"),

matrix = FALSE, ...)

## S4 method for signature 'IAnnotatedDataFrame'spatialWeights(x, r, matrix = FALSE, ...)

Arguments

x An imaging dataset or data frame with spatial dimensions.

r The spatial radius or distance.

groups A factor giving which pixels should be treated as spatially-independent. Pixelsin the same group are assumed to have a spatial relationship.

dist The type of distance metric to use. The options are ‘radial’, ‘manhattan’, ‘minkowski’,and ‘chebyshev’ (the default).

offsets Should the coordinate offsets from the center of each neighborhood be returned?

matrix Should the result be returned as a sparse matrix instead of a list?

method The method to use to calculate the spatial weights. The ’gaussian’ method refersto Gaussian-distributed distance-based weights (alpha weights), and ’adaptive’refers to structurally-adaptive weights for bilaterla filtering (beta weights).

... Addtional arguments to be passed to next method.

BPPARAM An optional instance of BiocParallelParam. See documentation for bplapply.

Page 16: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

16 Hashmat-class

Value

Either a list of neighbors/weights or a sparse matrix (sparse_mat) giving the neighbors and weightsfor each pixel.For spatialWeights, two types of weights are calculated and returned as a list:The alpha weights are distance-based, following a Gaussian distributed that produces smallerweights for larger distances. The beta weights are adaptive weights used for bilateral filtering,which are based on the difference in the feature-vectors between pixels.If method="gaussian" only the alpha weights are calcualated and the beta weights are all set to1. If matrix=TRUE, the alpha and beta weights are multiplied together to produce the weights forthe matrix; otherwise, both are returned separately.

Author(s)

Kylie A. Bemis

See Also

image

Examples

coord <- expand.grid(x=1:9, y=1:9)values <- rnorm(nrow(coord))pdata <- PositionDataFrame(coord=coord, values=values)

# find spatial neighborsfindNeighbors(pdata, r=1)

# calculate distance-based weightsspatialWeights(pdata, r=1)

# visualize weight matrixW <- spatialWeights(pdata, r=1, matrix=TRUE)image(as.matrix(W), col=bw.colors(100))

Hashmat-class Hashmat: Sparse matrix class using lists as hash tables

Description

The Hashmat class implements compressed sparse column (CSC) style matrices using R list ob-jects as the columns. The implementation is unique in that it allows re-assignment of the keysdescribing the rows, allowing for arbitrary re-ordering of rows and row-wise elements. This isuseful for storing sparse signals, such as processed spectra.New code should use the sparse_mat class from the matter package instead.

Usage

## Instance creationHashmat(data = NA, nrow = 1, ncol = 1, byrow=FALSE,

dimnames = NULL, ...)

## Additional methods documented below

Page 17: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

Hashmat-class 17

Arguments

data A matrix or a vector. If data is a matrix, then a sparse matrix is construcedfrom matrix directly and other arguments (except for dimnames) are ignored. Ifdata is a vector, then the behavior is the same as for ordinary matrix construc-tion.

nrow The number of rows in the sparse matrix.

ncol The number of columns in the sparse matrix.

byrow If ’FALSE’, the matrix is filled by columns. If ’TRUE’, it is filled by rows.

dimnames The ’dimnames’ giving the dimension names for the matrix, analogous to the’dimnames’ attribute of an ordinary R matrix. This must be a list of length 2 orNULL.

... Additional arguments passed to the constructor.

Slots

data: A list with vectors corresponding columns of the sparse matrix, whose elements are itsnon-zero elements.

keys: A character vector providing the keys that determine the rows of the non-zero elements ofthe matrix.

dim: A length 2 integer vector analogous to the ’dim’ attribute of an ordinary R matrix.

dimnames: A length 2 list analogous to the ’dimnames’ attribute of an ordinary R matrix.

.__classVersion__: A Versions object describing the version of the class used to created theinstance. Intended for developer use.

Extends

Versioned

Creating Objects

Hashmat instances are usually created through Hashmat().

Methods

Class-specific methods:

pData(object), pData(object)<-: Access or set the list of numeric vectors storing the column-vectors of the sparse matrix directly.

keys(object), keys(object)<-: Access of set the keys for the row elements. If this is a character,it sets the keys slot directly, and hence the ’dim’ is also changed. If this is a list, then thelist should have length equal to the number of rows, and each element should be an integervector of length equal to the number of non-zero row elements for the respective column. Thevectors are used to index the keys slot and set the key names of the vectors, and hence changeor reorder the row elements.

Standard generic methods:

combine(x, y, ...): Combines two Hashmat objects. See the combine method for matrices fordetails of how the Hashmat sparse matrices are combined. The behavior is identical, exceptwhen filling in missing elements in non-shared rows and columns, the resulting Hashmatobject will have zeroes instead of NAs.

Page 18: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

18 Hashmat-class

dim(x), dim(x) <- value: Return or set the dimensions of the sparse matrix.

dimnames(x), dimnames(x) <- value: Return or set the ’dimnames’ of the sparse matrix.

colnames(x), colnames(x) <- value: Return or set the column names of the sparse matrix.

rownames(x), rownames(x) <- value: Return or set the row names of the sparse matrix.

ncol: Return the number of columns in the sparse matrix.

nrow: Return the number of columns in the sparse matrix.

cbind: Combine sparse matrices by columns. The keys used to resolve the rows must match be-tween matrices.

rbind: Not allowed for sparse matrices. (Always returns an error.)

Hashmat[i, j, ..., drop], Hashmat[i, j, ...] <- value: Access and assign elements in thesparse matrix. A Hashmat sparse matrix can be indexed like an ordinary R matrix. Notehowever that linear indexing is not supported. Use drop = NULL to return a subset of the sameclass as the object.

Author(s)

Kylie A. Bemis

See Also

matrix, Binmat, SImageSet

Examples

## Create an Hashmat objectHashmat()

## Using a list of elements and keysdmat1 <- diag(3)smat1 <- Hashmat(dmat1)all.equal(smat1[], dmat1, check.attr=FALSE)

## Filling an empty sparse matrixsmat2 <- Hashmat(nrow=1000, ncol=1000)smat2[500,] <- rep(1, 1000)

dmat2 <- matrix(nrow=1000, ncol=1000)dmat2[500,] <- rep(1, 1000)

print(object.size(dmat2), units="Mb")print(object.size(smat2), units="Mb") # Much smaller

all.equal(dmat2[500,], smat2[500,], , check.attr=FALSE)

Page 19: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

IAnnotatedDataFrame-class 19

IAnnotatedDataFrame-class

IAnnotatedDataFrame: Class containing measured variables andtheir metadata for imaging experiments

Description

An IAnnotatedDataFrame is an extension of an AnnotatedDataFrame as defined in the ’Biobase’package modified to reflect that individual rows in data represent pixels rather than samples, andmany pixels will come from a single sample. Additionally, it keeps track of the coordinates of thepixel represented by each row.

Usage

## Instance creationIAnnotatedDataFrame(data, varMetadata,dimLabels=c("pixelNames", "pixelColumns"),...)

## Additional methods documented below

Arguments

data A data.frame of the pixels (rows) and measured variables (columns). Omittingthis will yield an empty IAnnotatedDataFrame with zero rows.

varMetadata A data.frame with columns describing the measured variables in data. Gen-erated automatically if missing.

dimLabels Aesthetic labels for the rows and columns in the show method.

... Additional arguments passed to the initialize method.

Details

The key difference between a IAnnotatedDataFrame and a AnnotatedDataFrame is that an IAnnotatedDataFramemakes a distinction between samples and pixels, recognizing that rows belong to pixels, many ofwhich may belong to the same sample. Therefore, data contains a required column called ’sample’,which indicates the sample to which the pixel belongs, and varMetadata contains an additional re-quired column called ’labelType’, which indicates whether a variable is a spatial dimensions (’dim’)or a phenotype (’pheno’) or a sample (’sample’). The ’labelType’ of the ’sample’ variable dependson the structure of the experiment. See below for details.

The ’labelType’ for ’sample’ will be ’sample’ in the case of a 2D imaging experiment with a singlesample. The ’labelType’ for ’sample’ will be ’dim’ in the case of a 2D imaging experiment withmultiple samples, since the ’sample’ will be acting as a proxy spatial coordinate. Note however thatin this case, the result of a call to coordLabels will not include ’sample’.

It is possible to compare the results of names(coord(object)) and coordLabels(object) todistinguish between coordinate types that should be considered independent. It will be assumeda spatial relationship exists for all variables returned by coordLabels(object), but this is notnecessarily true for all variables returned by names(coord(object)). This is required, becauseevery row in the data.frame returned by coord(object) should be unique and correspond to aunique pixel.

Page 20: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

20 IAnnotatedDataFrame-class

The suggested structure for 3D imaging experiments is to create an additional variable solely torefer to the spatial dimension (e.g., ’z’) and treat it separately from the ’sample’. Therefore, in a 3Dimaging experiment with a single sample, the ’labelType’ for ’sample’ would be ’sample’.

Slots

data: Object of class data.frame containing pixels (rows) and measured variables (columns).Contains at least one column named ’sample’ which is a factor and gives the sample namesfor each pixel. The sample names can be set using sampleNames<-. Inherited from Anno-tatedDataFrame.

varMetadata: Object of class data.frame with number of rows equal to the number of columnsin data. Contains at least two columns, one named ’labelDescription’ giving a textual de-scription of each variable, and an additional one named ’labelType’ describing the type ofvariable. The ’labelType’ is a factor with levels "dim","sample","pheno". Inherited fromAnnotatedDataFrame

dimLabels: Object of class character of length 2 that provides labels for the rows and columnsin the show method. Inherited from AnnotatedDataFrame.

.__classVersion__: A Versions object describing the version of the class used to created theinstance. Intended for developer use.

Extends

Class AnnotatedDataFrame, directly. Class Versioned, by class "AnnotatedDataFrame", distance2.

Creating Objects

IAnnotatedDataFrame instances are usually created through IAnnotatedDataFrame().

Methods

Class-specific methods:

sampleNames(object), sampleNames(object)<-: Return or set the sample names in the object,as determined by the factor levels of the ’sample’ variable in data.

pixelNames(object), pixelNames(object)<-: Return or set the pixel names (the rows of data).

coordLabels(object), coordLabels(object)<-: Return or set the names of the pixel coodi-nates. These are the subset of varLabels(object) for which the corresponding variableshave a 'labelType' of 'dim'. Note that this will never include ’sample’, even if the ’sam-ple’ variable has type ’dim’. (See details.)

coord(object), coord(object)<-: Return or set the coodinates. This is a data.frame contain-ing the subset of columns of data for which the variables have a ’labelType’ of ’dim’.

Standard generic methods:

combine(x, y, ...): Combine two or more IAnnotatedDataFrame objects. The objects are com-bined similarly to ’rbind’ for data.frame objects. Pixels coordinates are checked for unique-ness. The ’varLabels’ and ’varMetadata’ must match.

Author(s)

Kylie A. Bemis

Page 21: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

image-methods 21

See Also

AnnotatedDataFrame, iSet, SImageSet MSImageSet

Examples

## Create an IAnnotatedDataFrame objectIAnnotatedDataFrame()

## Simple IAnnotatedDataFramedf1 <- IAnnotatedDataFrame(data=expand.grid(x=1:3, y=1:3),varMetadata=data.frame(labelType=c("dim", "dim")))pData(df1)varMetadata(df1)

# Example of possible experiment datacoord <- expand.grid(x=1:3, y=1:3)df2 <- IAnnotatedDataFrame(data=data.frame(rbind(coord, coord), sample=factor(rep(1:2, each=nrow(coord)))),varMetadata=data.frame(labelType=c("dim", "dim")))df2$diagnosis <- factor(rbinom(nrow(df2), 1, 0.5), labels=c("normal", "cancer"))varMetadata(df2)["diagnosis", "labelDescription"] <- "disease pathology"df2[["time", labelDescription="time measured"]] <- rep(date(), nrow(df2))pData(df2)varMetadata(df2)

# Change labels and pixel coordcoordLabels(df2) <- c("x1", "x2")pixelNames(df2) <- paste("p", 1:nrow(df2), sep="")sampleNames(df2) <- c("subject A", "subject B")coord(df2) <- coord(df2)[nrow(df2):1,]pData(df2)

image-methods Plot an image of the pixel data of an imaging dataset

Description

Create and display images for the pixel data of an imaging dataset using a formula interface.

Usage

## S4 method for signature 'formula'image(x, data = environment(x), ...,

xlab, ylab, zlab, subset)

#### Methods for Cardinal >= 2.x classes ####

## S4 method for signature 'PositionDataFrame'image(x, formula,

groups = NULL,superpose = FALSE,strip = TRUE,key = superpose || !is.null(groups),

Page 22: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

22 image-methods

normalize.image = c("none", "linear"),contrast.enhance = c("none", "suppression", "histogram"),smooth.image = c("none", "gaussian", "adaptive"),...,xlab, xlim,ylab, ylim,zlab, zlim,asp = 1,layout,col = discrete.colors,colorscale = viridis,colorkey = !key,alpha.power = 1,subset = TRUE,add = FALSE)

## S4 method for signature 'SparseImagingExperiment'image(x, formula,

feature,feature.groups,groups = NULL,superpose = FALSE,strip = TRUE,key = superpose || !is.null(groups),fun = mean,normalize.image = c("none", "linear"),contrast.enhance = c("none", "suppression", "histogram"),smooth.image = c("none", "gaussian", "adaptive"),...,xlab, xlim,ylab, ylim,zlab, zlim,asp = 1,layout,col = discrete.colors,colorscale = viridis,colorkey = !key,alpha.power = 1,subset = TRUE,add = FALSE)

## S4 method for signature 'SparseImagingExperiment'image3D(x, formula, ..., alpha.power = 2)

## S4 method for signature 'MSImagingExperiment'image(x, formula,

feature = features(x, mz=mz),feature.groups,mz,plusminus,...)

Page 23: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

image-methods 23

## S4 method for signature 'SparseImagingResult'image(x, formula,

model = modelData(x),superpose = is_matrix,...,column,colorscale = cividis,colorkey = !superpose,alpha.power = 2)

## S4 method for signature 'PCA2'image(x, formula,

values = "scores", ...)

## S4 method for signature 'PLS2'image(x, formula,

values = c("fitted", "scores"), ...)

## S4 method for signature 'SpatialFastmap2'image(x, formula,

values = "scores", ...)

## S4 method for signature 'SpatialKMeans2'image(x, formula,

values = "cluster", ...)

## S4 method for signature 'SpatialShrunkenCentroids2'image(x, formula,

values = c("probability", "class", "scores"), ...)

## S4 method for signature 'SpatialDGMM'image(x, formula,

values = c("probability", "class", "mean"), ...)

## S4 method for signature 'MeansTest'image(x, formula,

values = "mean", jitter = TRUE, ...)

## S4 method for signature 'SegmentationTest'image(x, formula,

values = c("mean", "mapping"), jitter = TRUE, ...)

## S4 method for signature 'AnnotatedImage'image(x, frame = 1, offset = coord(x),

height, width,layout = !add,native = TRUE,interpolate = TRUE,add = FALSE, ...)

## S4 method for signature 'AnnotatedImageList'image(x, i, frame = 1,

Page 24: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

24 image-methods

strip = TRUE,layout = !add,native = TRUE,interpolate = TRUE,add = FALSE, ...)

## S4 method for signature 'AnnotatedImagingExperiment'image(x, i, frame = 1, ...)

#### Methods for Cardinal 1.x classes ####

## S4 method for signature 'SImageSet'image(x, formula = ~ x * y,

feature,feature.groups,groups = NULL,superpose = FALSE,strip = TRUE,key = superpose,fun = mean,normalize.image = c("none", "linear"),contrast.enhance = c("none", "suppression", "histogram"),smooth.image = c("none", "gaussian", "adaptive"),...,xlab, xlim,ylab, ylim,zlab, zlim,layout,asp = 1,col = rainbow(nlevels(groups)),col.regions = intensity.colors(100),colorkey = !is3d,subset = TRUE,lattice = FALSE)

## S4 method for signature 'SImageSet'image3D(x, formula = ~ x * y * z, ...)

## S4 method for signature 'MSImageSet'image(x, formula = ~ x * y,

feature = features(x, mz=mz),feature.groups,mz,plusminus,...)

## S4 method for signature 'ResultSet'image(x, formula,

model = pData(modelData(x)),feature,feature.groups,superpose = TRUE,

Page 25: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

image-methods 25

strip = TRUE,key = superpose,...,column,col = if (superpose) rainbow(nlevels(feature.groups)) else "black",lattice = FALSE)

## S4 method for signature 'CrossValidated'image(x, fold = 1:length(x), layout, ...)

## S4 method for signature 'PCA'image(x, formula = substitute(mode ~ x * y),

mode = "scores",...)

## S4 method for signature 'PLS'image(x, formula = substitute(mode ~ x * y),

mode = c("fitted", "scores", "y"),...)

## S4 method for signature 'OPLS'image(x, formula = substitute(mode ~ x * y),

mode = c("fitted", "scores", "Oscores", "y"),...)

## S4 method for signature 'SpatialFastmap'image(x, formula = substitute(mode ~ x * y),

mode = "scores",...)

## S4 method for signature 'SpatialShrunkenCentroids'image(x, formula = substitute(mode ~ x * y),

mode = c("probabilities", "classes", "scores"),...)

## S4 method for signature 'SpatialKMeans'image(x, formula = substitute(mode ~ x * y),

mode = "cluster",...)

Arguments

x An imaging dataset.

formula A formula of the form ’z ~ x * y | g1 * g2 * ...’ (or equivalently, ’z ~ x + y | g1 +g2 + ...’), indicating a LHS ’y’ (on the y-axis) versus a RHS ’x’ (on the x-axis)and conditioning variables ’g1, g2, ...’.Usually, the LHS is not supplied, and the formula is of the form ’~ x * y |g1 * g2 * ...’, and the y-axis is implicityl assumed to be the feature vectorscorresponding to each pixel in the imaging dataset specified by the object ’x’.However, a variable evaluating to a vector of pixel values, or a sequence of suchvariables, can also be supplied.The RHS is evaluated in pData(x) and should provide values for the xy-axes.

Page 26: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

26 image-methods

These must be spatial coordinates.The conditioning variables are evaluated in fData(x). These can be specified inthe formula as ’g1 * g2 * ...’. The argument ’feature.groups’ allows an alternateway to specify a single conditioning variable. Conditioning variables specifiedusing the formula interface will always appear on separate plots. This can becombined with ’superpose = TRUE’ to both overlay plots based on a condition-ing variable and use conditioning variables to create separate plots.

data A list or data.frame-like object from which variables in formula should betaken.

mz The m/z value(s) for which to plot the ion image(s).

plusminus If specified, a window of m/z values surrounding the one given by coord willbe included in the plot with fun applied over them, and this indicates the rangeof the window on either side.

feature The feature or vector of features for which to plot the image. This is an expres-sion that evaluates to a logical or integer indexing vector.

feature.groups An alternative way to express a single conditioning variable. This is a variableor expression to be evaluated in fData(x), expected to act as a grouping vari-able for the features specified by ’feature’, typically used to distinguish differentgroups or ranges of features. Pixel vectors of images from features in the samefeature group will have ’fun’ applied over them; ’fun’ will be applied to eachfeature group separately, usually for averaging. If ’superpose = FALSE’ thenthese appear on separate plots.

groups A variable or expression to be evaluated in pData(x), expected to act as a group-ing variable for the pixel regions in the image(s) to be plotted, typically used todistinguish different image regions by varying graphical parameters like colorand line type. By default, if ’superpose = FALSE’, these appear overlaid on thesame plot.

superpose Should feature vectors from different feature groups specified by ’feature.groups’be superposed on the same plot? If ’TRUE’ then the ’groups’ argument is ig-nored.

strip Should strip labels indicating the plotting group be plotting along with the eachpanel? Passed to ’strip’ in levelplot is ’lattice = TRUE’.

key A logical, or list containing components to be used as a key for the plot. Thisis passed to ’key’ in levelplot if ’lattice = TRUE’.

fun A function to apply over pixel vectors of images grouped together by ’fea-ture.groups’. By default, this is used for averaging over features.

normalize.image

Normalization function to be applied to each image. The function can be user-supplied, of one of ’none’ or ’linear’. The ’linear’ normalization method nor-malized each image to the same intensity range using a linear transformation.

contrast.enhance

Contrast enhancement function to be applied to each image. The function can beuser-supplied, or one of ’none’, ’histogram’, or ’suppression’. The ’histogram’equalization method flatterns the distribution of intensities. The hotspot ’sup-pression’ method uses thresholding to reduce the intensities of hotspots.

smooth.image Image smoothing function to be applied to each image. The function can be user-supplied, or one of ’none’, ’gaussian’, or ’adaptive’. The ’gaussian’ smoothingmethod smooths images with a simple gaussian kernel. The ’adaptive’ methoduses bilateral filtering to preserve edges.

Page 27: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

image-methods 27

xlab Character or expression giving the label for the x-axis.ylab Character or expression giving the label for the y-axis.zlab Character or expression giving the label for the z-axis. (Only used for plotting

3D images.)xlim A numeric vector of length 2 giving the left and right limits for the x-axis.ylim A numeric vector of length 2 giving the top and bottom limits for the y-axis.zlim A numeric vector of length 2 giving the lower and upper limits for the z-axis

(i.e., the range of colors to be plotted).layout The layout of the plots, given by a length 2 numeric as c(ncol,nrow). This is

passed to levelplot if ’lattice = TRUE’. For base graphics, this defaults to oneplot per page.

asp The aspect ratio of the plot.col A specification for the default plotting color(s) for groups.colorscale The color scale to use for the z-axis of image intensities. This may be either

a vector of colors or a function which takes a single numeric argument n andgenerates a vector of colors of length n.

col.regions The default plotting color(s) for the z-axis of image intensities. Thus must be avector of colors.

colorkey Should a coloykey describing the z-axis be drawn with the plot?alpha.power Opacity scaling factor (1 is linear).jitter Should a small amount of noise be added to the image values before plotting

them?subset An expression that evaluates to a logical or integer indexing vector to be evalu-

ated in pData(x).... Additional arguments passed to the underlying plot functions.i Which data element should be plotted.frame Which frame of an image should be plotted.offset Absolute offset in x/y coordinates of the top-left corner of the image (from the

origin).height The height of the plotted image.width The width of the plotted image.native Should a native raster (using integer color codes) be produced, or an rgb raster

(using character color codes)?interpolate Should any linear interpolation be done when plotting the image?fold What folds of the cross-validation should be plotted.model A vector or list specifying which fitted model to plot. If this is a vector, it

should give a subset of the rows of modelData(x) to use for plotting. Otherwise,it should be a list giving the values of parameters in modelData(x).

mode What kind of results should be plotted. This is the name of the object to plot inthe ResultSet object.

values What kind of results should be plotted. This is the name of the object to plot inthe ImagingResult object. Renamed from mode to avoid ambiguity.

column What columns of the results should be plotted. If the results are a matrix, thiscorresponds to the columns to be plotted, which can be indicated either by nu-meric index or by name.

lattice Should lattice graphics be used to create the plot?add Should the method call plot.new() or be added to the current plot?

Page 28: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

28 ImageData-class

Note

In most cases, calling image3D(obj) is equivalent to image(obj,~ x * y * z).

Author(s)

Kylie A. Bemis

See Also

plot, selectROI

Examples

register(SerialParam())

set.seed(1)x <- simulateImage(preset=2, npeaks=10, dim=c(10,10))m <- mz(metadata(x)$design$featureData)

image(x, mz=m[1], plusminus=0.5)image(x, mz=m[1], smooth.image="gaussian", contrast.enhance="histogram")image(x, mz=m[1], colorscale=col.map("grayscale"))image(x, mz=m[4:7], colorscale=col.map("cividis"))image(x, mz=m[c(1,8)], normalize.image="linear", superpose=TRUE)

sm <- summarize(x, .by="pixel", .stat=c(tic="sum"), .as="DataFrame")pData(x)$tic <- sm$tic

image(x, tic ~ x * y, colorscale=magma)

ImageData-class ImageData: Class containing arrays of imaging data

Description

A container class for holding imaging data, designed to contain one or more arrays in an immutableenvironment. It is assumed that the first dimension of each array corresponds to the features.

Note that only visible objects (names not beginning with ’.’) are checked for validity; however, allobjects are copied if any elements in the data slot are modified when data is an "immutableEnvi-ronment".

Usage

## Instance creationImageData(...,

data = new.env(parent=emptyenv()),storageMode = c("immutableEnvironment",

"lockedEnvironment", "environment"))

## Additional methods documented below

Page 29: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

ImageData-class 29

Arguments

... Named arguments that are passed to the initialize method for instantiatingthe object. These must be arrays or array-like objects with an equal number ofdimensions. They will be assigned into the environment in the data slot.

data An environment in which to assign the previously named variables.

storageMode The storage mode to use for the ImageData object for the environment in thedata slot. This must be one of "immutableEnvironment", "lockedEnvironment",or "environment". See documentation on the storageMode slot below for moredetails.

Slots

data: An environment which may contain one or more arrays with an equal number of dimen-sions. It is assumed that the first dimension corresponds to the features.

storageMode: A character which is one of "immutableEnvironment", "lockedEnvironment",or "environment". The values "lockedEnvironment" and "environment" behave as de-scribed in the documentation of AssayData. An "immutableEnvironment" uses a lockedenvironment while retaining R’s typical copy-on-write behavior. Whenever an object in animmutable environment is modified, a new environment is created for the data slot, and allobjects copied into it. This allows usual R functional semantics while avoiding copying oflarge objects when other slots are modified.

.__classVersion__: A Versions object describing the version of the class used to created theinstance. Intended for developer use.

Extends

Versioned

Creating Objects

ImageData instances are usually created through ImageData().

Methods

Class-specific methods:

storageMode(object), storageMode(object)<-: Return or set the storage mode. See documen-tation on the storageMode slot above for more details.

Standard generic methods:

initialize: Initialize an ImageData object. Called by new. Not to be used by the user.

validObject: Validity-check that the arrays in the data slot environment are all of equal numberof dimensions, and the storage mode is a valid value.

combine(x, y, ...): Combine two or more ImageData objects. All elements must have matchingnames, and are combined with calls to combine. Higher dimensional arrays are combinedusing the same rules as for matrices. (See combine for more details.)

annotatedDataFrameFrom(object): Returns an IAnnotatedDataFrame with columns for thedimensions of the elements of data. All dimensions must be named (determined by therownames(dims(object))). It is assumed that the first dimension corresponds to the features,and is not used as a dimension in the returned IAnnotatedDataFrame. Additional arguments(byrow, . . . ) are ignored.

Page 30: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

30 ImageList-class

dims: A matrix with each column corresponding to the dimensions of an element in the data slot.

names(x), names(x)<-: Access or replace the array names of the elements contained in the dataslot environment.

ImageData[[name]], ImageData[[name]] <- value: Access or replace an element named "name"in the environment in the data slot.

Author(s)

Kylie A. Bemis

See Also

AssayData, SImageData, SImageSet, MSImageSet

Examples

## Create an ImageData objectImageData()

idata <- ImageData(data0=matrix(1:4, nrow=2))idata[["data0"]]

# Immutable environments in ImageData objectsstorageMode(idata) <- "lockedEnvironment"try(idata[["data0"]][,1] <- c(10,11)) # Fails

storageMode(idata) <- "immutableEnvironment"try(idata[["data0"]][,1] <- c(10,11)) # Succeeds

# Test copy-on-write for immutable environmentsidata2 <- idataidata2[["data0"]] <- matrix(5:8, nrow=2)idata[["data0"]] == idata2[["data0"]] # False

ImageList-class ImageList: Abstract image data list

Description

The ImageList virtual class provides an formal abstraction for the imageData slot of ImagingExperimentobjects. It is analogous to the Assays classes from the SummarizedExperiment package.

The ImageArrayList virtual class specializes the ImageList abstraction by assuming the array-like data elements all have conformable dimensions.

The SimpleImageList and SimpleImageArrayList subclasses are the default implementations.

The MSContinuousImagingSpectraList and MSProcessedImagingSpectraList classes are sub-classes of SimpleImageArrayList that make certain assumptions about how the underlying dataelements are stored (i.e., either dense or sparse). They are intended to be used with mass spectrom-etry imaging data.

Page 31: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

ImageList-class 31

Usage

# Create a SimpleImageListImageList(data)

# Create a SimpleImageArrayListImageArrayList(data)

# ImageArrayList class for 'continuous' (dense) MS imaging dataMSContinuousImagingSpectraList(data)

# ImageArrayList class for 'processed' (sparse) MS imaging dataMSProcessedImagingSpectraList(data)

Arguments

data A SimpleList or list of array-like data elements, or an array-like object.

Details

ImageList and ImageArrayList objects have list-like semantics where the elements are array-like (i.e., have dim), where ImageArrayList makes the additional assumption that the array-likeelements have identical dims for at least the first two dimensions.

The ImageList class includes:

• (1) The ImageList() and ImageArrayList() constructor functions.

• (2) Lossless back-and-forth coercion from/to SimpleList. The coercion method need not andshould not check the validity of the returned object.

• (3) length, names, names<-, and `[[`, `[[<-` methods for ImageList, as well as `[`,`[<-`, rbind, and cbind methods for ImageArrayList.

See the documentation for the Assays class in the SummarizedExperiment package for additionaldetails, as the implementation is quite similar, with the main difference being that all assumptionsabout the dimensions of the array-like data elements is contained in the ImageArrayList subclass.This is intended to allow subclasses of the ImageList class to handle images stored as arrays withnon-conformable dimensions.

These classes are intended to eventually replace the ImageData classes.

Author(s)

Kylie A. Bemis

See Also

SimpleList

Examples

## create an ImageList objectdata0 <- matrix(1:9, nrow=3)data1 <- matrix(10:18, nrow=3)data2 <- matrix(19:27, nrow=3)idata <- ImageArrayList(list(d0=data0, d1=data1, d2=data2))

Page 32: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

32 ImagingExperiment-class

# subset all arrays at onceidataS <- idata[1:2,1:2]all.equal(idataS[["d0"]], data0[1:2,1:2])

# combine over "column" dimensionidataB <- cbind(idata, idata)all.equal(idataB[["d0"]], cbind(data0, data0))

ImagingExperiment-class

ImagingExperiment: Abstract class for imaging experiments

Description

The ImagingExperiment class is a virtual class for biological imaging experiments. It includesslots for sample/pixel metadata and for feature metadata. The class makes very few assumptionsabout the structure of the underlying imaging data, including the dimensions.

For a concrete subclass, see the SparseImagingExperiment class, which assumes that the imagedata can be represented as a matrix where columns represent pixels and rows represent features. TheMSImagingExperiment subclass is further specialized for analysis of mass spectrometry imagingexperiments.

Slots

imageData: An object inheriting from ImageList, storing one or more array-like data elements.No assumption is made about the shape of the arrays.

featureData: Contains feature information in a DataFrame. Each row includes the metadata fora single feature (e.g., a color channel, a molecular analyte, or a mass-to-charge ratio).

elementMetadata: Contains sample or pixel information in a DataFrame. Each row includes themetadata for a single observation (e.g., a sample or a pixel).

metadata: A list containing experiment-level metadata.

Methods

imageData(object), imageData(object) <- value: Get and set the imageData slot.

iData(object, i), iData(object, i, ...) <- value: Get or set the element i from the imageData.If i is missing, the first data element is returned.

phenoData(object), phenoData(object) <- value: Get and set the elementMetadata slot.

sampleNames(object), sampleNames(object) <- value: Get and set the row names of the elementMetadataslot.

pData(object), pData(object) <- value: A shortcut for phenoData(object) and phenoData(object)<-.

pixelData(object), pixelData(object) <- value: In subclasses where columns represent pix-els, get and set the elementMetadata slot.

pixelNames(object), pixelNames(object) <- value: In subclasses where columns representpixels, get and set the row names of the elementMetadata slot.

featureData(object), featureData(object) <- value: Get and set the featureData slot.

featureNames(object), featureNames(object) <- value: Get and set the row names of thefeatureData slot.

Page 33: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

ImagingResult-class 33

fData(object), fData(object) <- value: A shortcut for featureData(object) and featureData(object)<-.

dim: The dimensions of the object, as determined by the number of features (rows in featureData)and the number of samples/pixels (rows in elementMetadata).

object$name, object$name <- value: Get and set the name column in pixelData.

object[[i]], object[[i]] <- value: Get and set the column i (a string or integer) in pixelData.

object[i, j, ..., drop]: Subset based on the rows (fData) and the columns (pData). The resultis the same class as the original object.

rbind(...), cbind(...): Combine ImagingExperiment objects by row or column.

Author(s)

Kylie A. Bemis

See Also

SparseImagingExperiment, MSImagingExperiment

Examples

## cannot create an ImagingExperiment objecttry(new("ImagingExperiment"))

## create an ImagingExperiment derived classMyImagingExperiment <- setClass("MyImagingExperiment", contains="ImagingExperiment")MyImagingExperiment()

removeClass("MyImagingExperiment")

ImagingResult-class ImagingResult: Results of statistical analysis of imaging experiments

Description

The ImagingResult class is a virtual class for containing the results of statistical analyses applied toimaging experiments. It includes the pixel and feature metadata of the original imaging experiment,but the image data may be missing. The results are stored as a list, where each element contains theresults of a single model or parameter set. Results from multiple models or parameter sets may bestored together.

The SparseImagingResult subclass inherits from both SparseImagingExperiment and ImagingResult.

Slots

imageData: An object inheriting from ImageArrayList, storing one or more array-like data ele-ments with conformable dimensions. This may be empty.

featureData: Contains feature information in a XDataFrame. Each row includes the metadata fora single feature (e.g., a color channel, a molecular analyte, or a mass-to-charge ratio).

elementMetadata: Contains pixel information in a PositionDataFrame. Each row includes themetadata for a single observation (e.g., a pixel), including specialized slot-columns for track-ing pixel coordinates and experimental runs.

Page 34: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

34 intensity.colors

resultData: A List containing the results of statistical analysis. Each element contains the resultsof a single model or parameter set.

modelData: A DataFrame providing details about the models or parameters used in the analysis.Must have the same number of rows as the length of resultData.

metadata: A list containing experiment-level metadata.

Methods

All methods for ImagingExperiment also work on ImagingResult objects. Additional methodsare documented below:

modelData(object), modelData(object) <- value: Get or set the modelData.

resultData(object, i, j), resultData(object, i) <- value: Get or set the corresponding el-ement of resultData.

resultNames(object): Get the names of the components of resultData.

Author(s)

Kylie A. Bemis

See Also

ImagingExperiment, SparseImagingExperiment

intensity.colors Color palettes for imaging

Description

Create a vector of n continuous or discrete colors.

Usage

color.map(map = c("redblack", "greenblack", "blueblack","viridis", "cividis", "magma", "inferno", "plasma","rainbow", "darkrainbow", "grayscale","jet", "hot", "cool"), n = 100)

col.map(...)

intensity.colors(n = 100, alpha = 1)

jet.colors(n = 100, alpha = 1)

divergent.colors(n = 100, start = "#00AAEE",middle = "#FFFFFF", end = "#EE2200", alpha = 1)

risk.colors(n = 100, alpha = 1)

gradient.colors(n = 100, start = "#000000",end = "#00AAFF", alpha = 1)

Page 35: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

intensity.colors 35

bw.colors(n = 100, alpha = 1)

discrete.colors(n = 2, chroma = 150, luminance = 65, alpha = 1)

alpha.colors(col, n = 100,alpha = (seq_len(n)/n)^alpha.power,alpha.power = 2)

darkmode()

lightmode()

Arguments

map the name of the colormap

n the number of colors

... arguments passed to color.map()

alpha a vector of alpha values between 0 and 1

start the start color value

middle the middle color value

end the end color value

chroma the chroma of the color

luminance the luminance of the color

col the color(s) to expand with transparency

alpha.power how the alpha should ramp as it increases

Details

Most of these functions return a vector of colors.

Several of the options made available by color.map are borrowed from the viridisLite package,including ’viridis’, ’cividis’, ’magma’, ’inferno’, and ’plasma’. The original functions for thesecolor palettes are also re-exported for use by users. See the documention for them in that package.

The darkmode and lightmode functions change the graphical parameters for the current graphicsdevice accordingly. The new themes will be used for any subsequent plots.

Value

A palette of colors.

Author(s)

Kylie A. Bemis

See Also

viridis, cividis, magma, inferno, plasma

Page 36: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

36 iSet-class

Examples

col <- gradient.colors(100^2)if ( interactive() )image(matrix(1:(100^2), nrow=100), col=col)

iSet-class iSet: Class to contain high-throughput imaging experiment data andmetadata

Description

A container class for data from high-throughput imaging experiments and associated metadata.Classes derived from from iSet contain one or more arrays or array-like objects with an equalnumber of dimensions as imageData elements. It is assumed that the first dimension of each suchelement corresponds to the data features, and all other dimensions are described by associated coor-dinates in the pixelData slot. Otherwise, derived classes are responsible for managing how the el-ements of imageData behave and their relationship with the rows of pixelData and featureData.

The MSImageSet class for mass spectrometry imaging experiments is the primary derived class ofiSet. Its parent class SImageSet is another derived class for more general images.

This class is based on the eSet virtual class from Biobase. However, the iSet class contains animageData slot which is an ’immutableEnvironment’ that preserves copy-on-write behavior foriSet derived classes, but only copying elements of imageData when that slot specifically is modi-fied. In addition pixelData is an IAnnotatedDataFrame that stores pixel information such as pixelcoordinates in addition to phenotypic data.

Slots

imageData: An instance of ImageData, which stores one or more array or array-like objects ofequal number of dimensions as elements in an ’immutableEnvironment’. This slot preservescopy-on-write behavior when it is modified specifically, but is pass-by-reference otherwise,for memory efficiency.

pixelData: Contains pixel information in an IAnnotatedDataFrame. This includes both pixelcoordinates and phenotypic and sample data. Its rows correspond to individual pixels, manyof which may belong to the same sample. Apart a requirement on columns describing the pixelcoordinates, it is left to derived classes to decide the relationship to elements of imageData.

featureData: Contains variables describing features. It Is left to derived classes to decide therelationship to elements of imageData.

experimentData: Contains details of experimental methods. Should be an object of a derived classof MIAxE.

protocolData: Contains variables describing the generation of the samples in pixelData.

.__classVersion__: A Versions object describing the version of the class used to created theinstance. Intended for developer use.

Extends

VersionedBiobase, directly. Versioned, by class "VersionedBiobase", distance 2.

Creating Objects

iSet is a virtual class. No instances can be created.

Page 37: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

iSet-class 37

Methods

Class-specific methods:

sampleNames(object), sampleNames(object) <- value: Access and set the sample names inthe pixelData and protocolData slots.

featureNames(object), featureNames(object) <- value: Access and set the feature names inthe featureData slot.

pixelNames(object), pixelNames(object) <- value: Access and set the pixel names in thepixelData slot.

coordLabels(object), coordLabels(object) <- value: Access and set the coordinate namesdescribed by the coordinate variables in the pixelData slot. Note that this does not set orget coordinate names with a labelType of sample, regardless of whether they are currentlybeing used to describe coordinates or not. Therefore, checking coordLabels(object) versusnames(coord(object)) is a simple way of checking whether a dataset is 2D or 3D.

coord(object), coord(object)<-: Return or set the coodinates. This is a data.frame contain-ing the subset of columns of data for which the variables have a ’labelType’ of ’dim’.

imageData(object), imageData(object) <- value: Access and set the imageData slot.

pixelData(object), pixelData(object) <- value: Access and set the pixelData slot.

pData(object), pData(object) <- value: Access and set the pixel information.

varMetadata(object), varMetadata(object) <- value: Access and set the metadata describ-ing the variables in pData.

varLabels(object), varLabels(object) <- value: Access and set the variable labels in pixelData.

featureData(object), featureData(object) <- value: Access and set the featureData slot.

fData(object), fData(object) <- value: Access and set the feature information.

fvarMetadata(object), fvarMetadata(object) <- value: Access and set the metadata describ-ing the features in fData.

fvarLabels(object), fvarLabels(object) <- value: Access and set the feature labels in featureData.

features(object, ...): Access the feature indices (rows in featureData) corresponding tovariables in featureData.

pixels(object, ...): Access the pixel indices (rows in pixelData) corresponding to variablesin pixelData.

experimentData(object), experimentData(object) <-: Access and set the experimentDataslot.

protocolData(object), protocolData(object) <-: Access and set the protocolData slot.

storageMode(object), storageMode(object)<-: Return or set the storage mode of the imageDataslot. See documentation on the storageMode slot above for more details.

Standard generic methods:

initialize: Initialize a object of an iSet derived class. Called by new. Not to be used by theuser.

validObject: Checks that there exist columns in pixelData describing the pixel coordinates,cooresponding to the dimensions of the elements of imageData. For every named dimensionof the arrays on imageData there must be a pData column describing its pixel coordinates.Also checks that the sampleNames match between pixelData and protocolData.

combine(x, y, ...): Combine two or more iSet objects. To be combined, iSets must have iden-tical featureData and distinct pixelNames and sampleNames. All elements of imageDatamust have matching names. Elements of imageData are combined by calls for combine.

Page 38: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

38 MassDataFrame-class

dim: The dimensions of the object, as determined by the number of features (rows in featureData)and the number of pixels (rows in pixelData). This may differ from the dimensions returned bydims(object) (which corresponds to the arrays in data) or returned by dim(imageData(object)).See SImageSet for an example where this is the case, due to its use of a "virtual" datacube.

dims: A matrix with each column corresponding to the dimensions of an element in the data slot.

iSet$name, iSet$name <- value: Access and set the name column in pixelData.

iSet[[i, ...]], iSet[[i, ...]] <- value: Access and set the column i (character or numericindex) in pixelData. The . . . argument can include named variables (especially ’labelDescrip-tion’) to be added to the varMetadata.

Author(s)

Kylie A. Bemis

See Also

eSet, SImageSet, MSImageSet

Examples

## Cannot create an iSet objecttry(new("iSet"))

## Create an iSet derived classMyImageSet <- setClass("MyImageSet", contains="iSet")MyImageSet()

removeClass("MyImageSet")

MassDataFrame-class MassDataFrame: data frame with mass-to-charge ratio metadata

Description

An MassDataFrame is an extension of the XDataFrame class with a special slot-column for observedmass-to-charge ratios.

Usage

MassDataFrame(mz, ..., row.names = NULL, check.names = TRUE)

Arguments

mz A numeric vector of mass-to-charge ratios.

... Named arguments that will become columns of the object.

row.names Row names to be assigned to the object; no row names are assigned if this isNULL.

check.names Should the column names be checked for syntactic validity?

Page 39: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

meansTest-methods 39

Details

MassDataFrame is designed for mass spectrometry data. It includes a slot-column for the mass-to-charge ratio. It is intended to annotate either a single mass spectrum or an experiment whereeach mass spectrum share the same mass-to-charge ratios. The m/z values can be get and set by themz(object) accessor, and are assumed to be unique and sorted in increasing order.

Methods

mz(object), mz(object) <- value: Get or set the mass-to-charge ratio slot-column.

resolution(object), resolution(object) <- value: Get or set the estimated mass resolutionof the mass-to-charge ratios. Typically, this should not be set manually.

isCentroided(object): Guess whether the data are centroided or not, based on the m/z values.

as.list(x, ..., slots = TRUE): Coerce the object to a list, where the slot-columns are in-cluded by default. Use slots=FALSE to exclude the slot-columns.

Author(s)

Kylie A. Bemis

See Also

XDataFrame

Examples

## create an MassDataFrame objectmz <- mz(from=200, to=220, by=200)values <- runif(length(mz))fdata <- MassDataFrame(mz=mz, values=values)

## check the mass-to-charge ratio propertieshead(mz(fdata))resolution(fdata)

meansTest-methods Linear model-based testing for summarized imaging experiments

Description

Performs hypothesis testing for imaging experiments by fitting linear mixed models to summariza-tions or segmentations.

Usage

## S4 method for signature 'SparseImagingExperiment'meansTest(x, fixed, random, groups = run(x),

BPPARAM = bpparam(), ...)

## S4 method for signature 'SparseImagingExperiment'segmentationTest(x, fixed, random, groups = run(x),

classControl = c("Ymax", "Mscore"),

Page 40: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

40 meansTest-methods

BPPARAM = bpparam(), ...)

## S4 method for signature 'SpatialDGMM'segmentationTest(x, fixed, random, model = modelData(x),

classControl = c("Ymax", "Mscore"),BPPARAM = bpparam(), ...)

## S4 method for signature 'MeansTest'summary(object, ..., BPPARAM = bpparam())

## S4 method for signature 'SegmentationTest'summary(object, ..., BPPARAM = bpparam())

Arguments

x An imaging dataset or segmented/summarized imaging dataset.fixed A one-sided formula giving the fixed effects of the model on the RHS. The

response will added to the LHS, and the formula will be passed to the underlyingmodeling function.

random A one-sided formula giving the random effects of the model on the RHS. Seelme for the allowed specifications.

groups The summarization units. Pixels from different groups will be segmented/summarizedseparately. Each distinct observational unit (e.g., tissue sample) should be as-signed to a unique group.

model An integer vector or list specifying which fitted model to plot. If this is an in-teger vector, it should give the rows indices of modelData(x) to use for plotting.Otherwise, it should be a list giving the values of parameters in modelData(x).

classControl Either the method used to match segmented classes to the fixed effects, or a listwhere each element is a vector of name-value pairs giving the mapping betweengroups and classes (e.g., c(group1=class1, group2=class2, ...)). For automatedmatching methods, ’Ymax’ means to use the classes with the highest mean re-sponse for each group, and ’Mscore’ means to select classses based on a matchscore quantifying the overlap between classes and fixed effects.

... Passed to internal linear modeling methods.object A fitted model object to summarize.BPPARAM An optional instance of BiocParallelParam. See documentation for bplapply.

Value

An object of class MeansTest or SegmentationTest, which is a ImagingResult, where each ele-ment of the resultData slot contains at least the following components:

model: A linear model fitted using either lm or lme.data: The summarized data used to fit the model.

Author(s)

Dan Guo and Kylie A. Bemis

See Also

lm, lme, spatialDGMM

Page 41: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

MIAPE-Imaging-class 41

Examples

set.seed(1)x <- simulateImage(preset=4, nruns=3, npeaks=10,

dim=c(10,10), peakheight=5, peakdiff=2,representation="centroid")

groups <- replace(run(x), !(x$circleA | x$circleB), NA)

fit <- meansTest(x, ~ condition, groups=groups)

summary(fit)

MIAPE-Imaging-class MIAPE-Imaging: Class for storing mass spectrometry imaging exper-iment information

Description

The Minimum Information About a Proteomics Experiment for MS Imaging. The current imple-mentation is based on the imzML specification.

Slots

name: Object of class character containing the experimenter name

lab: Object of class character containing the laboratory where the experiment was conducted.

contact: Object of class character containing contact information for lab and/or experimenter.

title: Object of class character containing a single-sentence experiment title.

abstract: Object of class character containing an abstract describing the experiment.

url: Object of class character containing a URL for the experiment.

pubMedIds: Object of class character listing strings of PubMed identifiers of papers relevant tothe dataset.

samples: Object of class list containing information about the samples.

preprocessing: Object of class list containing information about the pre-processing steps usedon the raw data from this experiment.

other: Object of class list containing other information for which none of the above slots doesnot applies.

specimenOrigin: Object of class character describing the specimen origin (institution, . . . ).

specimenType: Object of class character describing the specimen type (species, organ, . . . ).

stainingMethod: Object of class character describing the staining method, if any, applied to thesample (H&E, . . . ).

tissueThickness: Object of class numeric giving the tissue thickness in micrometers (um).

tissueWash: Object of class character describing the wash method (spray, dipping, . . . ).

embeddingMethod: Object of class character describing the embedding method (if any); thiscould be paraffin, . . .

inSituChemistry: Object of class character describing any on-sample chemistry (tryptic digest,. . . )

Page 42: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

42 MIAPE-Imaging-class

matrixApplication: Object of class character describing how the matrix was applied, if appli-cable

pixelSize: Object of class numeric describing the size of the pixels in micrometers (um).

instrumentModel: Object of class character indicating the instrument model used to generatethe data.

instrumentVendor: Object of class character indicating the mass spectrometer vendor.

massAnalyzerType: Object of class character describing the mass analyzer type (LTQ, TOF,. . . ).

ionizationType: Object of class character describing the ionization type (MALDI, DESI, . . . ).

scanPolarity: Object of class character describing the polarity (negative or positive).

softwareName: Object of class character with the control and/or analysis software name.

softwareVersion: Object of class character with the version of the control and/or analysis soft-ware.

scanType: Object of class character describing the scan type. This must be either ’horizontalline scan’ or ’vertical line scan’. See the imzML specifications for more details.

scanPattern: Object of class character describing the scan type. This must be one of ’flyback’,’meandering’, or ’random access’. See the imzML specifications for more details.

scanDirection: Object of class character describing the scan type. This must be one of ’bottomup’, ’left right’, ’right left’, or ’top down’. See the imzML specifications for more details.

lineScanDirection: Object of class character describing the scan type. This must be one of’linescan bottom up’, ’linescan left right’, ’linescan right left’, or ’linescan top down’. See theimzML specifications for more details.

imageShape: Object of class character describing the image shape (rectangular, free form, . . . ).See the imzML specifications for more details.

Extends

Class MIAxE, directly, Class Versioned, by class "MIAxE", distance 2.

Creating Objects

MIAPE-Imaging instances can be created through new("MIAPE-Imaging"). In general, instancesshould not be created by the user, but are automatically generated when reading an external file tocreate an MSImageSet object, and then modified through the accessor and setter methods if neces-sary.

Methods

Class-specific methods:

msiInfo: Displays ’MIAPE-Imaging’ information.

abstract: An accessor function for abstract.

expinfo: An accessor function for name, lab, contact, title, and url.

notes(object), notes(object) <- value: Accessor functions for other. notes(object) <-characterappends character to notes; use notes(object) <-list to replace the notes entirely.

otherInfo: An accessor function for other.

preproc: An accessor function for preprocessing.

pubMedIds(object), pubMedIds(object) <- value: Accessor function for pubMedIds.

Page 43: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

MIAPE-Imaging-class 43

samples: An accessor function for samples.

specimenOrigin(object): Accessor function for specimenOrigin.

specimenType(object): Accessor function for specimenType.

stainingMethod(object): Accessor function for stainingMethod.

tissueThickness(object): Accessor function for tissueThickness.

tissueWash(object): Accessor function for tissueWash.

embeddingMethod(object): Accessor function for embeddingMethod.

inSituChemistry(object): Accessor function for inSituChemistry.

matrixApplication(object): Accessor function for matrixApplication.

pixelSize(object): Accessor function for pixelSize.

imageShape(object): Accessor function for imageShape.

instrumentModel(object): Accessor function for instrumentModel.

instrumentVendor(object): Accessor function for instrumentVendor.

massAnalyzerType(object): Accessor function for massAnalyzerType.

ionizationType(object): Accessor function for ionizationType.

scanPolarity(object): Accessor function for scanPolarity.

softwareName(object): Accessor function for softwareName.

softwareVersion(object): Accessor function for softwareVersion.

scanType(object): Accessor function for scanType.

scanPattern(object): Accessor function for scanPattern.

scanDirection(object): Accessor function for scanDirection.

lineScanDirection(object): Accessor function for lineScanDirection.

Standard generic methods:

show: Displays object content.

combine(x, y, ...): Combine two or more MIAPE-Imaging objects.

Author(s)

Kylie A. Bemis

References

Schramm T, Hester A, Klinkert I, Both J-P, Heeren RMA, Brunelle A, Laprevote O, Desbenoit N,Robbe M-F, Stoeckli M, Spengler B, Rompp A (2012) imzML - A common data format for theflexible exchange and processing of mass spectrometry imaging data. Journal of Proteomics 75(16):5106-5110. doi:10.1016/j.jprot.2012.07.026

See Also

MIAxE, MSImageSet

Examples

showClass("MIAPE-Imaging")

Page 44: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

44 MSImageData-class

MSContinuousImagingExperiment-class

MSContinuousImagingExperiment: "Continuous" mass spectrometryimaging experiments

Description

The MSContinuousImagingExperiment class is a simple extension of MSImagingExperiment fordense spectra. All methods for that class apply. In addition, each data element must be stored as anordinary R matrix or a column-major matter_mat.

Author(s)

Kylie A. Bemis

See Also

MSImagingExperiment, MSProcessedImagingExperiment

MSImageData-class MSImageData: Class containing mass spectrometry image data

Description

A container class for mass spectrometry imaging data. This is an extension of the SImageDataclass, which adds methods specific for the extraction and replacement of mass spectral peaks.

Usage

## Instance creationMSImageData(

data = Hashmat(nrow=0, ncol=0),coord = expand.grid(

x = seq_len(ncol(data)),y = seq_len(ifelse(ncol(data) > 0, 1, 0))),

storageMode = "immutableEnvironment",positionArray = generatePositionArray(coord),dimnames = NULL,...)

## Additional methods documented below

Arguments

data A matrix-like object with number of rows equal to the number of features andnumber of columns equal to the number of non-missing pixels. Each columnshould be a feature vector. Alternatively, a multidimensional array that repre-sents the datacube with the first dimension as the features can also be supplied.Additional dimensions could be the spatial dimensions of the image, for exam-ple.

Page 45: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

MSImageData-class 45

coord A data.frame with columns representing the spatial dimensions. Each rowprovides a spatial coordinate for the location of a feature vector correspondingto a column in data. This argument is ignored if data is a multidimensionalarray rather than a matrix.

storageMode The storage mode to use for the MSImageData object for the environment in thedata slot. Only "immutableEnvironment" is allowed for MSImageData. Seedocumentation on the storageMode slot below for more details.

positionArray The positionArray for the imaging data. This should not normally be specifiedthe user, since it is generated automatically from the coord argument, unless forsome reason coord is not specified.

dimnames A list of length two, giving the feature names and pixel names in that order. Ifmissing, this is taken from the ’dimnames’ of the data argument.

... Additional Named arguments that are passed to the initialize method forinstantiating the object. These must be matrices or matrix-like objects of equaldimension to data. They will be assigned into the environment in the data slot.

Slots

data: An environment which contains at least one element named "iData", and possibly con-taining an element named "peakData" and "mzData". The "peakData" element contains theintensities of the peak cube in a sparse matrix format. The "mzData" element contians the m/zvalues of the peaks in a sparse matrix format. All of these matrices have been aligned for thattheir dimensions reflect only the shared peaks, possibly across multiple datasets. They havebeen aligned from a call to peakAlign.

coord: An data.frame with rows giving the spatial coordinates of the pixels corresponding to thecolumns of "iData".

positionArray: An array with dimensions equal to the spatial dimensions of the image, whichstores the column numbers of the feature vectors corresponding to the pixels in the "iData"element of the data slot. This allows re-construction of the imaging "datacube" on-the-fly.

dim: A length 2 integer vector analogous to the ’dim’ attribute of an ordinary R matrix.

dimnames: A length 2 list analogous to the ’dimnames’ attribute of an ordinary R matrix.

storageMode: A character which is one of "immutableEnvironment", "lockedEnvironment",or "environment". The values "lockedEnvironment" and "environment" behave as de-scribed in the documentation of AssayData. An "immutableEnvironment" uses a lockedenvironment while retaining R’s typical copy-on-write behavior. Whenever an object in animmutable environment is modified, a new environment is created for the data slot, and allobjects copied into it. This allows usual R functional semantics while avoiding copying oflarge objects when other slots are modified.

.__classVersion__: A Versions object describing the version of the class used to created theinstance. Intended for developer use.

Extends

Versioned

Creating Objects

MSImageData instances are usually created through MSImageData().

Page 46: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

46 MSImageData-class

Methods

Class-specific methods:

iData(object), iData(object)<-: Return or set the matrix of image intensities. Columns shouldcorrespond to feature vectors, and rows should correspond to pixel vectors.

peakData(object), peakData(object)<-: Return or set the sparse matrix of peak intensities if itexists.

mzData(object), mzData(object)<-: Return or set the sparse matrix of peak m/z values if itexists.

coord(object), coord(object)<-: Return or set the coodinates. This is a data.frame with eachrow corresponding to the spatial coordinates of a pixel.

positionArray(object), positionArray(object)<-: Return or set the positionArray slot.When setting, this should be an array returned by a call to generatePositionArray.

featureNames(object), featureNames(object) <- value: Access and set feature names (namesof the rows of the intensity matrix).

pixelNames(object), pixelNames(object) <- value: Access and set the pixel names (namesof the columns of the intensity matrix).

storageMode(object), storageMode(object)<-: Return or set the storage mode. See documen-tation on the storageMode slot above for more details.

Standard generic methods:

combine(x, y, ...): Combine two or more MSImageData objects. Elements must be matrix-likeobjects and are combined column-wise with a call to ’cbind’. The numbers of rows mustmatch, but otherwise no checking of row or column names is performed. The pixel coordinatesare checked for uniqueness.

dim: Return the dimensions of the (virtual) datacube. This is equal to the number of features (thenumber of rows in the matrix returned by iData) and the dimensions of the positionArrayslot. For a standard imaging dataset, that is the number features followed by the spatial di-mensions of the image.

dims: A matrix where each column corresponds to the dimensions of the (virtual) datacubes storedas elements in the data slot. See above for how the dimensions are calculated.

MSImageData[i, j, ..., drop]: Access intensities in the (virtual) imaging datacube. The dat-acube is reconstructed on-the-fly. The object can be indexed like any ordinary array withnumber of dimensions equal to dim(object). Use drop = NA to return a subset of the sameclass as the object.

Author(s)

Kylie A. Bemis

See Also

ImageData, SImageData, SImageSet, MSImageSet

Examples

## Create an MSImageData objectMSImageData()

## Using a P x N matrix

Page 47: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

MSImageProcess-class 47

data1 <- matrix(1:27, nrow=3)coord <- expand.grid(x=1:3, y=1:3)sdata1 <- MSImageData(data1, coord)sdata1[] # extract data as array

## Using a P x X x Y arraydata2 <- array(1:27, dim=c(3,3,3))sdata2 <- MSImageData(data2)sdata2[] # should be identical to above

# Missing data from some pixelsdata3 <- matrix(1:9, nrow=3)sdata3 <- MSImageData(data3, coord[c(1,5,9),])

dim(sdata3) # presents as an arrayiData(sdata3) # stored as matrixsdata3[] # recontruct the datacube

iData(sdata3)[,1] <- 101:103 # assign using iData()sdata3[] # can only assign into matrix representation

## Sparse feature vectorsdata4 <- Hashmat(nrow=9, ncol=9)sdata4 <- MSImageData(data4, coord)iData(sdata4)[] <- diag(9)sdata4[1,,]

MSImageProcess-class MSImageProcess: Class containing mass spectral preprocessing in-formation

Description

A class containing information about mass spectral pre-processsing operations. These should notusually be set by the user, and are automatically updated when processing methods are applied.

Slots

files: Object of class character storing the file paths to the raw data files used to create thedataset.

normalization: Object of class character describing any normalization applied to the dataset.

smoothing: Object of class character describing any smoothing applied to the dataset.

baselineReduction: Object of class character describing baseline correction applied to thedataset.

spectrumRepresentation: Object of class character describing the spectrum type (profile orcentroid).

peakPicking: Object of class character describing the peak picking applied to the dataset (areaor height).

centroided: Object of class logical describing whether the data have been centroided.

history: Object of class list containing specific information about the function calls applied tothe MSImageSet object to produce the current instance and their parameters.

Page 48: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

48 MSImageProcess-class

CardinalVersion: Object of class character indicating the version of Cardinal.

.__classVersion__: Object of class Versions indicating the version of the MSImageProcessinstance. Intended for developer use.

Extends

Class Versioned, directly.

Creating Objects

MSImageProcess instances can be created through new("MSImageProcess"). In general, instancesshould not be created by the user, but are automatically generated by processing methods applied toMSImageSet objects.

Methods

Class-specific methods:

prochistory(object), prochistory(object) <- value: Accessor and setter for the history ofmethods applied to the experiment dataset.

files(object), files(object) <- value: Accessor and setter function for files.

normalization(object), normalization(object) <- value: Accessor and setter function fornormalization.

smoothing(object), smoothing(object) <- value: Accessor and setter function for smoothing.

baselineReduction(object), baselineReduction(object) <- value: Accessor and setter func-tion for baselineReduction.

spectrumRepresentation(object), spectrumRepresentation(object) <- value: Accessor andsetter function for spectrumRepresentation.

peakPicking(object), peakPicking(object) <- value: Accessor and setter function for peakPicking.

centroided(object), centroided(object) <- value: Accessor and setter function for centroided.

Standard generic methods:

show: Displays object content.

combine(x, y, ...): Combine two or more MSImageProcess objects.

Author(s)

Kylie A. Bemis

See Also

MSImageSet

Examples

showClass("MSImageProcess")

Page 49: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

MSImageSet-class 49

MSImageSet-class MSImageSet: Class to contain mass spectrometry imaging experimentdata

Description

Container for mass spectrometry imaging experimental data and metadata. MSImageSet is derivedfrom iSet through SImageSet. It extends these classes with information about the processing andanalysis, requiring MIAPE-Imaging in its experimentData slot.

Usage

## Instance creationMSImageSet(

spectra = Hashmat(nrow=0, ncol=0),mz = seq_len(dim(spectra)[1]),coord = expand.grid(

x = seq_len(prod(dim(spectra)[-1])),y = seq_len(ifelse(prod(dim(spectra)[-1]) > 0, 1, 0))),

imageData = MSImageData(data=spectra, coord=coord),pixelData = IAnnotatedDataFrame(

data=coord,varMetadata=data.frame(labelType=rep("dim", ncol(coord)))),

featureData = AnnotatedDataFrame(data=data.frame(mz=mz)),

processingData = new("MSImageProcess"),protocolData = AnnotatedDataFrame(

data=data.frame(row.names=sampleNames(pixelData))),experimentData = new("MIAPE-Imaging"),...)

## Additional methods documented below

Arguments

spectra A matrix-like object with number of rows equal to the number of features andnumber of columns equal to the number of non-missing pixels. Each columnshould be a mass spectrum. Alternatively, a multidimensional array that rep-resents the datacube with the first dimension as the features (m/z values) canalso be supplied. Additional dimensions could be the spatial dimensions of theimage, for example.

mz A numeric vector representing the mass-to-charge ratio features (m/z values)corresponding to the rows in the spectra matrix. Must be strictly increasing ordecreasing.

coord A data.frame with columns representing the spatial dimensions. Each row pro-vides a spatial coordinate for the location of a mass spectrum corresponding to acolumn in spectra. This argument is ignored if spectra is a multidimensionalarray rather than a matrix.

imageData An object of class SImageData that will contain the imaging mass spectra. Usu-ally constructed through the spectra and coord arguments.

Page 50: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

50 MSImageSet-class

pixelData An object of class IAnnotatedDataFrame giving the information about the pix-els including coordinates of the data in imageData.

featureData An object of class AnnotatedDataFrame giving information about the data fea-tures. Requires a column named "mz".

processingData An object of class MSImageProcess giving information about the pre-processingsteps applied to the spectra.

protocolData An object of class AnnotatedDataFrame giving information about the samples.It must have one row for each of the sampleNames in pixelData.

experimentData An object derived from class MIAxE giving information about the imaging ex-periment.

... Additional arguments passed to the initializer.

Slots

imageData: An instance of SImageData, which stores one or more matrices of equal number ofdimensions as elements in an ’immutableEnvironment’. This slot preserves copy-on-writebehavior when it is modified specifically, but is pass-by-reference otherwise, for memory effi-ciency.

pixelData: Contains pixel information in an IAnnotatedDataFrame. This includes both pixel co-ordinates and phenotypic and sample data. Its rows correspond to the columns in imageData.

featureData: Contains variables describing features. Its rows correspond to the rows in imageDatain an IAnnotatedDataFrame.

processingData: Contains details about the pre-processing steps that have been applied to thespectra. An object of class MSImageProcess.

experimentData: Contains details of experimental methods. Must be MIAPE-Imaging.

protocolData: Contains variables describing the generation of the samples in pixelData in anIAnnotatedDataFrame.

.__classVersion__: A Versions object describing the version of the class used to created theinstance. Intended for developer use.

Extends

SImageSet, directly. iSet, by class "SImageSet", distance 1. VersionedBiobase, by class "iSet",distance 2. Versioned, by class "VersionedBiobase", distance 3.

Creating Objects

MSImageSet instances can be created through MSImageSet(), but are more commonly createdthrough reading of external data files.

Methods

Class-specific methods:

spectra(object), spectra(object) <- value: Access and set the mass spectra in imageData.This is a matrix-like object with rows corresponding to features and columns correspondingto pixels, so that each column of the returned object is a mass spectrum.

peaks(object), peaks(object) <- value: Access and set the peaks in imageData if peak pick-ing have been performed. This is a shortcut for peakData(imageData(object)). These arethe unaligned peaks. Aligned peaks (if they exist) are accesed by spectra(object).

Page 51: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

MSImageSet-class 51

mz(object), mz(object) <- value: Returns and sets the common m/z values of the mass spectrain the dataset. This is a required column of featureData.

features(object, ..., mz): Access the feature indices (rows in featureData) correspondingto variables in featureData. Bisection search is used for fuzzy matching of m/z values.

pixels(object, ..., coord): Access the pixel indices (rows in pixelData) corresponding tovariables in pixelData. If specified, coord should be a data.frame where each row corre-sponds to the coordinates of a desired pixel.

centroided(object), centroided(object) <- value: Access whether the dataset consists ofprofile or centroided mass spectra. This is a shortcut for centroided(processingData(object)).A setter is also provided, and is sometimes necessary for forcing some analysis methods toaccept unprocessed spectra. (This is usually a bad idea.)

processingData(object), processingData(object) <- value: Access and set the processingDataslot.

Standard generic methods:

combine(x, y, ...): Combine two or more MSImageSet objects. Unique ’sample’s in pixelDataare treated as a dimension.

MSImageSet[i, j, ..., drop]: Subset an SImageSet based on the rows (featureData compo-nents) and the columns (pixelData components). The result is a new MSImageSet.

See iSet and SImageSet for additional methods.

Author(s)

Kylie A. Bemis

See Also

iSet, SImageSet

Examples

## Create an MSImageSet objectspectra <- matrix(1:27, nrow=3)mz <- 101:103coord <- expand.grid(x=1:3, y=1:3)msset <- MSImageSet(spectra=spectra, mz=mz, coord=coord)

## Access a single image corresponding to the first featureimageData(msset)[1,,]

## Reconstruct the datacubeimageData(msset)[]

## Access the P x N matrix of column-wise mass spectraspectra(msset)

## Subset the MSImageSet to the first 2 m/z values and first 6 mass spectramsset2 <- msset[1:2, 1:6]imageData(msset2)[]msset2

Page 52: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

52 MSImagingExperiment-class

MSImagingExperiment-class

MSImagingExperiment: Mass spectrometry imaging experiments

Description

The MSImagingExperiment class is designed for mass spectrometry imaging experimental data andmetadata. 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 asany type of experimental metadata such as diagnosis, subject, time point, etc.

Usage

## Instance creationMSImagingExperiment(

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 featuresand 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 newobjects.

centroided FALSE if the object contains profile spectra and TRUE if the spectra have beenpeak-picked and centroided.

Details

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

Subclasses MSContinuousImagingExperiment and MSProcessedImagingExperiment exist to al-low downstream methods to make assumptions about the underlying data storage (dense matricesfor ’continous’ format and sparse matrices for ’processed’ format), which can sometimes allowmore efficient computations.

Page 53: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

MSImagingExperiment-class 53

Slots

imageData: An object inheriting from ImageArrayList, storing one or more array-like data ele-ments with conformable dimensions.

featureData: Contains feature information in a MassDataFrame. Each row includes the metadataassociated with an m/z value.

elementMetadata: Contains pixel information in a PositionDataFrame. Each row includes themetadata for a single observation (e.g., a pixel), including specialized slot-columns for track-ing pixel coordinates and experimental runs.

metadata: A list containing experiment-level metadata.

processing: A SimpleList containing processing steps (including both queued and previouslyexecuted 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 MSImagingExperimentobjects. 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-columnsfrom pixelData.

pixels(object, ..., coord, run): Returns the row indices of pixelData corresponding to con-ditions passed via . . . .

features(object, ..., mz): Returns the row indices of featureData corresponding to condi-tions 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 forspectra() 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 andintensity arrays of the peak data in processed experiments. (Currently only implemented forMSProcessedImagingExperiment).

isCentroided(object): Attempts to infer if the mass spectra are centroided or not (without ref-erencing 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

Page 54: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

54 MSImagingInfo-class

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)

MSImagingInfo-class MSImagingInfo: Mass spectrometry imaging metadata for imzMLconversion

Description

The MSImagingInfo class is designed to contain metadata for reading/writing Cardinal objectsfrom/to imzML files.

Methods

length(object): The number of scans (i.e., the number of mass spectra).

scans(object): Access the scan list metadata for writing to imzML.

mzData(object): Access the m/z array list metadata for writing to imzML.

intensityData(object): Access the intensity array list metadata for writing to imzML.

isCentroided(object): Check whether the mass spectra are centroided.

normalization(object), normalization(object) <- value: Accessor and setter function forthe normalization.

smoothing(object), smoothing(object) <- value: Accessor and setter function for the smoothing.

baselineReduction(object), baselineReduction(object) <- value: Accessor and setter func-tion for the baselineReduction.

peakPicking(object), peakPicking(object) <- value: Accessor and setter function for thepeakPicking.

spectrumRepresentation(object), spectrumRepresentation(object) <- value: Accessor andsetter function for the spectrumRepresentation.

matrixApplication(object): Accessor function for matrixApplication.

pixelSize(object): Accessor function for pixelSize.

instrumentModel(object): Accessor function for instrumentModel.

instrumentVendor(object): Accessor function for instrumentVendor.

massAnalyzerType(object): Accessor function for massAnalyzerType.

Page 55: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

MSProcessedImagingExperiment-class 55

ionizationType(object): Accessor function for ionizationType.

scanPolarity(object): Accessor function for scanPolarity.

scanType(object): Accessor function for scanType.

scanPattern(object): Accessor function for scanPattern.

scanDirection(object): Accessor function for scanDirection.

lineScanDirection(object): Accessor function for lineScanDirection.

Author(s)

Kylie A. Bemis

References

Schramm T, Hester A, Klinkert I, Both J-P, Heeren RMA, Brunelle A, Laprevote O, Desbenoit N,Robbe M-F, Stoeckli M, Spengler B, Rompp A (2012) imzML - A common data format for theflexible exchange and processing of mass spectrometry imaging data. Journal of Proteomics 75(16):5106-5110. doi:10.1016/j.jprot.2012.07.026

See Also

MIAxE, MIAPE-Imaging

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

x <- MSImagingExperiment(imageData=ImageArrayList(data),featureData=MassDataFrame(mz=mz),pixelData=PositionDataFrame(coord=coord))

msiInfo(x)

MSProcessedImagingExperiment-class

MSProcessedImagingExperiment: "Processed" mass spectrometryimaging experiments

Description

The MSProcessedImagingExperiment class is a simple extension of MSImagingExperiment forsparse spectra. All methods for that class apply. In addition, each data element must be stored as acolumn-major sparse_mat.

Page 56: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

56 mz-methods

Methods

All methods for MSImagingExperiment also work on MSProcessedImagingExperiment objects.Additional methods are documented below:

intensityData(object), intensityData(object) <- value: Get or set the underlying (pre-binned)intensity values associated with the sparse mass spectra.

mzData(object), mzData(object) <- value: Get or set the underlying (pre-binned) m/z valuesassociated with the sparse mass spectra.

mz(object) <- value: Setting the m/z values changes the m/z binning scheme for the entire dataset(without modifying the underlying data).

resolution(object) <- value: Setting the m/z resolution changes the m/z binning scheme forthe entire dataset (without modifying the underlying data).

tolerance(object), tolerance(object) <- value: Get or set the binning tolerance for sparsespectra or peaks.

combiner(object), combiner(object) <- value: Get or set the binning function for sparse spec-tra or peaks.

collect(x, ..., as.matrix=FALSE): Pull all data elements of imageData into memory as sparsematrices.

Author(s)

Kylie A. Bemis

See Also

MSImagingExperiment, MSContinuousImagingExperiment

mz-methods Manipulate mass-to-charge-ratio values

Description

This is a generic function for getting or setting ’mz’ for an object with associated m/z values, or forgenerating a sequence of appropriate m/z values for such an object.

Usage

## S4 method for signature 'missing'mz(from, to, by, resolution = 200, units = c("ppm", "mz"), ...)

mz(object, ...)

mz(object, ...) <- value

Page 57: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

mzAlign-methods 57

Arguments

object An object with m/z values.

value The value to set the m/z values.

from, to The starting amd (maximal) end values of the sequence of m/z values.

by The (approximate) interval between m/z values. For units="ppm", rather thanan exact step size, this actually corresponds to a binwidth, where each elementof the sequence is considered the center of a bin.

resolution Another way to specify the interval between m/z values. For units="mz", thisis the same as by. For units="ppm", this is the half-binwdith.

units The units for by and resolution. Either parts-per-million or absolute m/z in-crements.

... Additional arguments (ignored).

Author(s)

Kylie A. Bemis

See Also

MassDataFrame

Examples

mz(from=200, to=220, by=300, units="ppm")

mzAlign-methods Mass align an imaging dataset

Description

Apply spectral alignment to a mass spectrometry imaging dataset.

Usage

## S4 method for signature 'MSImagingExperiment,numeric'mzAlign(object, ref, tolerance = NA, units = c("ppm", "mz"),

quantile = 0.2, span = 0.75, ...)

## S4 method for signature 'MSImagingExperiment,missing'mzAlign(object, tolerance = NA, units = c("ppm", "mz"),

quantile = 0.2, span = 0.75, ...)

Arguments

object An imaging dataset.

ref A reference spectrum to use for alignment.

tolerance The tolerance to be used when matching the peaks in the unaligned spectra tothe reference spectrum. If this is NA, then automatically guess a tolerance fromthe data.

Page 58: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

58 mzBin-methods

units The units to use for the tolerance.

quantile The top quantile of reference points (peaks detected via local maxima) to usefrom the reference spectrum.

span The smoothing parameter for the local polynomial regression used to determinethe warping function.

... Ignored.

Details

Mass binning is performed by first selecting reference points in the reference spectrum by detectinglocal maxima. Some number of these reference points with the highest intensities (determinedby quantile) are then used for alignment. The nearest local maxima to the reference points aredetected in each unaligned spectrum (within tolerance), and then the unaligned spectra are warpedto maximize correlation with the reference spectrum.

Internally, pixelApply is used to perform the alignment. See its documentation page for moredetails.

Value

An object of the same class with the aligned spectra.

Author(s)

Kylie A. Bemis

See Also

MSImagingExperiment, mzBin, peakAlign, pixelApply, process

Examples

register(SerialParam())

set.seed(2)data <- simulateImage(preset=1, npeaks=10, dim=c(3,3), sdmz=500)data <- data[,pData(data)$circle]

# queue spectral alignmentdata <- mzAlign(data, tolerance=1, units="mz")

# apply spectral alignmentdata_aligned <- process(data, plot=interactive())

mzBin-methods Mass bin an imaging dataset

Description

Apply mass binning to a mass spectrometry imaging dataset.

Page 59: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

mzBin-methods 59

Usage

## S4 method for signature 'MSImagingExperiment,numeric'mzBin(object, ref, tolerance = NA, units = c("ppm", "mz"), fun=sum, ...)

## S4 method for signature 'MSImagingExperiment,missing'mzBin(object, from=min(mz(object)), to=max(mz(object)), by,

resolution = NA, units = c("ppm", "mz"), fun=sum, ...)

Arguments

object An imaging dataset.

ref A reference to which the m/z values are binned.

tolerance The half-width(s) of the bins. If this is NA, then automatically guess a resolutionfrom the data.

from, to The starting amd (maximal) end values of the sequence of m/z values.

by The (approximate) interval between m/z values. For units="ppm", rather thanan exact step size, this actually corresponds to a binwidth, where each elementof the sequence is considered the center of a bin.

resolution Another way to specify the interval between m/z values. For units="mz", thisis the same as by. For units="ppm", this is the half-binwdith. If this is NA, thenautomatically guess a resolution from the data.

units The units for by and resolution. Either parts-per-million or absolute m/z in-crements.

fun The function used to summarize each mass bin.

... Ignored.

Details

The reference masses are considered to be the center of each bin. The bin is then expanded oneither side according to half the value of width, and the intensities in each bin are summarized byapplying fun.

Internally, pixelApply is used to apply the binning. See its documentation page for more details.

Value

An object of the same class with the binned spectra.

Author(s)

Kylie A. Bemis

See Also

MSImagingExperiment, mzAlign, peakBin, reduceDimension, pixelApply, process

Page 60: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

60 mzFilter-methods

Examples

register(SerialParam())

set.seed(2)data <- simulateImage(preset=1, npeaks=10, dim=c(3,3))data <- data[,pData(data)$circle]

# queue m/z binningdata <- mzBin(data, resolution=10, units="mz", fun=max)

# apply m/z binningdata_binned <- process(data, plot=interactive())

mzFilter-methods Filter the features of an imaging dataset by intensity

Description

Apply filtering to a mass spectrometry imaging dataset based on the intensities of each peak or massfeature.

Usage

## S4 method for signature 'MSImagingExperiment'mzFilter(object, ..., thresh.max = NA, freq.min = NA, rm.zero = TRUE)

## S4 method for signature 'MSImagingExperiment'peakFilter(object, ..., thresh.max = NA, freq.min = 0.01, rm.zero = TRUE)

## S4 method for signature 'MSImageSet'peakFilter(object, method = "freq", ...)

## Filter based on the frequency of a peakpeakFilter.freq(x, freq.min=0.01, ...)

Arguments

object An object of class MSImageSet.

thresh.max Minimum threshold relative to maximum mean intensity; features with meanintensity lesser than this, as a proportion of the maximum intensity in the meanspectrum, will be dropped.

freq.min Minimum frequency; peaks that occur in the dataset in lesser proportion thanthis will be dropped.

rm.zero Remove features with mean intensities of zero.

... Additional arguments passed to the peak filtering method, or conditions evalu-ating to logical vectors where only those conditions that are TRUE are retained.

method The peak filtering method to use.

x The vector of ion image intensities to filter.

Page 61: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

mzFilter-methods 61

Details

When applied to a MSImagingExperiment object, mzFilter and peakFilter uses the summarize()to generate useful summary statistics about the mass features or detected peaks. These include the‘min’, ‘max’, ‘mean’, ‘sum’, ‘sd’, and ‘var’ of the intensities for each mass feature or peak. Thesecan be used in logical expressions to filter the features of the dataset.

Note that peakFilter is an alias for mzFilter, with different default parameters that are moreappropriate for peak-picked data rather than profile spectra.

When applied to a MSImageSet object, unlike most other processing methods, peakFilter operateson the feature space (ion images) of the dataset.

Peak filtering is usually performed using the provided functions, but a user-created function canalso be passed to method. In this case it should take the following arguments:

• x: The vector of ion image intensities to filter.

• ...: Additional arguments.

A user-created function should return a logical: TRUE means keep the peak, and FALSE meansremove the peak.

Internally, featureApply is used to apply the filtering. See its documentation page for more detailson additional objects available to the environment installed to the peak filtering function.

Value

An object of the same class with the filtered peaks.

Author(s)

Kylie A. Bemis

See Also

MSImagingExperiment, MSImageSet, peakPick, peakAlign, peakBin, reduceDimension, featureApply,process

Examples

register(SerialParam())

set.seed(2)data <- simulateImage(preset=1, npeaks=10, dim=c(3,3))data <- data[,pData(data)$circle]

# filter m/z featuresprocess(mzFilter(data))

# queue peak picking, alignment, and filteringdata <- peakPick(data, method="simple", SNR=6)data <- peakAlign(data, tolerance=200, units="ppm")data <- peakFilter(data, freq.min=0.2)

# apply peak picking, alignment, and filteringdata_peaks <- process(data, plot=interactive())

Page 62: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

62 normalize-methods

normalize-methods Normalize an imaging dataset

Description

Apply normalization to the feature vectors of an imaging dataset.

Usage

## S4 method for signature 'SparseImagingExperiment'normalize(object, method = c("tic", "rms", "reference"), ...)

## S4 method for signature 'MSImageSet'normalize(object, method = "tic",...,pixel = pixels(object),plot = FALSE)

## Totial-ion-current normalizationnormalize.tic(x, tic=length(x), ...)

## Root-mean-square normalizationnormalize.rms(x, rms=1, ...)

## Reference normalizationnormalize.reference(x, feature, scale=1, ...)

Arguments

object An imaging dataset.

method The normalization method to use.

pixel The pixels to normalize. If less than the extent of the dataset, this will result ina subset of the data being processed.

plot Plot each pixel while it is being processed?

... Additional arguments passed to the normalization method.

x The signal to be normalized.

tic The value to which to normalize the total ion current.

rms The value to which to normalize the root-mean-square.

feature The feature to use as a reference for normalization.

scale The value to which to normalize the reference.

Details

Normalization is usually performed using the provided functions, but a user-created function canalso be passed to method. In this case it should take the following arguments:

• x: A numeric vector of intensities.

• ...: Additional arguments.

Page 63: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

PCA-methods 63

A user-created function should return a numeric vector of the same length.

Internally, pixelApply is used to apply the normalization. See its documentation page for moredetails on additional objects available to the environment installed to the normalization function.

Value

An object of the same class with the normalized spectra.

Author(s)

Kylie A. Bemis

See Also

MSImagingExperiment, MSImageSet, pixelApply, process

Examples

register(SerialParam())

set.seed(2)data <- simulateImage(preset=1, npeaks=10, dim=c(3,3))data <- data[,pData(data)$circle]

# queue normalizationdata <- normalize(data, method="tic")

# apply normalizationdata_normalized <- process(data)

PCA-methods Principal components analysis

Description

Performs principal components analysis efficiently on large datasets using implicitly restarted Lanc-zos bi-diagonalization (IRLBA) algorithm for approximate singular value decomposition of the datamatrix.

Usage

## S4 method for signature 'SparseImagingExperiment'PCA(x, ncomp = 3, center = TRUE, scale = FALSE, ...)

## S4 method for signature 'PCA2'predict(object, newx, ncomp, ...)

## S4 method for signature 'PCA2'summary(object, ...)

## S4 method for signature 'SImageSet'PCA(x, ncomp = 3,

Page 64: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

64 PCA-methods

method = c("irlba", "nipals", "svd"),center = TRUE,scale = FALSE,iter.max = 100, ...)

## S4 method for signature 'PCA'predict(object, newx, ...)

Arguments

x The imaging dataset for which to calculate the principal components.

ncomp The number of principal components to calculate.

method The function used to calculate the singular value decomposition.

center Should the data be centered first? This is passed to scale.

scale Shoud the data be scaled first? This is passed to scale.

iter.max The number of iterations to perform for the NIPALS algorithm.

... Ignored.

object The result of a previous call to PCA.

newx An imaging dataset for which to calculate the principal components scores basedon the aleady-calculated principal components loadings.

Value

An object of class PCA2, which is a ImagingResult, or an object of class PCA, which is a ResultSet.Each elemnt of resultData slot contains at least the following components:

loadings: A matrix with the principal component loadings.

scores: A matrix with the principal component scores.

sdev: The standard deviations of the principal components.

Author(s)

Kylie A. Bemis

See Also

OPLS, PLS, irlba, svd

Examples

register(SerialParam())

set.seed(1)data <- simulateImage(preset=2, npeaks=20, dim=c(6,6),

representation="centroid")

# project to FastMap componentspca <- PCA(data, ncomp=2)

# visualize first 2 componentsimage(pca, superpose=FALSE)

Page 65: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

peakAlign-methods 65

peakAlign-methods Peak align an imaging dataset

Description

Apply peak alignment to a mass spectrometry imaging dataset.

Usage

## S4 method for signature 'MSImagingExperiment,missing'peakAlign(object, tolerance = NA, units = c("ppm", "mz"), ...)

## S4 method for signature 'MSImagingExperiment,character'peakAlign(object, ref, ...)

## S4 method for signature 'MSImagingExperiment,numeric'peakAlign(object, ref, ...)

## S4 method for signature 'MSImageSet,numeric'peakAlign(object, ref, method = c("diff", "DP"),

...,pixel = pixels(object),plot = FALSE)

## S4 method for signature 'MSImageSet,MSImageSet'peakAlign(object, ref, ...)

## S4 method for signature 'MSImageSet,missing'peakAlign(object, ref, ...)

## Absolute difference alignmentpeakAlign.diff(x, y, diff.max=200, units=c("ppm", "mz"), ...)

## Dynamic programming alignmentpeakAlign.DP(x, y, gap=0, ...)

Arguments

object An imaging dataset.

ref A reference to which to align the peaks.

tolerance The tolerance to be used when aligning detected peaks to the reference. If thisis NA, then automatically guess a tolerance from the data.

units The units to use for the tolerance. Either parts-per-million or the raw m/zvalues.

method The peak alignment method to use.

pixel The pixels to align. If less than the extent of the dataset, this will result in asubset of the data being processed.

plot Plot the mass spectrum for each pixel while it is being processed?

... Additional arguments passed to the peak alignment method.

Page 66: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

66 peakAlign-methods

x The vector of m/z values to be aligned.

y The vector of reference m/z values.

diff.max Peaks that differ less than this value will be aligned together.

gap The gap penalty for the dynamic programming sequence alignment.

Details

When applied to a MSImagingExperiment object with no other reference, peakAlign uses summarize()to calculate the mean spectrum, and then uses the local maxima of the mean spectrum as the refer-ence. Alternatively, a vector of m/z values or a column name in the featureData that should be usedas the reference may be provided. Finally, if the featureData has an numeric vector element named“reference peaks” among its metadata(), this vector is used as the reference.

When applied to a MSImageSet object, if a MSImageSet object is used as the reference then thelocal maxima in its mean spectrum will be calculated and used as the reference m/z values. Themethod looks for a “mean” column in the object’s featureData, and if it does not exist, then themean spectrum will be calculated using featureApply(ref,mean). If the reference is missing, themethod will use the object itself as the reference.

Peak alignment is usually performed using the provided functions, but a user-created function canalso be passed to method. In this case it should take the following arguments:

• x: The vector of m/z values to be aligned.

• y: The vector of reference m/z values.

• ...: Additional arguments.

A user-created function should return a vector of the same length as x and y where NA values indicateno match, and non-missing values give the index of the matched peak in the reference set.

Internally, pixelApply is used to apply the peak alignment. See its documentation page for moredetails on additional objects available to the environment installed to the peak alignment function.

Value

An object of class MSImageSet with the peak aligned spectra.

Author(s)

Kylie A. Bemis

See Also

MSImagingExperiment, MSImageSet, peakPick, peakFilter, peakBin, reduceDimension, pixelApply,process

Examples

register(SerialParam())

set.seed(2)data <- simulateImage(preset=1, npeaks=10, dim=c(3,3))data <- data[,pData(data)$circle]

# queue peak picking and alignmentdata <- peakPick(data, method="simple", SNR=6)

Page 67: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

peakBin-methods 67

data <- peakAlign(data, tolerance=200, units="ppm")

# apply peak picking and alignmentdata_peaks <- process(data, plot=interactive())

peakBin-methods Peak bin an imaging dataset

Description

Apply peak binning to a mass spectrometry imaging dataset.

Usage

## S4 method for signature 'MSImagingExperiment,numeric'peakBin(object, ref, type=c("area", "height"),

tolerance = NA, units = c("ppm", "mz"), ...)

## S4 method for signature 'MSImagingExperiment,missing'peakBin(object, type=c("area", "height"),

tolerance = NA, units = c("ppm", "mz"), ...)

Arguments

object An imaging dataset.

ref A reference to which the peaks are binned.

type Should the summarized intensity of the peak by the maximum height of the peakor the area under the curve?

tolerance The tolerance to be used when matching the m/z features in the dataset to thereference. If this is NA, then automatically guess a resolution from the data.

units The units to use for the tolerance.

... Ignored.

Details

Peak binning is performed by first matching the m/z-values in the dataset to those in the reference,and then finding the boundaries of the peak by detecting the nearest local minima. Then either themaximum height or the area under the curve of the peak are returned.

Internally, pixelApply is used to apply the binning. See its documentation page for more details.

Value

An object of the same class with the binned peaks.

Author(s)

Kylie A. Bemis

See Also

MSImagingExperiment, peakPick, peakAlign, peakFilter, reduceDimension, pixelApply, process

Page 68: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

68 peakPick-methods

Examples

register(SerialParam())

set.seed(2)data <- simulateImage(preset=1, npeaks=10, dim=c(3,3))data <- data[,pData(data)$circle]ref <- mz(metadata(data)$design$featureData)

# queue peak binningdata <- peakBin(data, ref=ref, type="height")

# apply peak binningdata_peaks <- process(data, plot=interactive())

peakPick-methods Peak pick an imaging dataset

Description

Apply peak picking to a mass spectrometry imaging dataset.

Usage

## S4 method for signature 'MSImagingExperiment'peakPick(object, method = c("mad", "simple", "adaptive"), ...)

## S4 method for signature 'MSImageSet'peakPick(object, method = c("simple", "adaptive", "limpic"),

...,pixel = pixels(object),plot = FALSE)

## Local maxima and SNR with noise based on local MADpeakPick.mad(x, SNR=6, window=5, blocks=1, fun=mean, tform=diff, ...)

## Local maxima and SNR with constant noise based on SDpeakPick.simple(x, SNR=6, window=5, blocks=100, ...)

## Local maxima and SNR with adaptive noise based on SDpeakPick.adaptive(x, SNR=6, window=5, blocks=100, spar=1, ...)

## LIMPIC peak detectionpeakPick.limpic(x, SNR=6, window=5, blocks=100, thresh=0.75, ...)

Arguments

object An imaging dataset.

method The peak picking method to use.

pixel The pixels to peak pick. If less than the extent of the dataset, this will result in asubset of the data being processed.

plot Plot the mass spectrum for each pixel while it is being processed?

Page 69: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

peakPick-methods 69

... Additional arguments passed to the peak picking method.

x The mass spectrum to be peak picked.

SNR The minimum signal-to-noise ratio to be considered a peak.

window The window width for seeking local maxima.

blocks The number of blocks in which to divide the mass spectrum in order to calculatethe noise.

fun The function used to estimate centrality and average absolute deviation.

tform A transformation to be applied to the mass spectrum before estimating noise.

spar Smoothing parameter for the spline smoothing applied to the spectrum in orderto decide the cutoffs for throwing away false noise spikes that might occur insidepeaks.

thresh The thresholding quantile to use when comparing slopes in order to throw awaypeaks that are too flat.

Details

Peak picking is usually performed using the provided functions, but a user-created function can alsobe passed to method. In this case it should take the following arguments:

• x: A numeric vector of intensities.

• ...: Additional arguments.

When applied to an MSImagingExperiment object, a user-created function should return a integervector giving the indices of the detected peaks.

When applied to an MSImageSet object, a user-created function should return a list with twovectors of the same length as x:

• peaks: A logical vector indicating peaks.

• noise: A numeric vector with the estimated noise.

Internally, pixelApply is used to apply the peak picking. See its documentation page for moredetails on additional objects available to the environment installed to the peak picking function.

Value

An object of the same class with the peak picked spectra. Note that the full mass range is retainedand the peaks are unaligned, so peakAlign should be called before applying further methods.

Author(s)

Kylie A. Bemis

References

Mantini, D., Petrucci, F., Pieragostino, D., Del Boccio, P., Di Nicola, M., Di Ilio, C., et al. (2007).LIMPIC: a computational method for the separation of protein MALDI-TOF-MS signals fromnoise. BMC Bioinformatics, 8(101), 101. doi:10.1186/1471-2105-8-101

See Also

MSImagingExperiment, MSImageSet, peakAlign, peakFilter, peakBin, reduceDimension, pixelApply,process

Page 70: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

70 pixelApply-methods

Examples

register(SerialParam())

set.seed(2)data <- simulateImage(preset=1, npeaks=10, dim=c(3,3))data <- data[,pData(data)$circle]

# queue peak pickingdata <- peakPick(data, method="simple", SNR=6)

# apply peak pickingdata_peaks <- process(data, plot=interactive())

pixelApply-methods Apply functions over imaging datasets

Description

Apply an existing or a user-specified function over either all of the features or all of the pixels of aSparseImagingExperiment or SImageSet. These are provided by analogy to the ’apply’ family offunctions, but allowing greater efficiency and convenience when applying functions over an imagingdataset.

Usage

#### Methods for Cardinal >= 2.x classes ####

## S4 method for signature 'SparseImagingExperiment'pixelApply(.object, .fun, ...,

.blocks = FALSE,

.simplify = TRUE,

.use.names = TRUE,

.outpath = NULL,BPREDO = list(),BPPARAM = bpparam())

## S4 method for signature 'SparseImagingExperiment'featureApply(.object, .fun, ...,

.blocks = FALSE,

.simplify = TRUE,

.use.names = TRUE,

.outpath = NULL,BPREDO = list(),BPPARAM = bpparam())

## S4 method for signature 'SparseImagingExperiment'spatialApply(.object, .r, .fun, ...,

.dist = "chebyshev",

.blocks = FALSE,

.simplify = TRUE,

.use.names = TRUE,

Page 71: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

pixelApply-methods 71

.outpath = NULL,

.params = NULL,

.init = NULL,BPREDO = list(),BPPARAM = bpparam())

#### Methods for Cardinal 1.x classes ####

## S4 method for signature 'SImageSet'pixelApply(.object, .fun, ...,

.pixel,

.feature,

.feature.groups,

.pixel.dependencies,

.simplify = TRUE,

.use.names = TRUE,

.verbose = FALSE)

## S4 method for signature 'SImageSet'featureApply(.object, .fun, ...,

.feature,

.pixel,

.pixel.groups,

.feature.dependencies,

.simplify = TRUE,

.use.names = TRUE,

.verbose = FALSE)

Arguments

.object An imaging dataset.

.fun The function to be applied.

.r The maximum spatial radius or distance for which pixels are considered to beneighbors.

... Additional arguments passed to .fun.

.dist The type of distance metric to use when calculating neighboring pixels basedon r. The options are ‘radial’, ‘manhattan’, ‘minkowski’, and ‘chebyshev’ (thedefault).

.blocks If FALSE (the default), each feature-vector or image-vector will be loaded andprocessed individually. If TRUE, or a positive integer, the data will be split intothat many blocks, and the function (specified by .fun) will be applied to eachblock. The number of blocks can be specified as a number, or getOption("Cardinal.nblocks")will be used.

.simplify If applying over blocks, then a function to be used to simplify the list of results.Otherwise, a logical value giving whether the results should be simplified into amatrix or array rather than a list.

.use.names Should the names of elements of .object (either pixel names or feature names,as appropriate) be used for the names of the result?

.outpath The path to a file where the output data will be written. Results will be keptin-memory if this is NULL. Results will be coerced to a numeric vector beforebeing written to file.

Page 72: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

72 pixelApply-methods

.params A list of parameters with length equal to length(.object). The appropriateelements will be made available to the spatial neighborhoods.

.init The initialization for the spatial neighbors and spatial blocks. If TRUE, thenthe result will have an attribute attr(ans,"init") that can be used as input to.init in future calls to avoid re-calculating spatial neighbors and spatial blocks.

BPREDO See documentation for bplapply.

BPPARAM An optional instance of BiocParallelParam. See documentation for bplapply.

.pixel A subset of pixels to use, given by an integer vector of numeric indices, acharacter vector of pixel names, or a logical vector indicating which pixelsto use.

.feature A subset of features to use, given in the same manner as pixels.

.pixel.groups A grouping factor or a vector that can be coerced into a factor, that indicatesgroups of pixels over which the function should be applied. Groups pixels aretreated as cells in a ragged array, by analogy to the tapply function.

.feature.groups

A grouping factor features, in the same manner as for pixels..pixel.dependencies

Not currently used. This may be used in the future to allow caching when ap-plying functions to data on disk.

.feature.dependencies

Not currently used. May be used for caching in the future.

.verbose Used for debugging. Currently ignored.

Details

#### For SparseImagingExperiment-derived classes ####

For pixelApply, the function is applied to the feature vector(s) belonging to pixel(s).

For featureApply, the function is applied to the vector(s) of intensity values (i.e., the flattenedimage) corresponding to the feature(s).

For spatialApply, the function is applied to neighborhoods of feature-vectors corresponding toneighboring pixels. The maximum distance in each dimension for a pixel to be considered a neigh-bor is given by .r. The first argument to .fun is a matrix of column-vectors.

If .blocks is provided (either TRUE or a positive integer), then the data is split into blocks be-forehand, and entire blocks are loaded and passed to the function as a matrix of column-vectors.Otherwise, single vectors are passed to the function individually. If blocks are used, then .simplifyshould be a function that simplifies a list of results.

Note that for spatialApply (only), if blocks are used, the result is NOT guaranteed to be in thecorrect order; instead the result will have a attr(ans,"idx") attribute giving the proper order(pixel IDs) of the results, and the .simplify function should likely re-order the results.

The following attributes are assigned to the object passed to .fun, accessible via attr():

• idx: The indices of the current pixel(s) or feature(s).

• mcols: Either featureData(.object) for pixelApply or pixelData(.object) for featureApply.

• by: A string giving either "pixel" for pixelApply or "feature" for featureApply. This at-tribute is to facilitate determining whether this is a call to pixelApply or featureApplywithin methods that may select one or the other to use depending on the internal data struc-ture.

Page 73: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

pixelApply-methods 73

Additionally, the following attributes are made available during a call to spatialyApply():

• centers: A vector indicating which column(s) should be considered the center(s) of the neigh-borhood(s).

• neighbors: A list of vectors indicating which column(s) should be considered the neighbor-hoods. Only relevant if using .blocks.

• offsets: A matrix where the rows are the spatial offsets of the pixels in the neighborhood(s)from the center pixel(s).

• params: The relevant list elements of the .params argument.

#### For SImageSet-derived classes ####

The use of .pixel and .feature can be used to apply the function over only a subset of pixels orfeatures (or both), allowing faster computation when calculation on only a subset of data is needed.

For pixelApply, the function is applied to the feature vector belonging to each pixel. The use of.feature.groups allows codetapply-like functionality on the feature vectors, applied separately toeach pixel.

For featureApply, the function is applied to the vector of intensity values (i.e., the flattened image)corresponding to each feature. The use of .feature.groups allows codetapply-like functionalityon the flattened image intensity vectors, applied separately to each feature.

The fData from .object is installed into the environment of .fun for pixelApply, and the pDatafrom .object is installed into the environment of .fun for featureApply. This allows access tothe symbols from fData or pData during the execution of .fun. If .fun already has an environment,it is retained as the parent of the installed environment.

Additionally, the following objects are made available by installing them into the .fun environment:

• .Object: The passed .object. (Note the case.)• .Index: The index of the current iteration.

Value

If .simplify = FALSE, a list. Otherwise, a vector or matrix, or a higher-dimensional array if group-ing is specified, or the output of the provided .simplify function.

Author(s)

Kylie A. Bemis

See Also

MSImagingExperiment, MSImageSet

Examples

register(SerialParam())

set.seed(2)data <- simulateImage(preset=1, npeaks=10, dim=c(10,10))

# calculate TIC for each pixeltic <- pixelApply(data, sum)

# calculate mean spectrumms <- featureApply(data, mean)

Page 74: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

74 plot-methods

plot-methods Plot a signal from the feature data of an imaging dataset

Description

Create and display plots for the feature data of an imaging dataset using a formula interface.

Usage

#### Methods for Cardinal >= 2.x classes ####

## S4 method for signature 'DataFrame,ANY'plot(x, y, ...)

## S4 method for signature 'XDataFrame,missing'plot(x, formula,

groups = NULL,superpose = FALSE,strip = TRUE,key = superpose || !is.null(groups),...,xlab, xlim,ylab, ylim,layout,col = discrete.colors,breaks = "Sturges",grid = FALSE,jitter = FALSE,subset = TRUE,add = FALSE)

## S4 method for signature 'MassDataFrame,missing'plot(x, ..., type = if (isCentroided(x)) "h" else "l")

## S4 method for signature 'SparseImagingExperiment,missing'plot(x, formula,

pixel,pixel.groups,groups = NULL,superpose = FALSE,strip = TRUE,key = superpose || !is.null(groups),fun = mean,hline = 0,...,xlab, xlim,ylab, ylim,layout,col = discrete.colors,grid = FALSE,

Page 75: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

plot-methods 75

subset = TRUE,add = FALSE)

## S4 method for signature 'MSImagingExperiment,missing'plot(x, formula,

pixel = pixels(x, coord=coord, run=run),pixel.groups,coord,run,plusminus,...,xlab, ylab,type = if ( is_centroided ) 'h' else 'l')

## S4 method for signature 'SparseImagingResult,missing'plot(x, formula,

model = modelData(x),superpose = is_matrix,...,column,xlab, ylab,type = 'h')

## S4 method for signature 'PCA2,missing'plot(x, formula,

values = "loadings", ...)

## S4 method for signature 'PLS2,missing'plot(x, formula,

values = c("coefficients", "loadings", "weights"), ...)

## S4 method for signature 'SpatialFastmap2,missing'plot(x, formula,

values = "correlation", ...)

## S4 method for signature 'SpatialKMeans2,missing'plot(x, formula,

values = c("centers", "correlation"), ...)

## S4 method for signature 'SpatialShrunkenCentroids2,missing'plot(x, formula,

values = c("centers", "statistic", "sd"), ...)

## S4 method for signature 'SpatialDGMM,missing'plot(x, model = modelData(x),

values = "density", type = 'l', ...)

## S4 method for signature 'MeansTest,missing'plot(x, model = modelData(x),

values = "fixed", ...)

## S4 method for signature 'SegmentationTest,missing'

Page 76: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

76 plot-methods

plot(x, model = modelData(x),values = "fixed", ...)

## S4 method for signature 'AnnotatedImage,ANY'plot(x, breaks = "Sturges",

key = TRUE, col,add = FALSE, ...)

## S4 method for signature 'AnnotatedImageList,ANY'plot(x, i, breaks = "Sturges",

strip = TRUE,key = TRUE, col,layout = !add,add = FALSE, ...)

## S4 method for signature 'AnnotatedImagingExperiment,ANY'plot(x, i, ...)

#### Methods for Cardinal 1.x classes ####

## S4 method for signature 'SImageSet,missing'plot(x, formula = ~ Feature,

pixel,pixel.groups,groups = NULL,superpose = FALSE,strip = TRUE,key = FALSE,fun = mean,...,xlab,xlim,ylab,ylim,layout,type = 'l',col = "black",subset = TRUE,lattice = FALSE)

## S4 method for signature 'MSImageSet,missing'plot(x, formula = ~ mz,

pixel = pixels(x, coord=coord),pixel.groups,coord,plusminus,...,type = if (centroided(x)) 'h' else 'l')

## S4 method for signature 'ResultSet,missing'plot(x, formula,

model = pData(modelData(x)),

Page 77: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

plot-methods 77

pixel,pixel.groups,superpose = TRUE,strip = TRUE,key = superpose,...,xlab,ylab,column,col = if (superpose) rainbow(nlevels(pixel.groups)) else "black",lattice = FALSE)

## S4 method for signature 'CrossValidated,missing'plot(x, fold = 1:length(x), layout, ...)

## S4 method for signature 'PCA,missing'plot(x, formula = substitute(mode ~ mz),

mode = "loadings",type = 'h',...)

## S4 method for signature 'PLS,missing'plot(x, formula = substitute(mode ~ mz),

mode = c("coefficients", "loadings","weights", "projection"),

type = 'h',...)

## S4 method for signature 'OPLS,missing'plot(x, formula = substitute(mode ~ mz),

mode = c("coefficients", "loadings", "Oloadings","weights", "Oweights", "projection"),

type = 'h',...)

## S4 method for signature 'SpatialFastmap,missing'plot(x, formula = substitute(mode ~ mz),

mode = "correlation",type = 'h',...)

## S4 method for signature 'SpatialShrunkenCentroids,missing'plot(x, formula = substitute(mode ~ mz),

mode = c("centers", "tstatistics"),type = 'h',...)

## S4 method for signature 'SpatialKMeans,missing'plot(x, formula = substitute(mode ~ mz),

mode = c("centers", "betweenss", "withinss"),type = 'h',...)

Page 78: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

78 plot-methods

Arguments

x An imaging dataset.

formula, y A formula of the form ’y ~ x | g1 * g2 * ...’ (or equivalently, ’y ~ x | g1 + g2 +...’), indicating a LHS ’y’ (on the y-axis) versus a RHS ’x’ (on the x-axis) andconditioning variables ’g1, g2, ...’.Usually, the LHS is not supplied, and the formula is of the form ’~ x | g1 * g2 *...’, and the y-axis is implicityl assumed to be the feature vectors correspondingto each pixel in the imaging dataset specified by the object ’x’. However, avariable evaluating to a feature vector, or a sequence of such variables, can alsobe supplied.The RHS is evaluated in fData(x) and should provide values for the x-axis.The conditioning variables are evaluated in pData(x). These can be specifiedin the formula as ’g1 * g2 * ...’. The argument ’pixel.groups’ allows an alternateway to specify a single conditioning variable. Conditioning variables specifiedusing the formula interface will always appear on separate plots. This can becombined with ’superpose = TRUE’ to both overlay plots based on a condition-ing variable and use conditioning variables to create separate plots.

coord A named vector or list giving the coordinate(s) of the pixel(s) to plot.

run A character, factor, or integer vector giving the run(s) of the pixel(s) to plot.

plusminus If specified, a window of pixels surrounding the one given by coord will beincluded in the plot with fun applied over them, and this indicates the numberof pixels to include on either side.

pixel The pixel or vector of pixels for which to plot the feature vectors. This is anexpression that evaluates to a logical or integer indexing vector.

pixel.groups An alternative way to express a single conditioning variable. This is a variable orexpression to be evaluated in pData(x), expected to act as a grouping variablefor the pixels specified by ’pixel’, typically used to distinguish different regionsof the imaging data for comparison. Feature vectors from pixels in the samepixel group will have ’fun’ applied over them; ’fun’ will be applied to eachpixel group separately, usually for averaging. If ’superpose = FALSE’ then theseappear on separate plots.

groups A variable or expression to be evaluated in fData(x), expected to act as a group-ing variable for the features in the feature vector(s) to be plotted, typically usedto distinguish different groups of features by varying graphical parameters likecolor and line type. By default, if ’superpose = FALSE’, these appear overlaidon the same plot.

superpose Should feature vectors from different pixel groups specified by ’pixel.groups’be superposed on the same plot?

strip Should strip labels indicating the plotting group be plotting along with the eachpanel? Passed to ’strip’ in xyplot.

key A logical, or list containing components to be used as a key for the plot. Thisis passed to ’key’ in levelplot if ’lattice = TRUE’.

fun A function to apply over feature vectors grouped together by ’pixel.groups’. Bydefault, this is used for averaging over pixels.

hline The y-value(s) for a horizontal reference line(s).

xlab Character or expression giving the label for the x-axis.

ylab Character or expression giving the label for the x-axis.

Page 79: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

plot-methods 79

xlim A numeric vector of length 2 giving the left and right limits for the x-axis.

ylim A numeric vector of length 2 giving the lower and upper limits for the y-axis.

layout The layout of the plots, given by a length 2 numeric as c(ncol,nrow). This ispassed to levelplot if ’lattice = TRUE’. For base graphics, this defaults to oneplot per page.

col A specification for the default plotting color(s).

type A character indicating the type of plotting.

grid Should a grid be added to the plot?

jitter Should a small amount of noise be added to numeric variables before plottingthem?

breaks The number of breaks when plotting a histogram.

subset An expression that evaluates to a logical or integer indexing vector to be evalu-ated in fData(x).

... Additional arguments passed to the underlying plot or xyplot functions.

i Which data element should be plotted.

fold What folds of the cross-validation should be plotted.

model A vector or list specifying which fitted model to plot. If this is a vector, itshould give a subset of the rows of modelData(x) to use for plotting. Otherwise,it should be a list giving the values of parameters in modelData(x).

mode What kind of results should be plotted. This is the name of the object to plot inthe ResultSet object.

values What kind of results should be plotted. This is the name of the object to plot inthe ImagingResult object. Renamed from mode to avoid ambiguity.

column What columns of the results should be plotted. If the results are a matrix, thiscorresponds to the columns to be plotted, which can be indicated either by nu-meric index or by name.

lattice Should lattice graphics be used to create the plot?

add Should the method call plot.new() or be added to the current plot?

Author(s)

Kylie A. Bemis

See Also

image

Examples

register(SerialParam())

set.seed(1)x <- simulateImage(preset=2, npeaks=10, dim=c(10,10))m <- mz(metadata(x)$design$featureData)

plot(x, pixel=23)plot(x, coord=c(x=3, y=3), plusminus=1)plot(x, coord=c(x=3, y=3), groups=mz > 1000)plot(x, coord=c(x=7, y=7), superpose=TRUE)

Page 80: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

80 PLS-methods

sm <- summarize(x, .stat=c("mean", "sd"), .as="DataFrame")

featureData(x)$mean <- sm$meanfeatureData(x)$sd <- sm$sd

plot(x, mean + I(-sd) ~ mz, superpose=TRUE)

PLS-methods Partial least squares

Description

Performs partial least squares (also called projection to latent structures or PLS) on an imagingdataset. This will also perform discriminant analysis (PLS-DA) if the response is a factor. Or-thogonal partial least squares options (O-PLS and O-PLS-DA) are also available.

Usage

## S4 method for signature 'SparseImagingExperiment,ANY'PLS(x, y, ncomp = 3, method = c("pls", "opls"),

center = TRUE, scale = FALSE,iter.max = 100, ...)

## S4 method for signature 'SparseImagingExperiment,ANY'OPLS(x, y, ncomp = 3, ...)

## S4 method for signature 'PLS2'predict(object, newx, newy, ncomp, ...)

## S4 method for signature 'PLS2'fitted(object, ...)

## S4 method for signature 'PLS2'summary(object, ...)

## S4 method for signature 'SImageSet,matrix'PLS(x, y, ncomp = 3,

method = "nipals",center = TRUE,scale = FALSE,iter.max = 100, ...)

## S4 method for signature 'SImageSet,ANY'PLS(x, y, ...)

## S4 method for signature 'SImageSet,matrix'OPLS(x, y, ncomp = 3,

method = "nipals",center = TRUE,scale = FALSE,

Page 81: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

PLS-methods 81

keep.Xnew = TRUE,iter.max = 100, ...)

## S4 method for signature 'SImageSet,ANY'OPLS(x, y, ...)

## S4 method for signature 'PLS'predict(object, newx, newy, ...)

## S4 method for signature 'OPLS'predict(object, newx, newy, keep.Xnew = TRUE, ...)

Arguments

x The imaging dataset on which to perform partial least squares.

y The response variable, which can be a matrix or a vector for ordinary PLS, ora factor or a character for PLS-DA.

ncomp The number of PLS components to calculate.

method The function used to calculate the projection.

center Should the data be centered first? This is passed to scale.

scale Shoud the data be scaled first? This is passed to scale.

iter.max The number of iterations to perform for the NIPALS algorithm.

... Passed to the next PLS method.

object The result of a previous call to PLS.

newx An imaging dataset for which to calculate their PLS projection and predict aresponse from an already-calculated PLS object.

newy Optionally, a new response from which residuals should be calcualted.

keep.Xnew Should the new data matrix be kept after filtering out the orthogonal variation?

Value

An object of class PLS2, which is a ImagingResult, or an object of class PLS, which is a ResultSet.Each elemnt of resultData slot contains at least the following components:

fitted: The fitted response.

loadings: A matrix with the explanatory variable loadings.

weights: A matrix with the explanatory variable weights.

scores: A matrix with the component scores for the explanatary variable.

Yscores: A matrix objects with the component scores for the response variable.

Yweights: A matrix objects with the response variable weights.

coefficients: The matrix of the regression coefficients.

The following components may also be available for classes OPLS and OPLS2.

Oloadings: A matrix objects with the orthogonal explanatory variable loadings.

Oweights: A matrix with the orthgonal explanatory variable weights.

If y is a categorical variable, then a categorical class prediction will also be available in additionto the fitted numeric response.

Page 82: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

82 PositionDataFrame-class

Author(s)

Kylie A. Bemis

References

Trygg, J., & Wold, S. (2002). Orthogonal projections to latent structures (O-PLS). Journal ofChemometrics, 16(3), 119-128. doi:10.1002/cem.695

See Also

PCA, spatialShrunkenCentroids,

Examples

register(SerialParam())

set.seed(1)x <- simulateImage(preset=2, npeaks=10, dim=c(10,10),

snoise=1, sdpeaks=1, representation="centroid")

y <- makeFactor(circle=pData(x)$circle, square=pData(x)$square)

pls <- PLS(x, y, ncomp=1:3)

summary(pls)

opls <- OPLS(x, y, ncomp=1:3)

summary(pls)

PositionDataFrame-class

PositionDataFrame: data frame with spatial position metadata

Description

An PositionDataFrame is an extension of the XDataFrame class with special slot-columns forspatial coordinates. It is designed specifically with biological imaging experiments in mind, so italso has an additional slot-column for tracking the experimental run.

Usage

PositionDataFrame(coord, run, ..., row.names = NULL, check.names = TRUE)

Arguments

coord A data.frame-like object containing columns which are spatial coordinates.This will be coerced to a DataFrame.

run A factor with levels for each experimental run.... Named arguments that will become columns of the object.row.names Row names to be assigned to the object; no row names are assigned if this is

NULL.check.names Should the column names be checked for syntactic validity?

Page 83: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

PositionDataFrame-class 83

Details

PositionDataFrame is designed for spatial data, specifically for biological imaging data. It in-cludes a slot-column for the experimental run. In most 2D imaging experiments, each distinctimage is considered a distinct run. No additional assumptions are made about the spatial structureof the data, and non-gridded spatial coordinates are allowed.

This class is intended to eventually replace the IAnnotatedDataFrame class, and implements sim-ilar concepts but with a more robust and modern infrastructure.

Methods

run(object), run(object) <- value: Get or set the experimental run slot-column.

runNames(object), runNames(object) <- value: Get or set the experimental run levels.

coord(object), coord(object) <- value: Get or set the spatial position slot-columns.

coordLabels(object), coordLabels(object) <- value: Get or set the names of the spatial po-sition slot-columns.

gridded(object), gridded(object) <- value: Get or set whether the spatial positions are grid-ded or not. Typically, this should not be set manually.

resolution(object), resolution(object) <- value: Get or set the spatial resolution of thespatial positions. Typically, this should not be set manually.

dims(object): Get the gridded dimensions of the spatial positions (i.e., as if projected to an imageraster).

is3D(object): Check if the data is 3D or not.

as.list(x, ..., slots = TRUE): Coerce the object to a list, where the slot-columns are in-cluded by default. Use slots=FALSE to exclude the slot-columns.

Author(s)

Kylie A. Bemis

See Also

XDataFrame

Examples

## Create an PositionDataFrame objectcoord <- expand.grid(x=1:3, y=1:3)values <- seq_len(nrow(coord))pdata <- PositionDataFrame(coord=coord, values=values)

## Check the spatial propertiesgridded(pdata)resolution(pdata)dims(pdata)

Page 84: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

84 process-methods

process-methods Delayed Processing of Imaging Datasets

Description

Queue pre-processing steps on an imaging dataset and apply them, possibly writing out the pro-cessed data to a file.

Usage

## S4 method for signature 'MSImagingExperiment'process(object, ..., delay = FALSE,

outpath = NULL, imzML = FALSE)

## S4 method for signature 'SparseImagingExperiment'process(object, fun, ...,

kind = c("pixel", "feature", "global"),moreargs = NULL,prefun, preargs,postfun, postargs,plotfun,label = "",delay = FALSE,plot = FALSE,par = NULL,outpath = NULL,BPPARAM = bpparam())

Arguments

object An imaging dataset.fun A function to apply to each feature-vector or image-vector.... Additional arguments to fun.delay Should the function fun be applied now, or queued and delayed until process()

is called again?outpath The path to a file where the results will be written by pixelApply or featureApply.

If NULL, then the results are returned in-memory.imzML Should the output file be an imzML file? Note: some processing methods are

not be supported with this option.kind What kind of processing to perform? Over pixels, over features, or global pro-

cessing of the dataset as a single unit.moreargs Additional arguments to be passed to fun. This is primarily useful if some of

the arguments to fun conflict with arguments to process.prefun A pre-processing function to be applied to the entire dataset, taking the dataset

as its first argument. This should return another object of the same class.preargs Additional arguments to prefun, as a list.postfun A post-processing function to be applied to the output, taking the result as its

first argument, and the original dataset as its second argument. This shouldreturn another object of the same class as the original dataset.

Page 85: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

process-methods 85

postargs Additional arguments to postfun, as a list.

plotfun A function to be used to plot the output of fun, taking at least two arguments:(1) the resulting vector and (2) the input vector.

label The label of the processing step. This is used to identify it in the queue, and isprinted as it is being processed.

plot Plot the function for each pixel or feature while it is being processed? Onlypossible if BPPARAM=SerialParam().

par Plotting parameters to be passed to plotfun.

BPPARAM An optional instance of BiocParallelParam. See documentation for bplapply.

Details

This method allows queueing of delayed processing to an imaging dataset. All of the registeredprocessing steps will be applied in sequence whenever process() is called next with delay=FALSE.The processing can be over feature-vectors (e.g., mass spectra), over image-vectors, or over theentire dataset as a unit. The processing is performed in parallel using the current registered parallelbackend.

The method for MSIMagingExperiment allows writing the output directly to an imzML file, withcertain restrictions. Some pre-processing methods are not supported with this option, and the ex-periment must not contain multiple runs.

Value

An object of the same class (or subclass) as the original imaging dataset, with the data processingqueued or applied.

Author(s)

Kylie A. Bemis

See Also

SparseImagingExperiment, MSImagingExperiment, pixelApply, featureApply, normalize,smoothSignal, reduceBaseline, peakPick, peakAlign, peakFilter, peakBin

Examples

register(SerialParam())

set.seed(2)data <- simulateImage(preset=1, dim=c(10,10), baseline=1)data_c <- data[,pData(data)$circle]

tmp <- process(data, function(s) log2(abs(s)))

tmp1 <- process(data, abs, delay=TRUE)

tmp2 <- process(tmp1, log2, delay=TRUE)

process(tmp2)

Page 86: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

86 readMSIData

readMSIData Read mass spectrometry imaging data files

Description

Read supported mass spectrometry imaging data files. Supported formats include imzML and An-alyze 7.5.

Usage

## Read any supported MS imaging filereadMSIData(file, ...)

## Read imzML filesreadImzML(name, folder = getwd(), attach.only = TRUE,mass.range = NULL, resolution = NA, units = c("ppm", "mz"),as = c("MSImagingExperiment", "MSImageSet"), parse.only = FALSE,BPPARAM = bpparam(), ...)

## Read Analyze 7.5 filesreadAnalyze(name, folder = getwd(), attach.only = TRUE,as = c("MSImagingExperiment", "MSImageSet"), ...)

Arguments

file A description of the data file to be read. This may be either an absolute orrelative path. The file extension must be included.

name The common (base) file name for the ’.imzML’ and ’.ibd’ files for imzML or forthe ’.hdr’, ’.t2m’, and ’.img’ files for Analyze 7.5.

folder The path to the folder containing the data files.attach.only Attach the file as a matter on-disk matrix for reading on-demand, rather than

loading the data into memory.mass.range For ’processed’ imzML files, the mass range to use for the imported data. If

known, providing this can improve the loading time dramatically, as otherwiseit is calculated from reading the dataset directly.

resolution For ’processed’ imzML files, the accuracy to which the m/z values will bebinned after reading. For units="ppm", this is the half-binwidth, and should beset to the native accuracy of the mass spectrometer, if known. For units="mz",this is simply the step size between m/z bins. If this is NA, then automaticallyguess a resolution from the data.

units The units for resolution. Either parts-per-million or absolute m/z units.as After reading in the data, what class of object should be returned (MSImageSet

or MSImagingExperiment)?parse.only If TRUE, return only the parsed imzML metadata without creating a new imag-

ing experiment object. (May be useful for diagnosing import problems.)BPPARAM An optional instance of BiocParallelParam. See documentation for bplapply.

This is only used when mass.range=NULL and attach.only=TRUE, when read-ing the mass range from the m/z data of a "processed" imzML file.

... Additional arguments passed to read functions.

Page 87: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

reduceBaseline-methods 87

Details

In the current implementation, the file extensions must match exactly: ’.imzML’ and ’.ibd’ forimzML and ’.hdr’, ’.t2m’, and ’.img’ for Analyze 7.5.

The readImzML function supports reading and returning both the ’continuous’ and ’processed’ for-mats.

When attach.only=TRUE, the data is not loaded into memory; only the experimental metadata isread, and the intensity data will only be accessed on-demand. For large datasets, this is memory-efficient. For smaller datasets, this may be slower than simply reading the entire dataset into mem-ory.

If the mass range is known, setting mass.range will make reading data much faster for very largedatasets.

If problems are encountered while trying to import imzML files, the files should be verified and fixedwith the Java-based imzMLValidator application: https://gitlab.com/imzML/imzMLValidator/.

Value

A MSImageSet object.

Author(s)

Kylie A. Bemis

References

Schramm T, Hester A, Klinkert I, Both J-P, Heeren RMA, Brunelle A, Laprevote O, Desbenoit N,Robbe M-F, Stoeckli M, Spengler B, Rompp A (2012) imzML - A common data format for theflexible exchange and processing of mass spectrometry imaging data. Journal of Proteomics 75(16):5106-5110. doi:10.1016/j.jprot.2012.07.026

See Also

writeMSIData

reduceBaseline-methods

Reduce the baseline for an imaging dataset

Description

Apply baseline reduction to the feature vectors of an imaging dataset.

Usage

## S4 method for signature 'SparseImagingExperiment'reduceBaseline(object, method = c("locmin", "median"), ...)

## S4 method for signature 'MSImageSet'reduceBaseline(object, method = "median",

...,pixel = pixels(object),

Page 88: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

88 reduceBaseline-methods

plot = FALSE)

## Local minima baseline reductionreduceBaseline.locmin(x, window=5, ...)

## Interpolated median baseline reductionreduceBaseline.median(x, blocks=500, fun=median, spar=1, ...)

Arguments

object An imaging dataset.

method The baseline reduction method to use.

pixel The pixels to baseline subtract. If less than the extent of the dataset, this willresult in a subset of the data being processed.

plot Plot each pixel while it is being processed?

... Additional arguments passed to the baseline reduction method.

x The signal to be baseline-corrected.

blocks The number of intervals to break the mass spectrum into in order to chooseminima or medians from which to interpolate the baseline.

fun Function used to determine the points from which the baseline will be interpo-lated.

spar Smoothing parameter for the spline smoothing applied to the spectrum in orderto decide the cutoffs for throwing away baseline references that might occurinside peaks.

window The sliding window (number of data points) to consider when determining thelocal minima.

Details

Baseline reduction is usually performed using the provided functions, but a user-created functioncan also be passed to method. In this case it should take the following arguments:

• x: A numeric vector of intensities.

• ...: Additional arguments.

A user-created function should return a numeric vector of the same length. with the baseline-subtracted intensities.

Internally, pixelApply is used to apply the baseline reduction. See its documentation page formore details on additional objects available to the environment installed to the baseline reductionfunction.

Value

An object of the same class with the baseline-subtracted spectra.

Author(s)

Kylie A. Bemis

Page 89: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

reduceDimension-methods 89

See Also

MSImagingExperiment, MSImageSet, pixelApply, process

Examples

register(SerialParam())

set.seed(2)data <- simulateImage(preset=1, npeaks=10, dim=c(3,3), baseline=1)data <- data[,pData(data)$circle]

# queue baseline reductiondata <- reduceBaseline(data, method="median", blocks=100)

# apply baseline reductiondata_nobaseline <- process(data, plot=interactive())

reduceDimension-methods

Reduce the dimension of an imaging dataset

Description

Apply dimension reduction to a mass spectrometry imaging dataset.

Usage

## S4 method for signature 'MSImageSet,missing'reduceDimension(object, method = c("bin", "resample"),

...,pixel = pixels(object),plot = FALSE)

## S4 method for signature 'MSImageSet,numeric'reduceDimension(object, ref, method = "peaks", ...)

## S4 method for signature 'MSImageSet,MSImageSet'reduceDimension(object, ref, method = "peaks", ...)

## Bin the signalreduceDimension.bin(x, t, width=200, offset=0, units=c("ppm","mz"), fun=sum, ...)

## Resample the signalreduceDimension.resample(x, t, step=1, offset=0, ...)

## Reduce the signal to peaksreduceDimension.peaks(x, t, peaklist, type=c("area", "height"), ...)

Page 90: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

90 reduceDimension-methods

Arguments

object An object of class MSImageSet.

ref A reference to use to reduce the dimension, usually a peak list of m/z values ora peak-picked and aligned MSImageSet.

method The method to use to reduce the dimensions of the signal.

pixel The pixels to process. If less than the extent of the dataset, this will result in asubset of the data being processed.

plot Plot the mass spectrum for each pixel while it is being processed?

... Additional arguments passed to the dimension reduction method.

x The mass spectrum to be reduced.

t The corresponding m/z values.

width The width of a bin.

step The step size.

offset Offset from the nearest integer.

units Either parts-per-million or the raw m/z values.

fun The function to be applied to each bin.

peaklist A numeric vector giving the m/z values of the reference peaks.

type Should the peak height or area under the curve be taken as the intensity value?

Details

Dimension reduction is usually performed using the provided functions, but a user-created functioncan also be passed to method. In this case it should take the following arguments:

• x: A numeric vector of intensities.

• t: A numeric vector of m/z values.

• tout: A numeric vector of m/z values to output.

• ...: Additional arguments.

The optional argument tout was added in version 1.3.1 to avoid cases where the output m/z valuesmay be costly and inefficient to re-calculate for every spectrum.

A user-created function should return a list with two vectors of equal length, where the new lengthmust be shorter than x and t:

• x: A numeric vector of new intensities.

• t: A numeric vector of new m/z values.

Internally, pixelApply is used to apply the dimension reduction. See its documentation page formore details on additional objects available to the environment installed to the dimension reductionfunction.

Value

An object of class MSImageSet with the dimension-reduced spectra.

Author(s)

Kylie A. Bemis

Page 91: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

reexports 91

See Also

MSImageSet, peakPick, peakAlign, pixelApply

reexports Objects exported from other packages

Description

These objects are imported from other packages and have been re-exported by Cardinal for userconvenience.

maggritr: %>%

dplyr: group_by, ungroup, groups, collect

viridisLite: viridis, cividis, magma, inferno, plasma

ResultSet-class ResultSet: Class to contain analysis results for imaging experiments

Description

This class is used as a return value by most of the analysis methods provided by Cardinal, includingPCA, PLS, OPLS, spatialKMeans, spatialShrunkenCentroids.

Slots

imageData: This slot is unused in a ResultSet.

pixelData: The pixelData from the analyzed dataset.

featureData: The featureData from the analyzed dataset.

experimentData: The experimentData from the analyzed dataset.

protocolData: The protocolData from the analyzed dataset.

resultData: A list of analysis results. Each element contains the results from a different param-eter set.

modelData: An AnnotatedDataFrame containing information about the parameters of the modelsin resultData.

.__classVersion__: A Versions object describing the version of the class used to created theinstance. Intended for developer use.

Extends

iSet, directly. VersionedBiobase, by class "iSet", distance 1. Versioned, by class "Versioned-Biobase", distance 2.

Creating Objects

ResultSet is a virtual class. No instances can be created.

Page 92: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

92 selectROI-methods

Methods

Class-specific methods:

resultData(object): Access and set the results of the analyses.

modelData(object): Access and set the model parameters.

Standard generic methods:

length(x): Access the number of elements of resultData.

names(x): Access the names of the components of all of the elements of resultData.

ResultSet$name: Access all of the result components with the name name.

ResultSet[[i, ...]]: Access ith element of the resultData slot.

ResultSet[i, j, ..., drop]: Subset an ResultSet based on the model parameters in modelData.

See iSet for additional methods.

Author(s)

Kylie A. Bemis

See Also

iSet, PCA, PLS, OPLS, spatialKMeans, spatialShrunkenCentroids

selectROI-methods Select regions-of-interest of an imaging dataset

Description

Manually select regions-of-interest or pixels on an imaging dataset. The selectROI method usesthe built-in locator function. The method has the same form as the image method for plottingimaging datasets.

The results are returned as logical vectors indicating which pixels have been selected. These logicalvectors can be combined into factors using the makeFactor function.

Usage

## S4 method for signature 'SparseImagingExperiment'selectROI(object, ..., mode = c("region", "pixels"))

## S4 method for signature 'SImageSet'selectROI(object, formula = ~ x * y,

mode = c("region", "pixels"),...,main,subset = TRUE,lattice = FALSE)

makeFactor(..., ordered = FALSE)

Page 93: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

SImageData-class 93

Arguments

object An imaging dataset.formula Passed to image.mode What kind of selection to perform: ’region’ to select a region-of-interest, or

’pixels’ to select individual pixels.... Addtional arguments to be passed to image for selectROI, or name-value pairs

of logical vectors to be combined by makeFactor.ordered Should the resulting factor be ordered or not?main Passed to image.subset Passed to image.lattice Must be false.

Value

A logical vector of length equal to the number of pixels for selectROI.

A factor of the same length as the passed logical vectors for makeFactor.

Author(s)

Kylie A. Bemis

See Also

image

SImageData-class SImageData: Class containing sparse image data

Description

A container class for holding pixel-sparse image as a virtual datacube. It is assumed there will bemissing pixels, so the feature vectors are stored as a matrix for memory efficiency, and the datacubeis reconstructed on-the-fly. The implementation remains efficient even for non-sparse data as longas the full datacube does not need to be reconstructed as often as single images and feature vectors.All elements of data must have an identical number of rows (features) and columns (pixels).

Usage

## Instance creationSImageData(

data = Hashmat(nrow=0, ncol=0),coord = expand.grid(

x = seq_len(ncol(data)),y = seq_len(ifelse(ncol(data) > 0, 1, 0))),

storageMode = "immutableEnvironment",positionArray = generatePositionArray(coord),dimnames = NULL,...)

## Additional methods documented below

Page 94: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

94 SImageData-class

Arguments

data A matrix-like object with number of rows equal to the number of features andnumber of columns equal to the number of non-missing pixels. Each columnshould be a feature vector. Alternatively, a multidimensional array that repre-sents the datacube with the first dimension as the features can also be supplied.Additional dimensions could be the spatial dimensions of the image, for exam-ple.

coord A data.frame with columns representing the spatial dimensions. Each rowprovides a spatial coordinate for the location of a feature vector correspondingto a column in data. This argument is ignored if data is a multidimensionalarray rather than a matrix.

storageMode The storage mode to use for the SImageData object for the environment in thedata slot. Only "immutableEnvironment" is allowed for SImageData. Seedocumentation on the storageMode slot below for more details.

positionArray The positionArray for the imaging data. This should not normally be specifiedthe user, since it is generated automatically from the coord argument, unless forsome reason coord is not specified.

dimnames A list of length two, giving the feature names and pixel names in that order. Ifmissing, this is taken from the ’dimnames’ of the data argument.

... Additional Named arguments that are passed to the initialize method forinstantiating the object. These must be matrices or matrix-like objects of equaldimension to data. They will be assigned into the environment in the data slot.

Slots

data: An environment which contains at least one element named "iData", which is a matrix-like object with rows equal to the number of features and columns equal to the number ofnon-missing pixels. Each column is a feature vector.

coord: An data.frame with rows giving the spatial coordinates of the pixels corresponding to thecolumns of "iData".

positionArray: An array with dimensions equal to the spatial dimensions of the image, whichstores the column numbers of the feature vectors corresponding to the pixels in the "iData"element of the data slot. This allows re-construction of the imaging "datacube" on-the-fly.

dim: A length 2 integer vector analogous to the ’dim’ attribute of an ordinary R matrix.

dimnames: A length 2 list analogous to the ’dimnames’ attribute of an ordinary R matrix.

storageMode: A character which is one of "immutableEnvironment", "lockedEnvironment",or "environment". The values "lockedEnvironment" and "environment" behave as de-scribed in the documentation of AssayData. An "immutableEnvironment" uses a lockedenvironment while retaining R’s typical copy-on-write behavior. Whenever an object in animmutable environment is modified, a new environment is created for the data slot, and allobjects copied into it. This allows usual R functional semantics while avoiding copying oflarge objects when other slots are modified.

.__classVersion__: A Versions object describing the version of the class used to created theinstance. Intended for developer use.

Extends

Versioned

Page 95: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

SImageData-class 95

Creating Objects

SImageData instances are usually created through SImageData().

Methods

Class-specific methods:

iData(object), iData(object)<-: Return or set the matrix of image intensities. Columns shouldcorrespond to feature vectors, and rows should correspond to pixel vectors.

coord(object), coord(object)<-: Return or set the coodinates. This is a data.frame with eachrow corresponding to the spatial coordinates of a pixel.

positionArray(object), positionArray(object)<-: Return or set the positionArray slot.When setting, this should be an array returned by a call to generatePositionArray.

featureNames(object), featureNames(object) <- value: Access and set feature names (namesof the rows of the intensity matrix).

pixelNames(object), pixelNames(object) <- value: Access and set the pixel names (namesof the columns of the intensity matrix).

storageMode(object), storageMode(object)<-: Return or set the storage mode. See documen-tation on the storageMode slot above for more details.

Standard generic methods:

combine(x, y, ...): Combine two or more SImageData objects. Elements must be matrix-likeobjects and are combined column-wise with a call to ’cbind’. The numbers of rows mustmatch, but otherwise no checking of row or column names is performed. The pixel coordinatesare checked for uniqueness.

dim: Return the dimensions of the (virtual) datacube. This is equal to the number of features (thenumber of rows in the matrix returned by iData) and the dimensions of the positionArrayslot. For a standard imaging dataset, that is the number features followed by the spatial di-mensions of the image.

dims: A matrix where each column corresponds to the dimensions of the (virtual) datacubes storedas elements in the data slot. See above for how the dimensions are calculated.

SImageData[i, j, ..., drop]: Access intensities in the (virtual) imaging datacube. The dat-acube is reconstructed on-the-fly. The object can be indexed like any ordinary array withnumber of dimensions equal to dim(object). Use drop = NULL to return a subset of the sameclass as the object.

Author(s)

Kylie A. Bemis

See Also

ImageData, MSImageData, SImageSet, MSImageSet

Examples

## Create an SImageData objectSImageData()

## Using a P x N matrixdata1 <- matrix(1:27, nrow=3)

Page 96: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

96 SImageSet-class

coord <- expand.grid(x=1:3, y=1:3)sdata1 <- SImageData(data1, coord)sdata1[] # extract data as array

## Using a P x X x Y arraydata2 <- array(1:27, dim=c(3,3,3))sdata2 <- SImageData(data2)sdata2[] # should be identical to above

# Missing data from some pixelsdata3 <- matrix(1:9, nrow=3)sdata3 <- SImageData(data3, coord[c(1,5,9),])

dim(sdata3) # presents as an arrayiData(sdata3) # stored as matrixsdata3[] # recontruct the datacube

iData(sdata3)[,1] <- 101:103 # assign using iData()sdata3[] # can only assign into matrix representation

## Sparse feature vectorsdata4 <- Hashmat(nrow=9, ncol=9)sdata4 <- SImageData(data4, coord)iData(sdata4)[] <- diag(9)sdata4[1,,]

SImageSet-class SIMageSet: Class to contain pixel-sparse imaging data

Description

An iSet derived class for pixel-sparse imaging data. Data is stored to be memory efficient whenthere are missing pixels or when the the stored images are non-rectangular regions. The data struc-tures remain efficient for non-sparse pixel data as long as the full datacube does not need to bereconstructed often, and single images or feature vectors are of primary interest. This class canbe combined with Hashmat to be sparse in both feature space and pixel space. This is useful fordatasets with sparse signals, such as processed spectra.

MSImageSet is a derived class of SImageSet for storing mass spectrometry imaging experiments.

Usage

## Instance creationSImageSet(

data = Hashmat(nrow=0, ncol=0),coord = expand.grid(

x = seq_len(prod(dim(data)[-1])),y = seq_len(ifelse(prod(dim(data)[-1]) > 0, 1, 0))),

imageData = SImageData(data=data,coord=coord),

pixelData = IAnnotatedDataFrame(data=coord,varMetadata=data.frame(labelType=rep("dim", ncol(coord)))),

Page 97: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

SImageSet-class 97

featureData = AnnotatedDataFrame(data=data.frame(row.names=seq_len(nrow(data)))),

protocolData = AnnotatedDataFrame(data=data.frame(row.names=sampleNames(pixelData))),

experimentData = new("MIAPE-Imaging"),...)

## Additional methods documented below

Arguments

data A matrix-like object with number of rows equal to the number of features andnumber of columns equal to the number of non-missing pixels. Each columnshould be a feature vector. Alternatively, a multidimensional array that repre-sents the datacube with the first dimension as the features can also be supplied.Additional dimensions could be the spatial dimensions of the image, for exam-ple.

coord A data.frame with columns representing the spatial dimensions. Each rowprovides a spatial coordinate for the location of a feature vector correspondingto a column in data. This argument is ignored if data is a multidimensionalarray rather than a matrix.

imageData An object of class SImageData that will contain the imaging data. Usually con-structed using data and coord.

pixelData An object of class IAnnotatedDataFrame giving the information about the pix-els including coordinates of the data in imageData.

featureData An object of class AnnotatedDataFrame giving information about the data fea-tures.

protocolData An object of class AnnotatedDataFrame giving information about the samples.It must have one row for each of the sampleNames in pixelData.

experimentData An object derived from class MIAxE giving information about the imaging ex-periment.

... Additional arguments passed to the initializer.

Slots

imageData: An instance of SImageData, which stores one or more matrices of equal number ofdimensions as elements in an ’immutableEnvironment’. This slot preserves copy-on-writebehavior when it is modified specifically, but is pass-by-reference otherwise, for memory effi-ciency.

pixelData: Contains pixel information in an IAnnotatedDataFrame. This includes both pixel co-ordinates and phenotypic and sample data. Its rows correspond to the columns in imageData.

featureData: Contains variables describing features in an IAnnotatedDataFrame. Its rows cor-respond to the rows in imageData.

experimentData: Contains details of experimental methods. Should be an object of a derived classof MIAxE.

protocolData: Contains variables in an IAnnotatedDataFrame describing the generation of thesamples in pixelData.

.__classVersion__: A Versions object describing the version of the class used to created theinstance. Intended for developer use.

Page 98: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

98 SImageSet-class

Extends

iSet, directly. VersionedBiobase, by class "iSet", distance 1. Versioned, by class "Versioned-Biobase", distance 2.

Creating Objects

SImageSet instances are usually created through SImageSet().

Methods

Class-specific methods:

iData(object), iData(object) <- value: Access and set the sparse image data in imageData.This is a matrix-like object with rows corresponding to features and columns correspondingto pixels, so that each column of the returned object is a feature vector.

regeneratePositions: Regenerates the positionArray in imageData used to reconstruct thedatacube based on the coordinates in pixelData. Normally, this should not be called by theuser. However, if the coordinates are modified manually, it can be used to re-sync the datastructures.

Standard generic methods:

combine(x, y, ...): Combine two or more SImageSet objects. Unique ’sample’s in pixelDataare treated as a dimension.

SImageSet[i, j, ..., drop]: Subset an SImageSet based on the rows (featureData components)and the columns (pixelData components). The result is a new SImageSet.

See iSet for additional methods.

Author(s)

Kylie A. Bemis

See Also

iSet, SImageData, MSImageSet

Examples

## Create an SImageSet objectdata <- matrix(1:27, nrow=3)coord <- expand.grid(x=1:3, y=1:3)sset <- SImageSet(data=data, coord=coord)

## Access a single image corresponding to the first featureimageData(sset)[1,,]

## Reconstruct the datacubeimageData(sset)[]

## Access the P x N matrix of column-wise feature vectorsiData(sset)

## Subset the SImageSet to the first 2 features and first 6 pixelssset2 <- sset[1:2, 1:6]

Page 99: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

simulateSpectrum 99

imageData(sset2)[]sset2

simulateSpectrum Simulate a mass spectrum or MS imaging experiment

Description

Simulate mass spectra or complete MS imaging experiments, including a possible baseline, spatialand spectral noise, mass drift, mass resolution, and multiplicative variation, etc.

A number of preset imaging designs are available for quick-and-dirty simulation of images.

These functions are designed for small proof-of-concept examples and testing, and may not scalewell to simulating larger datasets.

Usage

simulateSpectrum(n = 1L, peaks = 50L,mz = rlnorm(peaks, 7, 0.3), intensity = rlnorm(peaks, 1, 0.9),from = 0.9 * min(mz), to = 1.1 * max(mz), by = 400,sdpeaks = sdpeakmult * log1p(intensity), sdpeakmult = 0.2,sdnoise = 0.1, sdmz = 10, resolution = 1000, fmax = 0.5,baseline = 0, decay = 10, units=c("ppm", "mz"),representation = c("profile", "centroid"), ...)

simulateImage(pixelData, featureData, preset,from = 0.9 * min(mz), to = 1.1 * max(mz), by = 400,sdrun = 1, sdpixel = 1, spcorr = 0.3, sptype = "SAR",representation = c("profile", "centroid"), units=c("ppm", "mz"),as = c("MSImagingExperiment", "SparseImagingExperiment"),BPPARAM = bpparam(), ...)

addShape(pixelData, center, size, shape=c("circle", "square"), name=shape)

presetImageDef(preset = 1L, nruns = 1, npeaks = 30L,dim = c(20L, 20L), peakheight = 1, peakdiff = 1,sdsample = 0.2, jitter = TRUE, ...)

Arguments

n The number of spectra to simulate.

peaks, npeaks The number of peaks to simulate. Not used if mz and intensity are provided.

mz The theoretical m/z values of the simulated peaks.

intensity The mean intensities of the simulated peaks.

from The minimum m/z value used for the mass range.

to The maximum m/z value used for the mass range.

by The step-size used for the observed m/z-values of the profile spectrum.

sdpeaks The standard deviation(s) for the distributions of observed peak intensities onthe log scale.

Page 100: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

100 simulateSpectrum

sdpeakmult A multiplier used to calculate sdpeaks based on the mean intensities of peaks;used to simulate multiplicative variance. Not used if sdpeaks is provided.

sdnoise The standard deviation of the random noise in the spectrum on the log scale.sdmz The standard deviation of the mass error in the observed m/z values of peaks, in

units indicated by units.resolution The mass resolution as defined by m / dm, where m is the observed mass and dm

is the width of the peak at a proportion of its maximum height defined by fmax(defaults to full-width-at-half-maximum – FWHM – definition). Note that thisis NOT the same as the definition of resolution in the readImzML function.

fmax The proportion of the maximum peak height to use when defining the massresolution.

baseline The maximum intensity of the baseline. Note that baseline=0 means there isno baseline.

decay A constant used to calculate the exponential decay of the baseline. Larger valuesmean the baseline decays more sharply at the lower mass range of the spectrum.

units The units for by and sdmz. Either parts-per-million or absolute m/z units.representation Should a profile spectrum be returned or only the centroided peaks?BPPARAM An optional instance of BiocParallelParam. See documentation for bplapply.pixelData A PositionDataFrame giving the pixel design of the experiment. The names

of the columns should match the names of columns in featureData. Each col-umn should be a logical vector corresponding to a morphological substructure,indicate which pixels belong to that substructure.

featureData A MassDataFrame giving the feature design of the experiment. Each row shouldcorrespond to an expected peak. The names of the columns should match thenames of columns in pixelData. Each column should be a numeric vectorcorresponding to a morphological substructure, giving the mean intensity of thatpeak for that substructure.

preset A number indicating a preset image definition to use.nruns The number of runs to simulate for each condition.sdrun A standard deviation giving the run-to-run variance.sdpixel A standard deviation giving the pixel-to-pixel variance.spcorr The spatial autocorrelation. Must be between 0 and 1, where spcorr=0 indicates

no spatial autocorrelation.sptype The type of spatial autocorrelation.as The class of object to be returned.... Additional arguments to pass to simulateSpectrum or presetImageDef.dim The dimensions of the preset image.peakheight Reference intensities used for peak heights by the preset.peakdiff A reference intensity difference used for the mean peak height difference be-

tween conditions, for presets that simulate multiple conditions.sdsample A standard deviation giving the amount of variation from the true peak heights

for this simulated sample.jitter Should random noise be added to the location and size of the shapes?center The center of the shape.size The size of the shape (from the center).shape What type of shape to add.name The name of the added column.

Page 101: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

simulateSpectrum 101

Details

The simulateSpectrum() and simulateImage() functions are used to simulate mass spectra andMS imaging experiments. They provide a great deal of control over the parameters of the simula-tion, including all sources of variation.

For simulateImage(), the user should provide the design of the simulated experiment via matchingcolumns in pixelData and featureData, where each column corresponds to different morpholog-ical substructures or differing conditions. These design data frames are returned in the metadata()of the returned object for later reference.

A number of presets are defined by presetImageDef(), which returns only the pixelData andfeatureData necessary to define the experiment for simulateImage(). These can be referencedfor help in understanding how to define experiments for simulateImage().

The preset images are:

• 1: a centered circle

• 2: a topleft circle and a bottomright square

• 3: two corner squares and a centered circle

• 4: a centered circle with conditions A and B in different runs

• 5: a topleft circle and a bottomright square with conditions A and B in different runs

• 6: two corner squares and a centered circle; the circle has conditions A and B in different runs

• 7: matched pairs of circles with conditions A and B within the same runs; includes referencepeaks

• 8: matched pairs of circles inside squares with conditions A and B within the same runs;includes reference peaks

• 9: a small sphere inside a larger sphere (3D)

The addShape() function is provided for convenience when generating the pixelData for simulateImage(),as a simple way of adding morphological substructures using basic shapes such as squares and cir-cles.

Value

For simulateSpectrum, a list with elements:

• mz: a numeric vector of the observed m/z values

• intensity: a numeric vector or matrix of the intensities

For simulateImage, a MSImagingExperiment or a SparseImagingExperiment.

For addShape, a new PositionDataFrame with a logical column added for the correspondingshape.

For presetImageDef, a list with two elements: the pixelData and featureData to be used asinput to simulateImage().

Author(s)

Kylie A. Bemis

See Also

simulateSpectrum, simulateImage

Page 102: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

102 slice-methods

Examples

register(SerialParam())set.seed(1)

# generate a spectrums <- simulateSpectrum(1)plot(intensity ~ mz, data=s, type="l")

# generate a noisy low-resolution spectrum with a baselines <- simulateSpectrum(1, baseline=2, sdnoise=0.3, resolution=100)plot(intensity ~ mz, data=s, type="l")

# generate a high-resolution spectrums <- simulateSpectrum(1, peaks=100, resolution=10000)plot(intensity ~ mz, data=s, type="l")

# generate an imagex <- simulateImage(preset=1, npeaks=10, dim=c(10,10))m <- mz(metadata(x)$design$featureData)

image(x, mz=m[5])

plot(x, coord=c(x=3, y=3))

slice-methods Slice an image

Description

Slice an imaging dataset as a "data cube".

Usage

## S4 method for signature 'SparseImagingExperiment'slice(.data, ..., .preserve=FALSE)

Arguments

.data An imaging dataset.

... Conditions describing features to slice, passed to features().

.preserve Should all array dimensions be retained? If FALSE, dimensions with only onelevel are dropped using drop.

Details

Because SparseImagingExperiment objects may be pixel-sparse, their data is always internallyrepresented as a matrix rather than an array, where each column is a feature-vector. Only columnsfor non-missing pixels are retained. This is simpler and more space-efficient if the image is non-rectangular, non-gridded, or has many missing values.

However, it is often necessary to index into the data as if it were an actual "data cube", with explicitarray dimensions for each spatial dimension. slice() allows this by slicing the object as a "datacube", and returning an image array from the object.

Page 103: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

smoothSignal-methods 103

For non-rectangular data, this may result in missing values. For non-gridded data, images must beprojected to an array (with a regular grid), and the result may not represent the underlying valuesexactly.

Value

An array representing the sliced image(s).

Author(s)

Kylie A. Bemis

Examples

register(SerialParam())

set.seed(1)x <- simulateImage(preset=1, npeaks=10, dim=c(10,10), representation="centroid")m <- mz(metadata(x)$design$featureData)

# slice image for first featureslice(x, 1)

# slice by m/z-valueslice(x, mz=m[1])

# slice multipleslice(x, mz=m[1:3])

smoothSignal-methods Smooth the signals of a imaging dataset

Description

Apply smoothing to the feature vectors of an imaging dataset.

Usage

## S4 method for signature 'SparseImagingExperiment'smooth(x, ...)

## S4 method for signature 'SparseImagingExperiment'smoothSignal(object, method = c("gaussian", "sgolay", "ma"), ...)

## S4 method for signature 'MSImageSet'smoothSignal(object, method = c("gaussian", "sgolay", "ma"),

...,pixel = pixels(object),plot = FALSE)

## Gaussian smoothingsmoothSignal.gaussian(x, sd=window/4, window=5, ...)

Page 104: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

104 smoothSignal-methods

## Savitsky-Golay smoothingsmoothSignal.sgolay(x, order=3, window=order + 3 - order %% 2, ...)

## Moving average smoothingsmoothSignal.ma(x, coef=rep(1, window + 1 - window %% 2), window=5, ...)

Arguments

object An imaging dataset.

method The smoothing method to use.

pixel The pixels to smooth. If less than the extent of the dataset, this will result in asubset of the data being processed.

plot Plot each pixel while it is being processed?

... Additional arguments passed to the smoothing method.

x The signal or dataset to be smoothed.

sd The standard deviation for the Gaussian kernel.

window The smoothing window.

order The order of the smoothing filter.

coef The coefficients for the moving average filter.

Details

Smoothing is usually performed using the provided functions, but a user-created function can alsobe passed to method. In this case it should take the following arguments:

• x: A numeric vector of intensities.

• ...: Additional arguments.

A user-created function should return a numeric vector of the same length.

Internally, pixelApply is used to apply the smooothing. See its documentation page for moredetails on additional objects available to the environment installed to the smoothing function.

Value

An object of the same class with the smoothed spectra.

Author(s)

Kylie A. Bemis

See Also

MSImagingExperiment, MSImageSet, pixelApply, process

Page 105: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

SparseImagingExperiment-class 105

Examples

register(SerialParam())

set.seed(2)data <- simulateImage(preset=1, npeaks=10, dim=c(3,3), baseline=1)data <- data[,pData(data)$circle]

# queue smoothingdata <- smoothSignal(data, method="ma", window=9)

# apply smoothingdata_smooth <- process(data, plot=interactive())

SparseImagingExperiment-class

SparseImagingExperiment: Pixel-sparse imaging experiments

Description

The SparseImagingExperiment class specializes the virtual ImagingExperiment class by assum-ing that each pixel may be a high-dimensional feature vector (e.g., a spectrum), but the pixelsthemselves may be sparse. Therefore, the data may be more efficiently stored as a matrix whererows are features and columns are pixels, rather than storing the full, dense datacube.

Both 2D and 3D data are supported. Non-gridded pixel coordinates are allowed.

The MSImagingExperiment subclass adds design features for mass spectrometry imaging experi-ments.

Usage

## Instance creationSparseImagingExperiment(

imageData = matrix(nrow=0, ncol=0),featureData = DataFrame(),pixelData = PositionDataFrame(),metadata = list(),processing = SimpleList())

## Additional methods documented below

Arguments

imageData Either a matrix-like object with number of rows equal to the number of featuresand number of columns equal to the number of pixels, or an ImageArrayList.

featureData A DataFrame with feature metadata, with a row for each feature.

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 newobjects.

Page 106: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

106 SparseImagingExperiment-class

Slots

imageData: An object inheriting from ImageArrayList, storing one or more array-like data ele-ments with conformable dimensions.

featureData: Contains feature information in a DataFrame. Each row includes the metadata fora single feature (e.g., a color channel, a molecular analyte, or a mass-to-charge ratio).

elementMetadata: Contains pixel information in a PositionDataFrame. Each row includes themetadata for a single observation (e.g., a pixel), including specialized slot-columns for track-ing pixel coordinates and experimental runs.

metadata: A list containing experiment-level metadata.

processing: A SimpleList containing processing steps (including both queued and previouslyexecuted processing steps).

Methods

All methods for ImagingExperiment also work on SparseImagingExperiment objects. Addi-tional methods are documented below:

pixels(object, ...): Returns the row indices of pixelData corresponding to conditions passedvia . . . .

features(object, ...): Returns the row indices of featureData corresponding to conditionspassed via . . . .

run(object), run(object) <- value: Get or set the experimental run slot-column from pixelData.

runNames(object), runNames(object) <- value: Get or set the experimental run levels frompixelData.

coord(object), coord(object) <- value: Get or set the spatial position slot-columns from pixelData.

coordLabels(object), coordLabels(object) <- value: Get or set the names of the spatial po-sition slot-columns from pixelData.

gridded(object), gridded(object) <- value: Get or set whether the spatial positions are grid-ded or not. Typically, this should not be set manually.

resolution(object), resolution(object) <- value: Get or set the spatial resolution of thespatial positions. Typically, this should not be set manually.

dims(object): Get the gridded dimensions of the spatial positions (i.e., as if projected to an imageraster).

is3D(object): Check if the data is 3D or not.

slice(object, ...): Slice the data as a data cube (i.e., as if projected to an multidimensionalimage raster).

processingData(object), processingData(object) <- value: Get or set the processing slot.

preproc(object): List the preprocessing steps queued and applied to the dataset.

collect(x, ...): Pull all data elements of imageData into memory as matrices.

object[i, j, ..., drop]: Subset based on the rows (featureData) and the columns (pixelData).The result is the same class as the original object.

rbind(...), cbind(...): Combine SparseImagingExperiment objects by row or column.

Author(s)

Kylie A. Bemis

Page 107: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

spatialDGMM-methods 107

See Also

ImagingExperiment, MSImagingExperiment

Examples

data <- matrix(1:9^2, nrow=9, ncol=9)t <- seq_len(9)a <- seq_len(9)coord <- expand.grid(x=1:3, y=1:3)

idata <- ImageArrayList(data)fdata <- XDataFrame(t=t)pdata <- PositionDataFrame(coord=coord, a=a)

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

print(x)

spatialDGMM-methods Spatially-aware Dirichlet Gaussian mixture model

Description

Fits spatially-aware Dirichlet Gaussian mixture models to each feature and each run in an imagingexperiment. Each image is segmented and the means and variances of all Gaussian components areestimated. A linear filter with a spatial kernel is applied to the component probabilities to achievespatial smoothing. Simulated annealing is used in the EM-algorithm to avoid local optimia andachieve more accurate parameter estimates.

Usage

## S4 method for signature 'SparseImagingExperiment'spatialDGMM(x, r = 1, k = 3, groups = run(x),

method = c("gaussian", "adaptive"),dist = "chebyshev", annealing = TRUE,init = c("kmeans", "gmm"), p0 = 0.05,iter.max = 100, tol = 1e-9,BPPARAM = bpparam(), ...)

## S4 method for signature 'SpatialDGMM'summary(object, ...)

Arguments

x The imaging dataset to segment or classify.

r The spatial neighborhood radius of nearby pixels to consider. This can be avector of multiple radii values.

Page 108: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

108 spatialDGMM-methods

k The maximum number of segments (clusters). This can be a vector to try ini-tializing the clustering with different numbers of maximum segments. The finalnumber of segments may differ.

groups Pixels from different groups will be segmented separately. For the validity ofdownstream statistical analysis, it is important that each distinct observationalunit (e.g., tissue sample) is assigned to a unique group.

method The method to use to calculate the spatial smoothing weights. The ’gaussian’method refers to spatially-aware (SA) weights, and ’adaptive’ refers to spatially-aware structurally-adaptive (SASA) weights.

dist The type of distance metric to use when calculating neighboring pixels basedon r. The options are ‘radial’, ‘manhattan’, ‘minkowski’, and ‘chebyshev’ (thedefault).

annealing Should simulated annealing be used during the optimization process to improveparameter estimates?

init Should the parameter estimates be initialized using k-means (’kmeans’) or Gaus-sian mixture model (’gmm’)?

p0 A regularization parameter applied to estimated posterior class probabilities toavoid singularities. Must be positive for successful gradient descent optimiza-tion. Changing this value (within reason) should have only minimal impact onvalues of parameter estimates, but may greatly affect the algorithm’s speed andstability.

iter.max The maximum number of EM-algorithm iterations.

tol The tolerance convergence criterion for the EM-algorithm. Corresponds to thechange in log-likelihood.

... Passed to internal methods.

object A fitted model object to summarize.

BPPARAM An optional instance of BiocParallelParam. See documentation for bplapply.

Value

An object of class SpatialDGMM, which is a ImagingResult, where each element of the resultDataslot contains at least the following components:

estimates: A list giving the parameter estimates for the means and variances for each Gaussiancomponent.

class: The predicted Gaussian component.

probability: The probability of class membership for each Gaussian component.

Author(s)

Dan Guo and Kylie A. Bemis

References

Guo, D., Bemis, K., Rawlins, C., Agar, J., and Vitek, O. (2019.) Unsupervised segmentation ofmass spectrometric ion images characterizes morphology of tissues. Proceedings of ISMB/ECCB,Basel, Switzerland, 2019.

Page 109: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

spatialFastmap-methods 109

Examples

register(SerialParam())

set.seed(2)x <- simulateImage(preset=3, dim=c(10,10), npeaks=6,

peakheight=c(4,6,8), representation="centroid")

res <- spatialDGMM(x, r=1, k=5, method="adaptive")

summary(res)

image(res, model=list(feature=3))

spatialFastmap-methods

Spatially-aware FastMap projection

Description

Performs spatially-aware FastMap projection.

Usage

## S4 method for signature 'SparseImagingExperiment'spatialFastmap(x, r = 1, ncomp = 3,

method = c("gaussian", "adaptive"),metric = c("average", "correlation", "neighborhood"),dist = "chebyshev", tol.dist = 1e-9,iter.max = 1, BPPARAM = bpparam(), ...)

## S4 method for signature 'SpatialFastmap2'summary(object, ...)

## S4 method for signature 'SImageSet'spatialFastmap(x, r = 1, ncomp = 3,

method = c("gaussian", "adaptive"),metric = c("average", "correlation", "neighborhood"),iter.max = 1, ...)

Arguments

x The imaging dataset for which to calculate the FastMap components.

r The neighborhood spatial smoothing radius.

ncomp The number of FastMap components to calculate.

method The method to use to calculate the spatial smoothing kernels for the embedding.The ’gaussian’ method refers to spatially-aware (SA) weights, and ’adaptive’refers to spatially-aware structurally-adaptive (SASA) weights.

metric The dissimilarity metric to use when comparing spectra, where ‘average’ (thedefault) means to use the differences of spatially-smoothed spectra, ‘correlation’means to use the correlations of spatially-smoothed spectra, and ‘neighborhood’

Page 110: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

110 spatialFastmap-methods

means to use pairwise differences of each spectrum in the neighborhoods. Pre-vious versions used ‘neighborhood’, which is the algorithm of Alexandrov &Kobarg; ‘average’ is the current default, because it handles non-gridded pixelsbetter than ‘neighborhood’.

dist The type of distance metric to use when calculating neighboring pixels basedon r. The options are ‘radial’, ‘manhattan’, ‘minkowski’, and ‘chebyshev’ (thedefault).

tol.dist The distance tolerance used for matching pixels when calculating pairwise dis-tances between neighborhoods. This parameter should only matter when thedata is not gridded. (Only considers ‘radial’ distance.)

iter.max The number of iterations to perform when choosing the pivot vectors for eachdimension.

... Ignored.

object A fitted model object to summarize.

BPPARAM An optional instance of BiocParallelParam. See documentation for bplapply.

Value

An object of class SpatialFastmap2, which is a ImagingResult, or an object of class SpatialFastmap,which is a ResultSet. Each element of the resultData slot contains at least the following com-ponents:

scores: A matrix with the FastMap component scores.

correlation: A matrix with the feature correlations with each FastMap component.

sdev: The standard deviations of the FastMap scores.

Author(s)

Kylie A. Bemis

References

Alexandrov, T., & Kobarg, J. H. (2011). Efficient spatial segmentation of large imaging mass spec-trometry datasets with spatially aware clustering. Bioinformatics, 27(13), i230-i238. doi:10.1093/bioinformatics/btr246

Faloutsos, C., & Lin, D. (1995). FastMap: A Fast Algorithm for Indexing, Data-Mining and Visu-alization of Traditional and Multimedia Datasets. Presented at the Proceedings of the 1995 ACMSIGMOD international conference on Management of data.

See Also

PCA, spatialKMeans, spatialShrunkenCentroids

Examples

register(SerialParam())

set.seed(1)data <- simulateImage(preset=2, npeaks=20, dim=c(6,6),

representation="centroid")

# project to FastMap componentsfm <- spatialFastmap(data, r=1, ncomp=2, method="adaptive")

Page 111: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

spatialKMeans-methods 111

# visualize first 2 componentsimage(fm, superpose=FALSE)

spatialKMeans-methods Spatially-aware k-means clustering

Description

Performs spatially-aware (SA) or spatially-aware structurally-adaptive (SASA) clustering of imag-ing data. The data are first projected into an embedded feature space where spatial structure ismaintained using the Fastmap algorithm, and then ordinary k-means clustering is performed on theprojected dataset.

Usage

## S4 method for signature 'SparseImagingExperiment'spatialKMeans(x, r = 1, k = 3,

method = c("gaussian", "adaptive"),dist = "chebyshev", tol.dist = 1e-9,iter.max = 10, nstart = 10,algorithm = c("Hartigan-Wong", "Lloyd", "Forgy", "MacQueen"),ncomp = 10, BPPARAM = bpparam(), ...)

## S4 method for signature 'SpatialKMeans2'summary(object, ...)

## S4 method for signature 'SImageSet'spatialKMeans(x, r = 1, k = 3,

method = c("gaussian", "adaptive"),iter.max = 10, nstart = 10,algorithm = c("Hartigan-Wong", "Lloyd", "Forgy",

"MacQueen"),ncomp = 10, ...)

Arguments

x The imaging dataset to cluster.

r The spatial neighborhood radius of nearby pixels to consider. This can be avector of multiple radii values.

k The number of clusters. This can be a vector to try different numbers of clusters.

method The method to use to calculate the spatial smoothing kernels for the embedding.The ’gaussian’ method refers to spatially-aware (SA) clustering, and ’adaptive’refers to spatially-aware structurally-adaptive (SASA) clustering.

dist The type of distance metric to use when calculating neighboring pixels basedon r. The options are ‘radial’, ‘manhattan’, ‘minkowski’, and ‘chebyshev’ (thedefault).

tol.dist The distance tolerance used for matching pixels when calculating pairwise dis-tances between neighborhoods. This parameter should only matter when thedata is not gridded. (Only considers ‘radial’ distance.)

Page 112: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

112 spatialKMeans-methods

iter.max The maximum number of k-means iterations.

nstart The number of restarts for the k-means algorithm.

algorithm The k-means algorithm to use. See kmeans for details.

ncomp The number of fastmap components to calculate.

... Ignored.

object A fitted model object to summarize.

BPPARAM An optional instance of BiocParallelParam. See documentation for bplapply.

Value

An object of class SpatialKMeans2, which is a ImagingResult, or an object of class SpatialKMeans,which is a ResultSet. Each element of the resultData slot contains at least the following com-ponents:

cluster: A vector of integers indicating the cluster for each pixel in the dataset.

centers: A matrix of cluster centers.

correlation: A matrix with the feature correlations with each cluster.

Author(s)

Kylie A. Bemis

References

Alexandrov, T., & Kobarg, J. H. (2011). Efficient spatial segmentation of large imaging mass spec-trometry datasets with spatially aware clustering. Bioinformatics, 27(13), i230-i238. doi:10.1093/bioinformatics/btr246

Faloutsos, C., & Lin, D. (1995). FastMap: A Fast Algorithm for Indexing, Data-Mining and Visu-alization of Traditional and Multimedia Datasets. Presented at the Proceedings of the 1995 ACMSIGMOD international conference on Management of data.

See Also

spatialShrunkenCentroids

Examples

register(SerialParam())

set.seed(1)x <- simulateImage(preset=3, dim=c(10,10), npeaks=10,

peakheight=c(4,6,8), representation="centroid")

res <- spatialKMeans(x, r=1, k=4, method="adaptive")

summary(res)

image(res, model=1)

Page 113: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

spatialShrunkenCentroids-methods 113

spatialShrunkenCentroids-methods

Spatially-aware shrunken centroid clustering and classification

Description

Performs spatially-aware nearest shrunken centroid clustering or classification on an imaging dataset.These methods use statistical regularization to shrink the t-statistics of the features toward 0 so thatunimportant features are removed from the analysis. A Gaussian spatial kernel or an adaptive kernelbased on bilateral filtering are used for spatial smoothing.

Usage

## S4 method for signature 'SparseImagingExperiment,missing'spatialShrunkenCentroids(x, r = 1, k = 3, s = 0,

method = c("gaussian", "adaptive"),dist = "chebyshev", init = NULL,iter.max = 10, BPPARAM = bpparam(), ...)

## S4 method for signature 'SparseImagingExperiment,ANY'spatialShrunkenCentroids(x, y, r = 1, s = 0,

method = c("gaussian", "adaptive"),dist = "chebyshev", priors = table(y),BPPARAM = bpparam(), ...)

## S4 method for signature 'SpatialShrunkenCentroids2'predict(object, newx, newy, BPPARAM = bpparam(), ...)

## S4 method for signature 'SpatialShrunkenCentroids2'fitted(object, ...)

## S4 method for signature 'SpatialShrunkenCentroids2'summary(object, ...)

## S4 method for signature 'SImageSet,missing'spatialShrunkenCentroids(x, r = 1, k = 3, s = 0,

method = c("gaussian", "adaptive"),iter.max=10, ...)

## S4 method for signature 'SImageSet,factor'spatialShrunkenCentroids(x, y, r = 1, s = 0,

method = c("gaussian", "adaptive"),priors = table(y), ...)

## S4 method for signature 'SImageSet,character'spatialShrunkenCentroids(x, y, ...)

## S4 method for signature 'SpatialShrunkenCentroids'predict(object, newx, newy, ...)

Page 114: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

114 spatialShrunkenCentroids-methods

Arguments

x The imaging dataset to segment or classify.

y A factor or character response.

r The spatial neighborhood radius of nearby pixels to consider. This can be avector of multiple radii values.

k The maximum number of segments (clusters). This can be a vector to try ini-tializing the clustering with different numbers of maximum segments. The finalnumber of segments may differ.

s The sparsity thresholding parameter by which to shrink the t-statistics.

method The method to use to calculate the spatial smoothing weights. The ’gaussian’method refers to spatially-aware (SA) weights, and ’adaptive’ refers to spatially-aware structurally-adaptive (SASA) weights.

dist The type of distance metric to use when calculating neighboring pixels basedon r. The options are ‘radial’, ‘manhattan’, ‘minkowski’, and ‘chebyshev’ (thedefault).

init Initial cluster configuration. This may either be the result of a call to spatialKMeans,or a list of factors giving the initial cluster configurations.

iter.max The maximum number of clustering iterations.

priors Prior probabilities on the classes for classification. Improper priors will be nor-malized automatically.

... Passed to internal methods.

BPPARAM An optional instance of BiocParallelParam. See documentation for bplapply.

object The result of a previous call to spatialShrunkenCentroids.

newx An imaging dataset for which to calculate the predicted response from shrunkencentroids.

newy Optionally, a new response from which residuals should be calculated.

Value

An object of class SpatialShrunkenCentroids2, which is a ImagingResult, or an object of classSpatialShrunkenCentroids, which is a ResultSet. Each element of the resultData slot con-tains at least the following components:

class, classes: A factor indicating the predicted class for each pixel in the dataset.

probability, probabilities: A matrix of class probabilities.

centers: A matrix of shrunken class centers.

statistic, tstatistics: A matrix of shrunken t-statistics of the features.

scores: A matrix of discriminant scores.

sd: The pooled within-class standard deviations for each feature.

Author(s)

Kylie A. Bemis

Page 115: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

standardizeRuns-methods 115

References

Bemis, K., Harry, A., Eberlin, L. S., Ferreira, C., van de Ven, S. M., Mallick, P., Stolowitz, M.,and Vitek, O. (2016.) Probabilistic segmentation of mass spectrometry images helps select impor-tant ions and characterize confidence in the resulting segments. Molecular & Cellular Proteomics.doi:10.1074/mcp.O115.053918

Tibshirani, R., Hastie, T., Narasimhan, B., & Chu, G. (2003). Class Prediction by Nearest ShrunkenCentroids, with Applications to DNA Microarrays. Statistical Science, 18, 104-117.

Alexandrov, T., & Kobarg, J. H. (2011). Efficient spatial segmentation of large imaging mass spec-trometry datasets with spatially aware clustering. Bioinformatics, 27(13), i230-i238. doi:10.1093/bioinformatics/btr246

See Also

spatialKMeans

Examples

register(SerialParam())

set.seed(1)x <- simulateImage(preset=2, dim=c(10,10), npeaks=10,

peakheight=c(4,6,8), representation="centroid")

res <- spatialShrunkenCentroids(x, r=1, k=5, s=c(0,3,6), method="adaptive")

summary(res)

image(res, model=list(s=6))

standardizeRuns-methods

Standardize between runs in an imaging dataset

Description

Apply standardization across the runs in a mass spectrometry imaging dataset to correct for between-run variation.

Usage

## S4 method for signature 'MSImageSet'standardizeRuns(object, method = "sum", ...)

## Sum normalizationstandardizeRuns.sum(x, sum=length(x), ...)

Arguments

object An object of class MSImageSet.method The standardization method to use.... Additional arguments passed to the standardization method.x The flattened ion image to be standardized.sum The value to which to standardize the sum of the ion image intensity values.

Page 116: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

116 SummaryDataFrame-class

Details

Standardization is usually performed using the provided functions, but a user-created function canalso be passed to method. In this case it should take the following arguments:

• x: A numeric vector of intensities.

• ...: Additional arguments.

A user-created function should return a numeric vector of the same length.

Internally, featureApply is used to apply the standardization, with .pixel.groups=sample. Seeits documentation page for more details on additional objects available to the environment installedto the standardization function.

Value

An object of class MSImageSet with the runs standardized across samples.

Author(s)

Kylie A. Bemis

See Also

MSImageSet, featureApply

SummaryDataFrame-class

SummaryDataFrame: object summaries

Description

An SummaryDataFrame is a simple (indirect) extension of the DataFrame class as defined in the’S4Vectors’ package, modified to print more simply, and with additional summary information. Itis intended to be appropriate for printing summaries of model objects in a way such that summarystatistics can be easily extracted from them later.

Author(s)

Kylie A. Bemis

See Also

DataFrame

Page 117: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

topFeatures-methods 117

topFeatures-methods Top-ranked features from imaging analysis results

Description

Extract the top-ranked features from the results of imaging analysis, based on test statistics, p-values, or adjusted p-values. The result is sorted data frame that can be further manipulated fordownstream postprocessing.

Usage

#### Methods for Cardinal >= 2.x classes ####

## S4 method for signature 'SpatialShrunkenCentroids2'topFeatures(object, ..., n = 10, model = modelData(object))

## S4 method for signature 'MeansTest'topFeatures(object, ..., n = 10, p.adjust = "BH")

## S4 method for signature 'SegmentationTest'topFeatures(object, ..., n = 10, model = modelData(object), p.adjust = "BH")

#### Methods for Cardinal 1.x classes ####

## S4 method for signature 'ResultSet'topFeatures(object, n = 6,

model = pData(modelData(object)),type = c('+', '-', 'b'),sort.by = fvarLabels(object),filter = list(),...)

## S4 method for signature 'PCA'topFeatures(object, n = 6,

sort.by = "loadings",...)

## S4 method for signature 'PLS'topFeatures(object, n = 6,

sort.by = c("coefficients", "loadings", "weights"),...)

## S4 method for signature 'OPLS'topFeatures(object, n = 6,

sort.by = c("coefficients","loadings", "Oloadings","weights", "Oweights"),

...)

## S4 method for signature 'SpatialKMeans'

Page 118: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

118 topFeatures-methods

topFeatures(object, n = 6,sort.by = c("betweenss", "withinss"),...)

## S4 method for signature 'SpatialShrunkenCentroids'topFeatures(object, n = 6,

sort.by = c("tstatistics", "p.values"),...)

## S4 method for signature 'CrossValidated'topFeatures(object, ...)

Arguments

object The results of an imaging experiment analysis.

n The number of top-ranked records to return.

model If more than one model was fitted, results from which should be shown? De-faults to all models in the object This can name the models explicitly or specifya list of parameter values.

p.adjust The p.adjust method used adjust p-values to account for multiple testing. De-faults to Benjamini \& Hochberg ("BH") to control the false discovery rate(FDR).

... For newer classes, additional arguments to be passed to filter, to further filterthe results.

type How should the records be ranked? ’+’ shows greatest values first (decreasingorder), ’-’ shows least values first (increasing order), and ’b’ uses decreasingorder based on absolute values.

sort.by What variable should be used for sorting?

filter A list of named variables with values to use to filter the results. For example, fortesting or classification, this can be used to only show rankings for a particularcondition.

Value

A data frame with the top-ranked features.

Author(s)

Kylie A. Bemis

See Also

meansTest, segmentationTest, spatialShrunkenCentroids

Examples

register(SerialParam())

set.seed(1)x <- simulateImage(preset=2, npeaks=10, dim=c(10,10),

snoise=1, sdpeaks=1, representation="centroid")

Page 119: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

writeMSIData 119

y <- makeFactor(circle=pData(x)$circle, square=pData(x)$square)

res <- spatialShrunkenCentroids(x, y, r=1, s=c(0,3,6))

topFeatures(res, model=list(s=6))

writeMSIData Write mass spectrometry imaging data files

Description

Write supported mass spectrometry imaging data files. Supported formats include imzML andAnalyze 7.5.

Usage

## S4 method for signature 'MSImageSet,character'writeMSIData(object, file, outformat=c("imzML", "Analyze"), ...)

## S4 method for signature 'MSImageSet'writeImzML(object, name, folder=getwd(), merge=FALSE,mz.type="32-bit float", intensity.type="32-bit float", ...)

## S4 method for signature 'MSImageSet'writeAnalyze(object, name, folder=getwd(),intensity.type="16-bit integer", ...)

Arguments

object An imaging dataset to be written to file.

file A description of the data file to be write. This may be either an absolute orrelative path. Any file extension will be ignored and replaced with an appropriateone.

name The common file name for the ’.imzML’ and ’.ibd’ files for imzML or for the’.hdr’, ’.t2m’, and ’.img’ files for Analyze 7.5.

folder The path to the folder containing the data files.

outformat The file format to write. Currently, the supported formats are "imzML" or "An-alyze".

merge Whether the samples/runs should be written to the same file (TRUE) or split intomultiple files (FALSE). Currently, only FALSE is supported.

mz.type The data type for the m/z values. Acceptable values are "32-bit float" and "64-bitfloat".

intensity.type The data type for the intensity values. Acceptable values are "16-bit integer","32-bit integer", "64-bit integer", "32-bit float" and "64-bit float".

... Additional arguments passed to write functions.

Page 120: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

120 XDataFrame-class

Details

The writeImzML function supports writing both the ’continuous’ and ’processed’ formats.

Exporting the metadata is lossy, and not all metadata will be preserved. If exporting an object thatwas originally imported from an imzML file, any metadata that appears in metadata() of the objectwill be preserved when writing.

Different experimental runs are written to separate files.

The imzML files can be modified after writing (such as to add additional experimental metadata)using the Java-based imzMLValidator application: https://gitlab.com/imzML/imzMLValidator/.

Value

TRUE if the file was written successfully.

Author(s)

Kylie A. Bemis

References

Schramm T, Hester A, Klinkert I, Both J-P, Heeren RMA, Brunelle A, Laprevote O, Desbenoit N,Robbe M-F, Stoeckli M, Spengler B, Rompp A (2012) imzML - A common data format for theflexible exchange and processing of mass spectrometry imaging data. Journal of Proteomics 75(16):5106-5110. doi:10.1016/j.jprot.2012.07.026

See Also

readMSIData

XDataFrame-class XDataFrame: DataFrame with eXtra metadata columns

Description

An XDataFrame is an (indirect) extension of the DataFrame class as defined in the ’S4Vectors’package, modified to support eXtra "slot-columns" that behave differently from other columns. It isintended to facilitate data.frame-like classes that require specialized column access and behavior.The specialized slot-columns are stored as distinct slots, unlike regular columns.

Usage

XDataFrame(...)

Arguments

... Arguments passed to the DataFrame().

Page 121: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

XDataFrame-class 121

Details

For the most part, XDataFrame behaves identically to DataFrame, with the exception of certainmethods being overwritten to account for the additional eXtra "slot-columns" not counted amongthose returned by ncol(x). These additional columns should typically have their own getter andsetter methods.

To implement a subclass of XDataFrame, one needs to implement two methods to allow the slot-columns to be printed by show and retained during coercion: (1) the subclass should implement anas.list() method that includes the slot columns in the resulting list by default and (2) the sub-class should implement a showNames() method that returns the names of all the printable columns(including slot-columns) in the same order as they are returned by as.list().

Methods

names(object): Return the column names, not including any slot-columns.

length(object): Return the number of columns, not including any slot-columns.

groups(object): Return the grouping columns if the data frame is grouped.

lapply(X, FUN, ..., slots = FALSE): Returns a list of the same length as X, where each elementis the result of applying FUN to the corresponding element of X. This version includes anadditional argument for whether the slot-columns should be included or not. This methodshould be overwritten by subclasses to ensure correct behavior.

as.env(x, ...): Create an environment from x with a symbol for each column, including theslot-columns. This method should be overwritten by subclasses to ensure correct behavior.

Author(s)

Kylie A. Bemis

See Also

DataFrame, MassDataFrame, PositionDataFrame

Examples

## Create an XDataFrame objectXDataFrame(x=1:10, y=letters[1:10])

Page 122: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

Index

∗Topic IOreadMSIData, 86writeMSIData, 119

∗Topic arrayHashmat-class, 16

∗Topic classesAnnotatedImage-class, 4AnnotatedImagingExperiment-class,

5Hashmat-class, 16IAnnotatedDataFrame-class, 19ImageData-class, 28ImageList-class, 30ImagingExperiment-class, 32ImagingResult-class, 33iSet-class, 36MassDataFrame-class, 38MIAPE-Imaging-class, 41MSContinuousImagingExperiment-class,

44MSImageData-class, 44MSImageProcess-class, 47MSImageSet-class, 49MSImagingExperiment-class, 52MSImagingInfo-class, 54MSProcessedImagingExperiment-class,

55PositionDataFrame-class, 82ResultSet-class, 91SImageData-class, 93SImageSet-class, 96SparseImagingExperiment-class, 105SummaryDataFrame-class, 116XDataFrame-class, 120

∗Topic classifcvApply-methods, 10PLS-methods, 80spatialShrunkenCentroids-methods,

113∗Topic clustering

spatialDGMM-methods, 107spatialKMeans-methods, 111spatialShrunkenCentroids-methods,

113∗Topic color

intensity.colors, 34∗Topic datagen

simulateSpectrum, 99∗Topic hplot

image-methods, 21plot-methods, 74

∗Topic htestmeansTest-methods, 39

∗Topic iplotselectROI-methods, 92

∗Topic manipcvApply-methods, 10dplyr-methods, 13pixelApply-methods, 70slice-methods, 102

∗Topic methodsbatchProcess-methods, 7colocalized-methods, 8coregister-methods, 9mz-methods, 56mzAlign-methods, 57mzBin-methods, 58mzFilter-methods, 60normalize-methods, 62peakAlign-methods, 65peakBin-methods, 67peakPick-methods, 68process-methods, 84reduceBaseline-methods, 87reduceDimension-methods, 89smoothSignal-methods, 103standardizeRuns-methods, 115topFeatures-methods, 117

∗Topic modelsmeansTest-methods, 39

∗Topic multivariatePCA-methods, 63PLS-methods, 80

∗Topic packageCardinal-package, 3

∗Topic spatial

122

Page 123: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

INDEX 123

findNeighbors-methods, 14spatialDGMM-methods, 107spatialFastmap-methods, 109spatialKMeans-methods, 111spatialShrunkenCentroids-methods,

113[,AnnotatedImageList,ANY,ANY,ANY-method

(AnnotatedImagingExperiment-class),5

[,Hashmat,ANY,ANY,ANY-method(Hashmat-class), 16

[,Hashmat,ANY,ANY,NULL-method(Hashmat-class), 16

[,Hashmat-method (Hashmat-class), 16[,IAnnotatedDataFrame,ANY,ANY,ANY-method

(IAnnotatedDataFrame-class), 19[,ImageArrayList,ANY,ANY,ANY-method

(ImageList-class), 30[,ImageArrayList-method

(ImageList-class), 30[,ImagingExperiment,ANY,ANY,ANY-method

(ImagingExperiment-class), 32[,MSContinuousImagingSpectraList,ANY,ANY,ANY-method

(MSContinuousImagingExperiment-class),44

[,MSProcessedImagingSpectraList,ANY,ANY,ANY-method(MSProcessedImagingExperiment-class),55

[,MassDataFrame,ANY,ANY,ANY-method(MassDataFrame-class), 38

[,PositionDataFrame,ANY,ANY,ANY-method(PositionDataFrame-class), 82

[,ResultSet,ANY,ANY,ANY-method(ResultSet-class), 91

[,ResultSet-method (ResultSet-class), 91[,SImageData,ANY,ANY,ANY-method

(SImageData-class), 93[,SImageData,ANY,ANY,NULL-method

(SImageData-class), 93[,SImageData-method (SImageData-class),

93[,SImageSet,ANY,ANY,ANY-method

(SImageSet-class), 96[,SImageSet-method (SImageSet-class), 96[,SparseImagingExperiment,ANY,ANY,ANY-method

(SparseImagingExperiment-class),105

[,SparseImagingResult,ANY,ANY,ANY-method(ImagingResult-class), 33

[,XDataFrame,ANY,ANY,ANY-method(XDataFrame-class), 120

[<-,Hashmat,ANY,ANY,ANY-method

(Hashmat-class), 16[<-,Hashmat-method (Hashmat-class), 16[<-,ImageArrayList,ANY,ANY,ANY-method

(ImageList-class), 30[<-,ImagingExperiment,ANY,ANY,ANY-method

(ImagingExperiment-class), 32[<-,SparseImagingExperiment,ANY,ANY,ANY-method

(SparseImagingExperiment-class),105

[[,ImageData,character,missing-method(ImageData-class), 28

[[,ImageData-method (ImageData-class),28

[[,ImageList,ANY,ANY-method(ImageList-class), 30

[[,ImagingExperiment,ANY,ANY-method(ImagingExperiment-class), 32

[[,ImagingResult,ANY,ANY-method(ImagingResult-class), 33

[[,ResultSet,ANY,ANY-method(ResultSet-class), 91

[[,ResultSet-method (ResultSet-class),91

[[,SparseImagingResult,ANY,ANY-method(ImagingResult-class), 33

[[,iSet,ANY,ANY-method (iSet-class), 36[[,iSet-method (iSet-class), 36[[<-,ImageData,character,missing-method

(ImageData-class), 28[[<-,ImageData-method

(ImageData-class), 28[[<-,ImageList,ANY,ANY-method

(ImageList-class), 30[[<-,ImagingExperiment,ANY,ANY-method

(ImagingExperiment-class), 32[[<-,ImagingResult,ANY,ANY-method

(ImagingResult-class), 33[[<-,MSContinuousImagingSpectraList,ANY,ANY-method

(MSContinuousImagingExperiment-class),44

[[<-,MSProcessedImagingSpectraList,ANY,ANY-method(MSProcessedImagingExperiment-class),55

[[<-,SparseImagingResult,ANY,ANY-method(ImagingResult-class), 33

[[<-,XDataFrame,ANY,ANY-method(XDataFrame-class), 120

[[<-,iSet,ANY,ANY-method (iSet-class),36

[[<-,iSet-method (iSet-class), 36$,ImagingExperiment-method

(ImagingExperiment-class), 32

Page 124: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

124 INDEX

$,ImagingResult-method(ImagingResult-class), 33

$,ResultSet-method (ResultSet-class), 91$,iSet-method (iSet-class), 36$<-,ImagingExperiment-method

(ImagingExperiment-class), 32$<-,XDataFrame-method

(XDataFrame-class), 120$<-,iSet-method (iSet-class), 36%>% (reexports), 91

abstract,MIAPE-Imaging-method(MIAPE-Imaging-class), 41

addShape (simulateSpectrum), 99alpha.colors (intensity.colors), 34AnnotatedDataFrame, 19–21, 50, 91, 97annotatedDataFrameFrom,ImageData-method

(ImageData-class), 28AnnotatedImage, 6AnnotatedImage (AnnotatedImage-class), 4AnnotatedImage-class, 4AnnotatedImageList, 6AnnotatedImageList

(AnnotatedImagingExperiment-class),5

AnnotatedImageList-class(AnnotatedImagingExperiment-class),5

AnnotatedImagingExperiment(AnnotatedImagingExperiment-class),5

AnnotatedImagingExperiment-class, 5arrange (reexports), 91as.data.frame,XDataFrame-method

(XDataFrame-class), 120as.env,list-method (XDataFrame-class),

120as.env,XDataFrame-method

(XDataFrame-class), 120as.list,ImageList-method

(ImageList-class), 30as.list,MassDataFrame-method

(MassDataFrame-class), 38as.list,MSImagingInfo-method

(MSImagingInfo-class), 54as.list,PositionDataFrame-method

(PositionDataFrame-class), 82as.matrix,XDataFrame-method

(XDataFrame-class), 120AssayData, 29, 30, 45, 94

baselineReduction(MSImagingInfo-class), 54

baselineReduction,MSImageProcess-method(MSImageProcess-class), 47

baselineReduction,Vector-method(MSImagingInfo-class), 54

baselineReduction<-(MSImagingInfo-class), 54

baselineReduction<-,MSImageProcess-method(MSImageProcess-class), 47

baselineReduction<-,Vector-method(MSImagingInfo-class), 54

batchProcess (batchProcess-methods), 7batchProcess,MSImageSet-method

(batchProcess-methods), 7batchProcess-methods, 7Binmat, 18Binmat (defunct), 12Binmat-class (defunct), 12bplapply, 9, 11, 15, 40, 72, 85, 86, 100, 108,

110, 112, 114bw.colors (intensity.colors), 34

Cardinal (Cardinal-package), 3Cardinal-defunct (defunct), 12Cardinal-deprecated (deprecated), 12Cardinal-package, 3Cardinal-reexports (reexports), 91Cardinal.history (Cardinal-package), 3Cardinal.version (Cardinal-package), 3cbind,AnnotatedImageList-method

(AnnotatedImagingExperiment-class),5

cbind,Hashmat-method (Hashmat-class), 16cbind,ImageArrayList-method

(ImageList-class), 30cbind,ImagingExperiment-method

(ImagingExperiment-class), 32cbind,MassDataFrame-method

(MassDataFrame-class), 38cbind,MSImagingExperiment-method

(MSImagingExperiment-class), 52cbind,PositionDataFrame-method

(PositionDataFrame-class), 82cbind,SparseImagingExperiment-method

(SparseImagingExperiment-class),105

cbind,SparseImagingResult-method(ImagingResult-class), 33

cbind,XDataFrame-method(XDataFrame-class), 120

centroided (MSImagingExperiment-class),52

centroided,MSImageProcess-method(MSImageProcess-class), 47

Page 125: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

INDEX 125

centroided,MSImageSet-method(MSImageSet-class), 49

centroided,MSImagingExperiment-method(MSImagingExperiment-class), 52

centroided<-(MSImagingExperiment-class), 52

centroided<-,MSImageProcess-method(MSImageProcess-class), 47

centroided<-,MSImageSet-method(MSImageSet-class), 49

centroided<-,MSImagingExperiment-method(MSImagingExperiment-class), 52

cividis, 35cividis (reexports), 91class:AnnotatedImage

(AnnotatedImage-class), 4class:AnnotatedImageList

(AnnotatedImagingExperiment-class),5

class:AnnotatedImagingExperiment(AnnotatedImagingExperiment-class),5

class:Binmat (defunct), 12class:Hashmat (Hashmat-class), 16class:IAnnotatedDataFrame

(IAnnotatedDataFrame-class), 19class:ImageArrayList (ImageList-class),

30class:ImageData (ImageData-class), 28class:ImageList (ImageList-class), 30class:ImagingExperiment

(ImagingExperiment-class), 32class:ImagingResult

(ImagingResult-class), 33class:iSet (iSet-class), 36class:MassDataFrame

(MassDataFrame-class), 38class:MeansTest (meansTest-methods), 39class:MIAPE-Imaging

(MIAPE-Imaging-class), 41class:MSContinuousImagingExperiment

(MSContinuousImagingExperiment-class),44

class:MSContinuousImagingSpectraList(ImageList-class), 30

class:MSImageData (MSImageData-class),44

class:MSImageProcess(MSImageProcess-class), 47

class:MSImageSet (MSImageSet-class), 49class:MSImagingExperiment

(MSImagingExperiment-class), 52

class:MSImagingInfo(MSImagingInfo-class), 54

class:MSProcessedImagingExperiment(MSProcessedImagingExperiment-class),55

class:MSProcessedImagingSpectraList(ImageList-class), 30

class:OPLS (PLS-methods), 80class:PCA (PCA-methods), 63class:PLS (PLS-methods), 80class:PositionDataFrame

(PositionDataFrame-class), 82class:ResultSet (ResultSet-class), 91class:SegmentationTest

(meansTest-methods), 39class:SImageData (SImageData-class), 93class:SImageSet (SImageSet-class), 96class:SimpleImageArrayList

(ImageList-class), 30class:SimpleImageList

(ImageList-class), 30class:SparseImagingExperiment

(SparseImagingExperiment-class),105

class:SparseImagingResult(ImagingResult-class), 33

class:SpatialDGMM(spatialDGMM-methods), 107

class:spatialFastmap(spatialFastmap-methods), 109

class:SpatialKMeans(spatialKMeans-methods), 111

class:SpatialShrunkenCentroids(spatialShrunkenCentroids-methods),113

class:SummaryDataFrame(SummaryDataFrame-class), 116

class:XDataFrame (XDataFrame-class), 120col.map (intensity.colors), 34collect (reexports), 91collect,MSImagingExperiment-method

(MSImagingExperiment-class), 52collect,MSProcessedImagingExperiment-method

(MSProcessedImagingExperiment-class),55

collect,SparseImagingExperiment-method(SparseImagingExperiment-class),105

colnames,Hashmat-method(Hashmat-class), 16

colnames<-,Hashmat-method(Hashmat-class), 16

Page 126: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

126 INDEX

colocalized (colocalized-methods), 8colocalized,MSImagingExperiment,missing-method

(colocalized-methods), 8colocalized,SparseImagingExperiment,ANY-method

(colocalized-methods), 8colocalized,SpatialDGMM,ANY-method

(colocalized-methods), 8colocalized-methods, 8color.map (intensity.colors), 34combine, 17, 29combine,AnnotatedImageList,ANY-method

(AnnotatedImagingExperiment-class),5

combine,array,array-method(ImageData-class), 28

combine,Hashmat,Hashmat-method(Hashmat-class), 16

combine,IAnnotatedDataFrame,IAnnotatedDataFrame-method(IAnnotatedDataFrame-class), 19

combine,ImageData,ImageData-method(ImageData-class), 28

combine,ImagingExperiment,ANY-method(ImagingExperiment-class), 32

combine,iSet,iSet-method (iSet-class),36

combine,MIAPE-Imaging,MIAPE-Imaging-method(MIAPE-Imaging-class), 41

combine,MSImageProcess,MSImageProcess-method(MSImageProcess-class), 47

combine,MSImageSet,MSImageSet-method(MSImageSet-class), 49

combine,SImageData,SImageData-method(SImageData-class), 93

combine,SImageSet,SImageSet-method(SImageSet-class), 96

combine,SparseImagingExperiment,ANY-method(SparseImagingExperiment-class),105

combine,SparseImagingResult,ANY-method(ImagingResult-class), 33

combine,vector,vector-method(ImageData-class), 28

combiner,MSProcessedImagingExperiment-method(MSProcessedImagingExperiment-class),55

combiner,MSProcessedImagingSpectraList-method(MSProcessedImagingExperiment-class),55

combiner<-,MSProcessedImagingExperiment-method(MSProcessedImagingExperiment-class),55

combiner<-,MSProcessedImagingSpectraList-method

(MSProcessedImagingExperiment-class),55

coord (PositionDataFrame-class), 82coord,AnnotatedImage-method

(AnnotatedImage-class), 4coord,AnnotatedImagingExperiment-method

(AnnotatedImagingExperiment-class),5

coord,IAnnotatedDataFrame-method(IAnnotatedDataFrame-class), 19

coord,iSet-method (iSet-class), 36coord,PositionDataFrame-method

(PositionDataFrame-class), 82coord,SImageData-method

(SImageData-class), 93coord,SparseImagingExperiment-method

(SparseImagingExperiment-class),105

coord-methods(PositionDataFrame-class), 82

coord<- (PositionDataFrame-class), 82coord<-,AnnotatedImage-method

(AnnotatedImage-class), 4coord<-,IAnnotatedDataFrame-method

(IAnnotatedDataFrame-class), 19coord<-,iSet-method (iSet-class), 36coord<-,PositionDataFrame-method

(PositionDataFrame-class), 82coord<-,SImageData-method

(SImageData-class), 93coord<-,SImageSet-method

(SImageSet-class), 96coord<-,SparseImagingExperiment-method

(SparseImagingExperiment-class),105

coordinates (PositionDataFrame-class),82

coordinates,AnnotatedImage-method(AnnotatedImage-class), 4

coordinates,AnnotatedImagingExperiment-method(AnnotatedImagingExperiment-class),5

coordinates,PositionDataFrame-method(PositionDataFrame-class), 82

coordinates,SparseImagingExperiment-method(SparseImagingExperiment-class),105

coordinates-methods(PositionDataFrame-class), 82

coordinates<-(PositionDataFrame-class), 82

coordinates<-,AnnotatedImage-method

Page 127: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

INDEX 127

(AnnotatedImage-class), 4coordinates<-,PositionDataFrame-method

(PositionDataFrame-class), 82coordinates<-,SparseImagingExperiment-method

(SparseImagingExperiment-class),105

coordLabels (PositionDataFrame-class),82

coordLabels,IAnnotatedDataFrame-method(IAnnotatedDataFrame-class), 19

coordLabels,iSet-method (iSet-class), 36coordLabels,PositionDataFrame-method

(PositionDataFrame-class), 82coordLabels,SparseImagingExperiment-method

(SparseImagingExperiment-class),105

coordLabels-methods(PositionDataFrame-class), 82

coordLabels<-(PositionDataFrame-class), 82

coordLabels<-,IAnnotatedDataFrame-method(IAnnotatedDataFrame-class), 19

coordLabels<-,iSet-method (iSet-class),36

coordLabels<-,PositionDataFrame-method(PositionDataFrame-class), 82

coordLabels<-,SImageSet-method(SImageSet-class), 96

coordLabels<-,SparseImagingExperiment-method(SparseImagingExperiment-class),105

coordnames (PositionDataFrame-class), 82coordnames,PositionDataFrame-method

(PositionDataFrame-class), 82coordnames,SparseImagingExperiment-method

(SparseImagingExperiment-class),105

coordnames-methods(PositionDataFrame-class), 82

coordnames<- (PositionDataFrame-class),82

coordnames<-,PositionDataFrame,ANY-method(PositionDataFrame-class), 82

coordnames<-,SparseImagingExperiment,ANY-method(SparseImagingExperiment-class),105

coregister (coregister-methods), 9coregister,SpatialKMeans,missing-method

(coregister-methods), 9coregister,SpatialShrunkenCentroids,missing-method

(coregister-methods), 9coregister-methods, 9

crossValidate (cvApply-methods), 10crossValidate,MSImagingExperiment-method

(cvApply-methods), 10crossValidate,SparseImagingExperiment-method

(cvApply-methods), 10crossValidate-methods

(cvApply-methods), 10cvApply (cvApply-methods), 10cvApply,SImageSet-method

(cvApply-methods), 10cvApply,SparseImagingExperiment-method

(cvApply-methods), 10cvApply-methods, 10

darkmode (intensity.colors), 34DataFrame, 6, 32, 82, 105, 106, 116, 120, 121defunct, 12deprecated, 12dim,AnnotatedImageList-method

(AnnotatedImagingExperiment-class),5

dim,Hashmat-method (Hashmat-class), 16dim,ImageData-method (ImageData-class),

28dim,ImageList-method (ImageList-class),

30dim,ImagingExperiment-method

(ImagingExperiment-class), 32dim,iSet-method (iSet-class), 36dim,SImageData-method

(SImageData-class), 93dim,SparseImagingExperiment-method

(SparseImagingExperiment-class),105

dim<-,Hashmat-method (Hashmat-class), 16dimnames,Hashmat-method

(Hashmat-class), 16dimnames,ImagingExperiment-method

(ImagingExperiment-class), 32dimnames<-,Hashmat,ANY-method

(Hashmat-class), 16dimnames<-,Hashmat-method

(Hashmat-class), 16dims,AnnotatedImageList-method

(AnnotatedImagingExperiment-class),5

dims,AnnotatedImagingExperiment-method(AnnotatedImagingExperiment-class),5

dims,ImageData-method(ImageData-class), 28

dims,ImageList-method(ImageList-class), 30

Page 128: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

128 INDEX

dims,iSet-method (iSet-class), 36dims,PositionDataFrame-method

(PositionDataFrame-class), 82dims,SImageData-method

(SImageData-class), 93dims,SparseImagingExperiment-method

(SparseImagingExperiment-class),105

discrete.colors (intensity.colors), 34divergent.colors (intensity.colors), 34dplyr-methods, 13

embeddingMethod (MIAPE-Imaging-class),41

embeddingMethod,MIAPE-Imaging-method(MIAPE-Imaging-class), 41

eSet, 38experimentData,iSet-method

(iSet-class), 36experimentData<-,iSet,ANY-method

(iSet-class), 36expinfo,MIAPE-Imaging-method

(MIAPE-Imaging-class), 41

fData (ImagingExperiment-class), 32fData,ImagingExperiment-method

(ImagingExperiment-class), 32fData,iSet-method (iSet-class), 36fData-methods

(ImagingExperiment-class), 32fData<- (ImagingExperiment-class), 32fData<-,ImagingExperiment,ANY-method

(ImagingExperiment-class), 32fData<-,iSet,ANY-method (iSet-class), 36fData<-,iSet-method (iSet-class), 36featureApply, 61, 85, 116featureApply (pixelApply-methods), 70featureApply,SImageSet-method

(pixelApply-methods), 70featureApply,SparseImagingExperiment-method

(pixelApply-methods), 70featureApply-methods

(pixelApply-methods), 70featureData (ImagingExperiment-class),

32featureData,ImagingExperiment-method

(ImagingExperiment-class), 32featureData,iSet-method (iSet-class), 36featureData-methods

(ImagingExperiment-class), 32featureData<-

(ImagingExperiment-class), 32

featureData<-,ImagingExperiment,ANY-method(ImagingExperiment-class), 32

featureData<-,ImagingExperiment-method(ImagingExperiment-class), 32

featureData<-,iSet,ANY-method(iSet-class), 36

featureData<-,iSet-method (iSet-class),36

featureNames (ImagingExperiment-class),32

featureNames,ImagingExperiment-method(ImagingExperiment-class), 32

featureNames,iSet-method (iSet-class),36

featureNames,SImageData-method(SImageData-class), 93

featureNames-methods(ImagingExperiment-class), 32

featureNames<-(ImagingExperiment-class), 32

featureNames<-,ImagingExperiment-method(ImagingExperiment-class), 32

featureNames<-,iSet-method(iSet-class), 36

featureNames<-,SImageData-method(SImageData-class), 93

featureNames<-,SImageSet-method(SImageSet-class), 96

features(SparseImagingExperiment-class),105

features,iSet-method (iSet-class), 36features,MSImageSet-method

(MSImageSet-class), 49features,MSImagingExperiment-method

(MSImagingExperiment-class), 52features,SparseImagingExperiment-method

(SparseImagingExperiment-class),105

features-methods(SparseImagingExperiment-class),105

filter (dplyr-methods), 13findNeighbors (findNeighbors-methods),

14findNeighbors,IAnnotatedDataFrame-method

(findNeighbors-methods), 14findNeighbors,ImagingExperiment-method

(findNeighbors-methods), 14findNeighbors,iSet-method

(findNeighbors-methods), 14findNeighbors,PositionDataFrame-method

Page 129: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

INDEX 129

(findNeighbors-methods), 14findNeighbors-methods, 14fitted,PLS2-method (PLS-methods), 80fitted,SpatialShrunkenCentroids2-method

(spatialShrunkenCentroids-methods),113

fvarLabels,iSet-method (iSet-class), 36fvarLabels<-,iSet-method (iSet-class),

36fvarMetadata,iSet-method (iSet-class),

36fvarMetadata<-,iSet,ANY-method

(iSet-class), 36fvarMetadata<-,iSet-method

(iSet-class), 36

generateImage (deprecated), 12generateSpectrum (deprecated), 12gradient.colors (intensity.colors), 34gridded,PositionDataFrame-method

(PositionDataFrame-class), 82gridded,SparseImagingExperiment-method

(SparseImagingExperiment-class),105

gridded<-,PositionDataFrame,ANY-method(PositionDataFrame-class), 82

gridded<-,SparseImagingExperiment,ANY-method(SparseImagingExperiment-class),105

group_by (reexports), 91groups (reexports), 91groups,XDataFrame-method

(XDataFrame-class), 120

Hashmat, 96Hashmat (Hashmat-class), 16Hashmat-class, 16height (AnnotatedImage-class), 4height,AnnotatedImage-method

(AnnotatedImage-class), 4height,AnnotatedImagingExperiment-method

(AnnotatedImagingExperiment-class),5

height<- (AnnotatedImage-class), 4height<-,AnnotatedImage-method

(AnnotatedImage-class), 4

IAnnotatedDataFrame, 29, 36, 50, 83, 97IAnnotatedDataFrame

(IAnnotatedDataFrame-class), 19IAnnotatedDataFrame-class, 19iData (ImagingExperiment-class), 32

iData,ImagingExperiment,ANY-method(ImagingExperiment-class), 32

iData,ImagingExperiment,missing-method(ImagingExperiment-class), 32

iData,iSet-method (iSet-class), 36iData,SImageData,ANY-method

(SImageData-class), 93iData,SImageSet,ANY-method

(SImageSet-class), 96iData-methods

(ImagingExperiment-class), 32iData<- (ImagingExperiment-class), 32iData<-,ImagingExperiment,ANY-method

(ImagingExperiment-class), 32iData<-,ImagingExperiment,missing-method

(ImagingExperiment-class), 32iData<-,iSet-method (iSet-class), 36iData<-,MSContinuousImagingExperiment,ANY-method

(MSContinuousImagingExperiment-class),44

iData<-,MSProcessedImagingExperiment,ANY-method(MSProcessedImagingExperiment-class),55

iData<-,SImageData,ANY-method(SImageData-class), 93

iData<-,SImageSet,ANY-method(SImageSet-class), 96

Image, 4, 5image, 16, 79, 92, 93image (image-methods), 21image,AnnotatedImage-method

(image-methods), 21image,AnnotatedImageList-method

(image-methods), 21image,AnnotatedImagingExperiment-method

(image-methods), 21image,CrossValidated-method

(image-methods), 21image,formula-method (image-methods), 21image,MeansTest-method (image-methods),

21image,MSImageSet-method

(image-methods), 21image,MSImagingExperiment-method

(image-methods), 21image,MSImagingSummary-method

(image-methods), 21image,OPLS-method (image-methods), 21image,PCA-method (image-methods), 21image,PCA2-method (image-methods), 21image,PLS-method (image-methods), 21image,PLS2-method (image-methods), 21

Page 130: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

130 INDEX

image,PositionDataFrame-method(image-methods), 21

image,ResultSet-method (image-methods),21

image,SegmentationTest-method(image-methods), 21

image,SImageSet-method (image-methods),21

image,SparseImagingExperiment-method(image-methods), 21

image,SparseImagingResult-method(image-methods), 21

image,SparseImagingSummary-method(image-methods), 21

image,SpatialDGMM-method(image-methods), 21

image,SpatialFastmap-method(image-methods), 21

image,SpatialFastmap2-method(image-methods), 21

image,SpatialKMeans-method(image-methods), 21

image,SpatialKMeans2-method(image-methods), 21

image,SpatialShrunkenCentroids-method(image-methods), 21

image,SpatialShrunkenCentroids2-method(image-methods), 21

image-methods, 21image3D (image-methods), 21image3D,CrossValidated-method

(image-methods), 21image3D,MeansTest-method

(image-methods), 21image3D,MSImageSet-method

(image-methods), 21image3D,OPLS-method (image-methods), 21image3D,PCA-method (image-methods), 21image3D,PCA2-method (image-methods), 21image3D,PLS-method (image-methods), 21image3D,PLS2-method (image-methods), 21image3D,ResultSet-method

(image-methods), 21image3D,SegmentationTest-method

(image-methods), 21image3D,SImageSet-method

(image-methods), 21image3D,SparseImagingExperiment-method

(image-methods), 21image3D,SpatialDGMM-method

(image-methods), 21image3D,SpatialFastmap-method

(image-methods), 21image3D,SpatialFastmap2-method

(image-methods), 21image3D,SpatialKMeans-method

(image-methods), 21image3D,SpatialKMeans2-method

(image-methods), 21image3D,SpatialShrunkenCentroids-method

(image-methods), 21image3D,SpatialShrunkenCentroids2-method

(image-methods), 21image3D-methods (image-methods), 21ImageArrayList, 33, 52, 53, 105, 106ImageArrayList (ImageList-class), 30ImageArrayList-class (ImageList-class),

30ImageData, 31, 36, 46, 95ImageData (ImageData-class), 28imageData (ImagingExperiment-class), 32imageData,ImagingExperiment-method

(ImagingExperiment-class), 32imageData,iSet-method (iSet-class), 36ImageData-class, 28imageData-methods

(ImagingExperiment-class), 32imageData<- (ImagingExperiment-class),

32imageData<-,ImagingExperiment-method

(ImagingExperiment-class), 32imageData<-,iSet-method (iSet-class), 36imageData<-,MSContinuousImagingExperiment-method

(MSContinuousImagingExperiment-class),44

imageData<-,MSProcessedImagingExperiment-method(MSProcessedImagingExperiment-class),55

ImageList, 32ImageList (ImageList-class), 30ImageList-class, 30imageShape (MIAPE-Imaging-class), 41imageShape,MIAPE-Imaging-method

(MIAPE-Imaging-class), 41ImagingExperiment, 6, 30, 34, 53, 105–107ImagingExperiment

(ImagingExperiment-class), 32ImagingExperiment-class, 32ImagingResult, 11, 12ImagingResult (ImagingResult-class), 33ImagingResult-class, 33inferno, 35inferno (reexports), 91initialize,Hashmat-method

Page 131: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

INDEX 131

(Hashmat-class), 16initialize,IAnnotatedDataFrame-method

(IAnnotatedDataFrame-class), 19initialize,ImageData-method

(ImageData-class), 28initialize,iSet-method (iSet-class), 36initialize,MassDataFrame-method

(MassDataFrame-class), 38initialize,MSImageData-method

(MSImageData-class), 44initialize,MSImageProcess-method

(MSImageProcess-class), 47initialize,MSImageSet-method

(MSImageSet-class), 49initialize,PositionDataFrame-method

(PositionDataFrame-class), 82initialize,SImageData-method

(SImageData-class), 93initialize,SImageSet-method

(SImageSet-class), 96inSituChemistry (MIAPE-Imaging-class),

41inSituChemistry,MIAPE-Imaging-method

(MIAPE-Imaging-class), 41instrumentModel (MSImagingInfo-class),

54instrumentModel,MIAPE-Imaging-method

(MIAPE-Imaging-class), 41instrumentModel,Vector-method

(MSImagingInfo-class), 54instrumentVendor (MSImagingInfo-class),

54instrumentVendor,MIAPE-Imaging-method

(MIAPE-Imaging-class), 41instrumentVendor,Vector-method

(MSImagingInfo-class), 54intensity.colors, 34intensityData

(MSProcessedImagingExperiment-class),55

intensityData,MSImagingInfo-method(MSImagingInfo-class), 54

intensityData,MSProcessedImagingExperiment-method(MSProcessedImagingExperiment-class),55

intensityData-methods(MSProcessedImagingExperiment-class),55

intensityData<-(MSProcessedImagingExperiment-class),55

intensityData<-,MSProcessedImagingExperiment-method

(MSProcessedImagingExperiment-class),55

ionizationType (MSImagingInfo-class), 54ionizationType,MIAPE-Imaging-method

(MIAPE-Imaging-class), 41ionizationType,Vector-method

(MSImagingInfo-class), 54irlba, 64is3D (SparseImagingExperiment-class),

105is3D,IAnnotatedDataFrame-method

(IAnnotatedDataFrame-class), 19is3D,PositionDataFrame-method

(PositionDataFrame-class), 82is3D,SImageSet-method

(SImageSet-class), 96is3D,SparseImagingExperiment-method

(SparseImagingExperiment-class),105

isCentroided(MSImagingExperiment-class), 52

isCentroided,MassDataFrame-method(MassDataFrame-class), 38

isCentroided,MSImagingExperiment-method(MSImagingExperiment-class), 52

isCentroided,MSImagingInfo-method(MSImagingInfo-class), 54

iSet, 21, 49–51, 91, 92, 96, 98iSet (iSet-class), 36iSet-class, 36

jet.colors (intensity.colors), 34

keys (Hashmat-class), 16keys,Hashmat-method (Hashmat-class), 16keys,MSProcessedImagingSpectraList-method

(MSProcessedImagingExperiment-class),55

keys<- (Hashmat-class), 16keys<-,Hashmat,character-method

(Hashmat-class), 16keys<-,Hashmat,list-method

(Hashmat-class), 16keys<-,Hashmat-method (Hashmat-class),

16keys<-,MSProcessedImagingSpectraList,ANY-method

(MSProcessedImagingExperiment-class),55

kmeans, 112

lapply,XDataFrame-method(XDataFrame-class), 120

Page 132: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

132 INDEX

length,AnnotatedImage-method(AnnotatedImage-class), 4

length,ImageList-method(ImageList-class), 30

length,ImagingExperiment-method(ImagingExperiment-class), 32

length,iSet-method (iSet-class), 36length,MSImagingInfo-method

(MSImagingInfo-class), 54length,ResultSet-method

(ResultSet-class), 91length,XDataFrame-method

(XDataFrame-class), 120levelplot, 26, 27, 78, 79lightmode (intensity.colors), 34lineScanDirection

(MSImagingInfo-class), 54lineScanDirection,MIAPE-Imaging-method

(MIAPE-Imaging-class), 41lineScanDirection,Vector-method

(MSImagingInfo-class), 54lm, 40lme, 40locator, 92logLik,SpatialShrunkenCentroids-method

(spatialShrunkenCentroids-methods),113

logLik,SpatialShrunkenCentroids2-method(spatialShrunkenCentroids-methods),113

magma, 35magma (reexports), 91makeFactor (selectROI-methods), 92massAnalyzerType (MSImagingInfo-class),

54massAnalyzerType,MIAPE-Imaging-method

(MIAPE-Imaging-class), 41massAnalyzerType,Vector-method

(MSImagingInfo-class), 54MassDataFrame, 52, 53, 57, 100, 121MassDataFrame (MassDataFrame-class), 38MassDataFrame-class, 38matrix, 18matrixApplication

(MSImagingInfo-class), 54matrixApplication,MIAPE-Imaging-method

(MIAPE-Imaging-class), 41matrixApplication,Vector-method

(MSImagingInfo-class), 54matter, 86matter_mat, 12, 44meansTest, 118

meansTest (meansTest-methods), 39meansTest,SparseImagingExperiment-method

(meansTest-methods), 39MeansTest-class (meansTest-methods), 39meansTest-methods, 39MIAPE-Imaging (MIAPE-Imaging-class), 41MIAPE-Imaging-class, 41MIAxE, 36, 42, 43, 50, 55, 97modelData (ImagingResult-class), 33modelData,ImagingResult-method

(ImagingResult-class), 33modelData,ResultSet-method

(ResultSet-class), 91modelData<- (ImagingResult-class), 33modelData<-,ImagingResult-method

(ImagingResult-class), 33modelData<-,ResultSet-method

(ResultSet-class), 91MSContinuousImagingExperiment, 6, 52, 53,

56MSContinuousImagingExperiment

(MSContinuousImagingExperiment-class),44

MSContinuousImagingExperiment-class,44

MSContinuousImagingSpectraList(ImageList-class), 30

MSContinuousImagingSpectraList-class(ImageList-class), 30

msiInfo (MSImagingInfo-class), 54msiInfo,MIAPE-Imaging-method

(MIAPE-Imaging-class), 41msiInfo,MSContinuousImagingExperiment-method

(MSImagingInfo-class), 54msiInfo,MSImageSet-method

(MSImagingInfo-class), 54msiInfo,MSImagingExperiment-method

(MSImagingInfo-class), 54msiInfo,MSProcessedImagingExperiment-method

(MSImagingInfo-class), 54MSImageData, 95MSImageData (MSImageData-class), 44MSImageData-class, 44MSImageProcess, 50MSImageProcess (MSImageProcess-class),

47MSImageProcess-class, 47MSImageSet, 6–8, 21, 30, 36, 38, 42, 43,

46–48, 52, 60, 61, 63, 66, 69, 73, 87,89–91, 95, 96, 98, 104, 115, 116

MSImageSet (MSImageSet-class), 49MSImageSet-class, 49

Page 133: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

INDEX 133

MSImagingExperiment, 11, 32, 33, 44, 55, 56,58, 59, 61, 63, 66, 67, 69, 73, 85, 89,101, 104, 105, 107

MSImagingExperiment(MSImagingExperiment-class), 52

MSImagingExperiment-class, 52MSImagingInfo (MSImagingInfo-class), 54MSImagingInfo-class, 54MSProcessedImagingExperiment, 6, 44, 52,

53MSProcessedImagingExperiment

(MSProcessedImagingExperiment-class),55

MSProcessedImagingExperiment-class, 55MSProcessedImagingSpectraList

(ImageList-class), 30MSProcessedImagingSpectraList-class

(ImageList-class), 30mutate (dplyr-methods), 13mz (mz-methods), 56mz,MassDataFrame-method

(MassDataFrame-class), 38mz,missing-method (mz-methods), 56mz,MSImageSet-method

(MSImageSet-class), 49mz,MSImagingExperiment-method

(MSImagingExperiment-class), 52mz-methods, 56mz<- (mz-methods), 56mz<-,MassDataFrame-method

(MassDataFrame-class), 38mz<-,MSImageSet-method

(MSImageSet-class), 49mz<-,MSImagingExperiment-method

(MSImagingExperiment-class), 52mz<-,MSProcessedImagingExperiment-method

(MSProcessedImagingExperiment-class),55

mzAlign, 59mzAlign (mzAlign-methods), 57mzAlign,MSImagingExperiment,missing-method

(mzAlign-methods), 57mzAlign,MSImagingExperiment,numeric-method

(mzAlign-methods), 57mzAlign-methods, 57mzBin, 58mzBin (mzBin-methods), 58mzBin,MSImagingExperiment,missing-method

(mzBin-methods), 58mzBin,MSImagingExperiment,numeric-method

(mzBin-methods), 58mzBin-methods, 58

mzData(MSProcessedImagingExperiment-class),55

mzData,MSImageData-method(MSImageData-class), 44

mzData,MSImagingInfo-method(MSImagingInfo-class), 54

mzData,MSProcessedImagingExperiment-method(MSProcessedImagingExperiment-class),55

mzData,SImageData-method(SImageData-class), 93

mzData-methods(MSProcessedImagingExperiment-class),55

mzData<-(MSProcessedImagingExperiment-class),55

mzData<-,MSImageData-method(MSImageData-class), 44

mzData<-,MSProcessedImagingExperiment-method(MSProcessedImagingExperiment-class),55

mzData<-,SImageData-method(SImageData-class), 93

mzFilter (mzFilter-methods), 60mzFilter,MSImagingExperiment-method

(mzFilter-methods), 60mzFilter-methods, 60

names,ImageData-method(ImageData-class), 28

names,ImageList-method(ImageList-class), 30

names,ImagingExperiment-method(ImagingExperiment-class), 32

names,ResultSet-method(ResultSet-class), 91

names,XDataFrame-method(XDataFrame-class), 120

names<-,ImageData-method(ImageData-class), 28

names<-,ImageList-method(ImageList-class), 30

names<-,ImagingExperiment-method(ImagingExperiment-class), 32

normalization (MSImagingInfo-class), 54normalization,MSImageProcess-method

(MSImageProcess-class), 47normalization,Vector-method

(MSImagingInfo-class), 54normalization<- (MSImagingInfo-class),

54

Page 134: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

134 INDEX

normalization<-,MSImageProcess-method(MSImageProcess-class), 47

normalization<-,Vector-method(MSImagingInfo-class), 54

normalize, 8, 85normalize (normalize-methods), 62normalize,MSImageSet-method

(normalize-methods), 62normalize,SparseImagingExperiment-method

(normalize-methods), 62normalize-methods, 62normalize.reference

(normalize-methods), 62normalize.rms (normalize-methods), 62normalize.tic (normalize-methods), 62notes,MIAPE-Imaging-method

(MIAPE-Imaging-class), 41notes<-,MIAPE-Imaging,character-method

(MIAPE-Imaging-class), 41notes<-,MIAPE-Imaging,list-method

(MIAPE-Imaging-class), 41

OPLS, 12, 64, 91, 92OPLS (PLS-methods), 80OPLS,SImageSet,ANY-method

(PLS-methods), 80OPLS,SImageSet,matrix-method

(PLS-methods), 80OPLS,SparseImagingExperiment,ANY-method

(PLS-methods), 80OPLS-class (PLS-methods), 80OPLS-methods (PLS-methods), 80otherInfo,MIAPE-Imaging-method

(MIAPE-Imaging-class), 41

PCA, 64, 82, 91, 92, 110PCA (PCA-methods), 63PCA,SImageSet-method (PCA-methods), 63PCA,SparseImagingExperiment-method

(PCA-methods), 63PCA-class (PCA-methods), 63PCA-methods, 63pData (ImagingExperiment-class), 32pData,Hashmat-method (Hashmat-class), 16pData,ImagingExperiment-method

(ImagingExperiment-class), 32pData,iSet-method (iSet-class), 36pData-methods

(ImagingExperiment-class), 32pData<- (ImagingExperiment-class), 32pData<-,Hashmat,ANY-method

(Hashmat-class), 16

pData<-,Hashmat-method (Hashmat-class),16

pData<-,ImagingExperiment,ANY-method(ImagingExperiment-class), 32

pData<-,iSet,ANY-method (iSet-class), 36pData<-,iSet-method (iSet-class), 36peakAlign, 45, 58, 61, 67, 69, 85, 91peakAlign (peakAlign-methods), 65peakAlign,MSImageSet,missing-method

(peakAlign-methods), 65peakAlign,MSImageSet,MSImageSet-method

(peakAlign-methods), 65peakAlign,MSImageSet,numeric-method

(peakAlign-methods), 65peakAlign,MSImagingExperiment,character-method

(peakAlign-methods), 65peakAlign,MSImagingExperiment,missing-method

(peakAlign-methods), 65peakAlign,MSImagingExperiment,numeric-method

(peakAlign-methods), 65peakAlign-methods, 65peakAlign.diff (peakAlign-methods), 65peakAlign.DP (peakAlign-methods), 65peakBin, 59, 61, 66, 69, 85peakBin (peakBin-methods), 67peakBin,MSImagingExperiment,missing-method

(peakBin-methods), 67peakBin,MSImagingExperiment,numeric-method

(peakBin-methods), 67peakBin-methods, 67peakData (MSImagingExperiment-class), 52peakData,MSImageData-method

(MSImageData-class), 44peakData,MSImagingExperiment-method

(MSImagingExperiment-class), 52peakData,SImageData-method

(SImageData-class), 93peakData-methods

(MSImagingExperiment-class), 52peakData<- (MSImagingExperiment-class),

52peakData<-,MSImageData-method

(MSImageData-class), 44peakData<-,MSImagingExperiment-method

(MSImagingExperiment-class), 52peakData<-,SImageData-method

(SImageData-class), 93peakFilter, 66, 67, 69, 85peakFilter (mzFilter-methods), 60peakFilter,MSImageSet-method

(mzFilter-methods), 60peakFilter,MSImagingExperiment-method

Page 135: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

INDEX 135

(mzFilter-methods), 60peakFilter-methods (mzFilter-methods),

60peakFilter.freq (mzFilter-methods), 60peakPick, 8, 61, 66, 67, 85, 91peakPick (peakPick-methods), 68peakPick,MSImageSet-method

(peakPick-methods), 68peakPick,MSImagingExperiment-method

(peakPick-methods), 68peakPick-methods, 68peakPick.adaptive (peakPick-methods), 68peakPick.limpic (peakPick-methods), 68peakPick.mad (peakPick-methods), 68peakPick.simple (peakPick-methods), 68peakPicking (MSImagingInfo-class), 54peakPicking,MSImageProcess-method

(MSImageProcess-class), 47peakPicking,Vector-method

(MSImagingInfo-class), 54peakPicking<- (MSImagingInfo-class), 54peakPicking<-,MSImageProcess-method

(MSImageProcess-class), 47peakPicking<-,Vector-method

(MSImagingInfo-class), 54peaks (MSImagingExperiment-class), 52peaks,MSImageSet-method

(MSImageSet-class), 49peaks,MSImagingExperiment-method

(MSImagingExperiment-class), 52peaks-methods

(MSImagingExperiment-class), 52peaks<- (MSImagingExperiment-class), 52peaks<-,MSImageSet-method

(MSImageSet-class), 49peaks<-,MSImagingExperiment-method

(MSImagingExperiment-class), 52phenoData (ImagingExperiment-class), 32phenoData,ImagingExperiment-method

(ImagingExperiment-class), 32phenoData-methods

(ImagingExperiment-class), 32phenoData<- (ImagingExperiment-class),

32phenoData<-,ImagingExperiment,ANY-method

(ImagingExperiment-class), 32pixelApply, 8, 58, 59, 63, 66, 67, 69, 85,

88–91, 104pixelApply (pixelApply-methods), 70pixelApply,SImageSet-method

(pixelApply-methods), 70pixelApply,SparseImagingExperiment-method

(pixelApply-methods), 70pixelApply-methods, 70pixelData (ImagingExperiment-class), 32pixelData,ImagingExperiment-method

(ImagingExperiment-class), 32pixelData,iSet-method (iSet-class), 36pixelData,SparseImagingExperiment-method

(SparseImagingExperiment-class),105

pixelData-methods(ImagingExperiment-class), 32

pixelData<- (ImagingExperiment-class),32

pixelData<-,ImagingExperiment-method(ImagingExperiment-class), 32

pixelData<-,iSet-method (iSet-class), 36pixelData<-,SparseImagingExperiment-method

(SparseImagingExperiment-class),105

pixelNames (ImagingExperiment-class), 32pixelNames,IAnnotatedDataFrame-method

(IAnnotatedDataFrame-class), 19pixelNames,ImagingExperiment-method

(ImagingExperiment-class), 32pixelNames,iSet-method (iSet-class), 36pixelNames,SImageData-method

(SImageData-class), 93pixelNames,SparseImagingExperiment-method

(SparseImagingExperiment-class),105

pixelNames-methods(ImagingExperiment-class), 32

pixelNames<- (ImagingExperiment-class),32

pixelNames<-,IAnnotatedDataFrame-method(IAnnotatedDataFrame-class), 19

pixelNames<-,ImagingExperiment-method(ImagingExperiment-class), 32

pixelNames<-,iSet-method (iSet-class),36

pixelNames<-,SImageData-method(SImageData-class), 93

pixelNames<-,SImageSet-method(SImageSet-class), 96

pixelNames<-,SparseImagingExperiment-method(SparseImagingExperiment-class),105

pixels (SparseImagingExperiment-class),105

pixels,iSet-method (iSet-class), 36pixels,MSImageSet-method

(MSImageSet-class), 49

Page 136: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

136 INDEX

pixels,MSImagingExperiment-method(MSImagingExperiment-class), 52

pixels,SparseImagingExperiment-method(SparseImagingExperiment-class),105

pixels-methods(SparseImagingExperiment-class),105

pixelSize (MSImagingInfo-class), 54pixelSize,MIAPE-Imaging-method

(MIAPE-Imaging-class), 41pixelSize,Vector-method

(MSImagingInfo-class), 54plasma, 35plasma (reexports), 91plot, 27, 28, 79plot (plot-methods), 74plot,AnnotatedImage,ANY-method

(plot-methods), 74plot,AnnotatedImageList,ANY-method

(plot-methods), 74plot,AnnotatedImagingExperiment,ANY-method

(plot-methods), 74plot,CrossValidated,missing-method

(plot-methods), 74plot,DataFrame,ANY-method

(plot-methods), 74plot,MassDataFrame,formula-method

(plot-methods), 74plot,MassDataFrame,missing-method

(plot-methods), 74plot,MeansTest,missing-method

(plot-methods), 74plot,MSImageSet,formula-method

(plot-methods), 74plot,MSImageSet,missing-method

(plot-methods), 74plot,MSImagingExperiment,formula-method

(plot-methods), 74plot,MSImagingExperiment,missing-method

(plot-methods), 74plot,MSImagingSummary,missing-method

(plot-methods), 74plot,OPLS,missing-method

(plot-methods), 74plot,PCA,missing-method (plot-methods),

74plot,PCA2,missing-method

(plot-methods), 74plot,PLS,missing-method (plot-methods),

74plot,PLS2,missing-method

(plot-methods), 74plot,ResultSet,formula-method

(plot-methods), 74plot,ResultSet,missing-method

(plot-methods), 74plot,SegmentationTest,missing-method

(plot-methods), 74plot,SImageSet,formula-method

(plot-methods), 74plot,SImageSet,missing-method

(plot-methods), 74plot,SparseImagingExperiment,formula-method

(plot-methods), 74plot,SparseImagingExperiment,missing-method

(plot-methods), 74plot,SparseImagingResult,formula-method

(plot-methods), 74plot,SparseImagingResult,missing-method

(plot-methods), 74plot,SparseImagingSummary,formula-method

(plot-methods), 74plot,SparseImagingSummary,missing-method

(plot-methods), 74plot,SpatialDGMM,missing-method

(plot-methods), 74plot,SpatialFastmap,missing-method

(plot-methods), 74plot,SpatialFastmap2,missing-method

(plot-methods), 74plot,SpatialKMeans,missing-method

(plot-methods), 74plot,SpatialKMeans2,missing-method

(plot-methods), 74plot,SpatialShrunkenCentroids,missing-method

(plot-methods), 74plot,SpatialShrunkenCentroids2,missing-method

(plot-methods), 74plot,XDataFrame,formula-method

(plot-methods), 74plot,XDataFrame,missing-method

(plot-methods), 74plot-methods, 74plot.summary.CrossValidated

(cvApply-methods), 10plot.summary.OPLS (PLS-methods), 80plot.summary.PCA (PCA-methods), 63plot.summary.PLS (PLS-methods), 80plot.summary.SpatialFastmap

(spatialFastmap-methods), 109plot.summary.SpatialKMeans

(spatialKMeans-methods), 111plot.summary.SpatialShrunkenCentroids

Page 137: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

INDEX 137

(spatialShrunkenCentroids-methods),113

PLS, 12, 64, 81, 91, 92PLS (PLS-methods), 80PLS,SImageSet,ANY-method (PLS-methods),

80PLS,SImageSet,matrix-method

(PLS-methods), 80PLS,SparseImagingExperiment,ANY-method

(PLS-methods), 80PLS-class (PLS-methods), 80PLS-methods, 80positionArray (SImageData-class), 93positionArray,SImageData-method

(SImageData-class), 93positionArray<- (SImageData-class), 93positionArray<-,SImageData-method

(SImageData-class), 93PositionDataFrame, 33, 52, 53, 100, 101,

105, 106, 121PositionDataFrame

(PositionDataFrame-class), 82PositionDataFrame-class, 82predict,OPLS-method (PLS-methods), 80predict,PCA-method (PCA-methods), 63predict,PCA2-method (PCA-methods), 63predict,PLS-method (PLS-methods), 80predict,PLS2-method (PLS-methods), 80predict,SpatialShrunkenCentroids-method

(spatialShrunkenCentroids-methods),113

predict,SpatialShrunkenCentroids2-method(spatialShrunkenCentroids-methods),113

preproc,MIAPE-Imaging-method(MIAPE-Imaging-class), 41

preproc,SparseImagingExperiment-method(SparseImagingExperiment-class),105

preproc<-,MIAPE-Imaging-method(MIAPE-Imaging-class), 41

presetImageDef, 100presetImageDef (simulateSpectrum), 99print.summary.CrossValidated

(cvApply-methods), 10print.summary.iSet (iSet-class), 36print.summary.OPLS (PLS-methods), 80print.summary.PCA (PCA-methods), 63print.summary.PLS (PLS-methods), 80print.summary.SpatialFastmap

(spatialFastmap-methods), 109print.summary.SpatialKMeans

(spatialKMeans-methods), 111print.summary.SpatialShrunkenCentroids

(spatialShrunkenCentroids-methods),113

process, 58, 59, 61, 63, 66, 67, 69, 89, 104process (process-methods), 84process,MSImagingExperiment-method

(process-methods), 84process,SparseImagingExperiment-method

(process-methods), 84process-methods, 84processingData (MSImageSet-class), 49processingData,MSImageSet-method

(MSImageSet-class), 49processingData,SparseImagingExperiment-method

(SparseImagingExperiment-class),105

processingData-methods(MSImageSet-class), 49

processingData<- (MSImageSet-class), 49processingData<-,MSImageSet-method

(MSImageSet-class), 49processingData<-,SparseImagingExperiment-method

(SparseImagingExperiment-class),105

protocolData,iSet-method (iSet-class),36

protocolData<-,iSet,ANY-method(iSet-class), 36

pubMedIds,MIAPE-Imaging-method(MIAPE-Imaging-class), 41

pubMedIds<-,MIAPE-Imaging,ANY-method(MIAPE-Imaging-class), 41

range,AnnotatedImage-method(AnnotatedImage-class), 4

rbind,AnnotatedImageList-method(AnnotatedImagingExperiment-class),5

rbind,Hashmat-method (Hashmat-class), 16rbind,ImageArrayList-method

(ImageList-class), 30rbind,ImagingExperiment-method

(ImagingExperiment-class), 32rbind,MassDataFrame-method

(MassDataFrame-class), 38rbind,MSImagingExperiment-method

(MSImagingExperiment-class), 52rbind,PositionDataFrame-method

(PositionDataFrame-class), 82rbind,SparseImagingExperiment-method

(SparseImagingExperiment-class),105

Page 138: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

138 INDEX

rbind,SparseImagingResult-method(ImagingResult-class), 33

rbind,XDataFrame-method(XDataFrame-class), 120

readAnalyze (readMSIData), 86readImzML, 100readImzML (readMSIData), 86readMSIData, 86, 120reduceBaseline, 8, 85reduceBaseline

(reduceBaseline-methods), 87reduceBaseline,MSImageSet-method

(reduceBaseline-methods), 87reduceBaseline,SparseImagingExperiment-method

(reduceBaseline-methods), 87reduceBaseline-methods, 87reduceBaseline.locmin

(reduceBaseline-methods), 87reduceBaseline.median

(reduceBaseline-methods), 87reduceDimension, 59, 61, 66, 67, 69reduceDimension

(reduceDimension-methods), 89reduceDimension,MSImageSet,missing-method

(reduceDimension-methods), 89reduceDimension,MSImageSet,MSImageSet-method

(reduceDimension-methods), 89reduceDimension,MSImageSet,numeric-method

(reduceDimension-methods), 89reduceDimension-methods, 89reduceDimension.bin

(reduceDimension-methods), 89reduceDimension.peaks

(reduceDimension-methods), 89reduceDimension.resample

(reduceDimension-methods), 89reexports, 91regeneratePositions (SImageData-class),

93regeneratePositions,SImageData-method

(SImageData-class), 93regeneratePositions,SImageSet-method

(SImageSet-class), 96resolution (PositionDataFrame-class), 82resolution,AnnotatedImage-method

(AnnotatedImage-class), 4resolution,AnnotatedImagingExperiment-method

(AnnotatedImagingExperiment-class),5

resolution,MassDataFrame-method(MassDataFrame-class), 38

resolution,MSImagingExperiment-method

(MSImagingExperiment-class), 52resolution,PositionDataFrame-method

(PositionDataFrame-class), 82resolution,SparseImagingExperiment-method

(SparseImagingExperiment-class),105

resolution<- (PositionDataFrame-class),82

resolution<-,AnnotatedImage-method(AnnotatedImage-class), 4

resolution<-,MassDataFrame-method(MassDataFrame-class), 38

resolution<-,MSImagingExperiment-method(MSImagingExperiment-class), 52

resolution<-,MSProcessedImagingExperiment-method(MSProcessedImagingExperiment-class),55

resolution<-,PositionDataFrame-method(PositionDataFrame-class), 82

resolution<-,SparseImagingExperiment-method(SparseImagingExperiment-class),105

resultData (ImagingResult-class), 33resultData,ImagingResult,ANY-method

(ImagingResult-class), 33resultData,ImagingResult,missing-method

(ImagingResult-class), 33resultData,ResultSet,ANY-method

(ResultSet-class), 91resultData,ResultSet-method

(ResultSet-class), 91resultData<- (ImagingResult-class), 33resultData<-,ImagingResult,ANY-method

(ImagingResult-class), 33resultData<-,ImagingResult,missing-method

(ImagingResult-class), 33resultData<-,ResultSet,missing-method

(ResultSet-class), 91resultData<-,ResultSet-method

(ResultSet-class), 91resultNames (ImagingResult-class), 33resultNames,ImagingResult-method

(ImagingResult-class), 33resultNames<- (ImagingResult-class), 33ResultSet, 11, 12, 91ResultSet (ResultSet-class), 91ResultSet-class, 91risk.colors (intensity.colors), 34rownames,Hashmat-method

(Hashmat-class), 16rownames<-,Hashmat-method

(Hashmat-class), 16

Page 139: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

INDEX 139

run (PositionDataFrame-class), 82run,PositionDataFrame-method

(PositionDataFrame-class), 82run,SparseImagingExperiment-method

(SparseImagingExperiment-class),105

run<- (PositionDataFrame-class), 82run<-,PositionDataFrame-method

(PositionDataFrame-class), 82run<-,SparseImagingExperiment-method

(SparseImagingExperiment-class),105

runNames (PositionDataFrame-class), 82runNames,PositionDataFrame-method

(PositionDataFrame-class), 82runNames,SparseImagingExperiment-method

(SparseImagingExperiment-class),105

runNames<- (PositionDataFrame-class), 82runNames<-,PositionDataFrame-method

(PositionDataFrame-class), 82runNames<-,SparseImagingExperiment-method

(SparseImagingExperiment-class),105

sampleNames (ImagingExperiment-class),32

sampleNames,IAnnotatedDataFrame-method(IAnnotatedDataFrame-class), 19

sampleNames,ImagingExperiment-method(ImagingExperiment-class), 32

sampleNames,iSet-method (iSet-class), 36sampleNames-methods

(ImagingExperiment-class), 32sampleNames<-

(ImagingExperiment-class), 32sampleNames<-,IAnnotatedDataFrame,ANY-method

(IAnnotatedDataFrame-class), 19sampleNames<-,IAnnotatedDataFrame-method

(IAnnotatedDataFrame-class), 19sampleNames<-,ImagingExperiment,ANY-method

(ImagingExperiment-class), 32sampleNames<-,iSet,ANY-method

(iSet-class), 36sampleNames<-,iSet-method (iSet-class),

36samples,MIAPE-Imaging-method

(MIAPE-Imaging-class), 41scanDirection (MSImagingInfo-class), 54scanDirection,MIAPE-Imaging-method

(MIAPE-Imaging-class), 41scanDirection,Vector-method

(MSImagingInfo-class), 54

scanPattern (MSImagingInfo-class), 54scanPattern,MIAPE-Imaging-method

(MIAPE-Imaging-class), 41scanPattern,Vector-method

(MSImagingInfo-class), 54scanPolarity (MSImagingInfo-class), 54scanPolarity,MIAPE-Imaging-method

(MIAPE-Imaging-class), 41scanPolarity,Vector-method

(MSImagingInfo-class), 54scans,MSImagingInfo-method

(MSImagingInfo-class), 54scanType (MSImagingInfo-class), 54scanType,MIAPE-Imaging-method

(MIAPE-Imaging-class), 41scanType,Vector-method

(MSImagingInfo-class), 54segmentationTest, 118segmentationTest (meansTest-methods), 39segmentationTest,SparseImagingExperiment-method

(meansTest-methods), 39segmentationTest,SpatialDGMM-method

(meansTest-methods), 39SegmentationTest-class

(meansTest-methods), 39segmentationTest-methods

(meansTest-methods), 39select (dplyr-methods), 13selectROI, 28selectROI (selectROI-methods), 92selectROI,SImageSet-method

(selectROI-methods), 92selectROI,SparseImagingExperiment-method

(selectROI-methods), 92selectROI-methods, 92setup.layout (plot-methods), 74show,AnnotatedImageList-method

(AnnotatedImagingExperiment-class),5

show,AnnotatedImagingExperiment-method(AnnotatedImagingExperiment-class),5

show,Hashmat-method (Hashmat-class), 16show,ImageData-method

(ImageData-class), 28show,ImagingExperiment-method

(ImagingExperiment-class), 32show,ImagingResult-method

(ImagingResult-class), 33show,MIAPE-Imaging-method

(MIAPE-Imaging-class), 41show,MSImageProcess-method

Page 140: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

140 INDEX

(MSImageProcess-class), 47show,MSImagingExperiment-method

(MSImagingExperiment-class), 52show,ResultSet-method

(ResultSet-class), 91show,SimpleImageList-method

(ImageList-class), 30show,SparseImagingExperiment-method

(SparseImagingExperiment-class),105

show,SparseImagingResult-method(ImagingResult-class), 33

show,SummaryDataFrame-method(SummaryDataFrame-class), 116

show,XDataFrame-method(XDataFrame-class), 120

showNames (XDataFrame-class), 120showNames,MassDataFrame-method

(MassDataFrame-class), 38showNames,PositionDataFrame-method

(PositionDataFrame-class), 82showNames,XDataFrame-method

(XDataFrame-class), 120SImageData, 30, 44, 46, 49, 50, 97, 98SImageData (SImageData-class), 93SImageData-class, 93SImageSet, 11, 18, 21, 30, 36, 38, 46, 49–51,

70, 73, 95, 96SImageSet (SImageSet-class), 96SImageSet-class, 96SimpleImageArrayList-class

(ImageList-class), 30SimpleImageList-class

(ImageList-class), 30SimpleList, 31, 52, 53, 105, 106simulateImage, 12, 101simulateImage (simulateSpectrum), 99simulateSpectrum, 12, 99, 100, 101slice (slice-methods), 102slice,SparseImagingExperiment-method

(slice-methods), 102slice-methods, 102smooth (smoothSignal-methods), 103smooth,SparseImagingExperiment-method

(smoothSignal-methods), 103smooth-methods (smoothSignal-methods),

103smoothing (MSImagingInfo-class), 54smoothing,MSImageProcess-method

(MSImageProcess-class), 47smoothing,Vector-method

(MSImagingInfo-class), 54

smoothing<- (MSImagingInfo-class), 54smoothing<-,MSImageProcess-method

(MSImageProcess-class), 47smoothing<-,Vector-method

(MSImagingInfo-class), 54smoothSignal, 8, 85smoothSignal (smoothSignal-methods), 103smoothSignal,MSImageSet-method

(smoothSignal-methods), 103smoothSignal,SparseImagingExperiment-method

(smoothSignal-methods), 103smoothSignal-methods, 103smoothSignal.gaussian

(smoothSignal-methods), 103smoothSignal.ma (smoothSignal-methods),

103smoothSignal.sgolay

(smoothSignal-methods), 103softwareName (MIAPE-Imaging-class), 41softwareName,MIAPE-Imaging-method

(MIAPE-Imaging-class), 41softwareVersion (MIAPE-Imaging-class),

41softwareVersion,MIAPE-Imaging-method

(MIAPE-Imaging-class), 41sparse_mat, 16, 55SparseImagingExperiment, 11, 32–34, 53,

70, 72, 85, 101, 102SparseImagingExperiment

(SparseImagingExperiment-class),105

SparseImagingExperiment-class, 105SparseImagingResult

(ImagingResult-class), 33SparseImagingResult-class

(ImagingResult-class), 33spatialApply (pixelApply-methods), 70spatialApply,SparseImagingExperiment-method

(pixelApply-methods), 70spatialApply-methods

(pixelApply-methods), 70spatialDGMM, 40spatialDGMM (spatialDGMM-methods), 107spatialDGMM,SparseImagingExperiment-method

(spatialDGMM-methods), 107SpatialDGMM-class

(spatialDGMM-methods), 107spatialDGMM-methods, 107spatialFastmap

(spatialFastmap-methods), 109spatialFastmap,SImageSet-method

(spatialFastmap-methods), 109

Page 141: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

INDEX 141

spatialFastmap,SparseImagingExperiment-method(spatialFastmap-methods), 109

spatialFastmap-class(spatialFastmap-methods), 109

spatialFastmap-methods, 109spatialKMeans, 91, 92, 110, 115spatialKMeans (spatialKMeans-methods),

111spatialKMeans,SImageSet-method

(spatialKMeans-methods), 111spatialKMeans,SparseImagingExperiment-method

(spatialKMeans-methods), 111SpatialKMeans-class

(spatialKMeans-methods), 111spatialKMeans-methods, 111spatialShrunkenCentroids, 10, 12, 82, 91,

92, 110, 112, 114, 118spatialShrunkenCentroids

(spatialShrunkenCentroids-methods),113

spatialShrunkenCentroids,SImageSet,character-method(spatialShrunkenCentroids-methods),113

spatialShrunkenCentroids,SImageSet,factor-method(spatialShrunkenCentroids-methods),113

spatialShrunkenCentroids,SImageSet,missing-method(spatialShrunkenCentroids-methods),113

spatialShrunkenCentroids,SparseImagingExperiment,ANY-method(spatialShrunkenCentroids-methods),113

spatialShrunkenCentroids,SparseImagingExperiment,missing-method(spatialShrunkenCentroids-methods),113

SpatialShrunkenCentroids-class(spatialShrunkenCentroids-methods),113

spatialShrunkenCentroids-methods, 113spatialWeights (findNeighbors-methods),

14spatialWeights,IAnnotatedDataFrame-method

(findNeighbors-methods), 14spatialWeights,ImagingExperiment-method

(findNeighbors-methods), 14spatialWeights,iSet-method

(findNeighbors-methods), 14spatialWeights,PositionDataFrame-method

(findNeighbors-methods), 14spatialWeights-methods

(findNeighbors-methods), 14specimenOrigin (MIAPE-Imaging-class), 41

specimenOrigin,MIAPE-Imaging-method(MIAPE-Imaging-class), 41

specimenType (MIAPE-Imaging-class), 41specimenType,MIAPE-Imaging-method

(MIAPE-Imaging-class), 41spectra (MSImagingExperiment-class), 52spectra,MSImageSet-method

(MSImageSet-class), 49spectra,MSImagingExperiment-method

(MSImagingExperiment-class), 52spectra-methods

(MSImagingExperiment-class), 52spectra<- (MSImagingExperiment-class),

52spectra<-,MSImageSet-method

(MSImageSet-class), 49spectra<-,MSImagingExperiment-method

(MSImagingExperiment-class), 52spectraData

(MSImagingExperiment-class), 52spectraData,MSImagingExperiment-method

(MSImagingExperiment-class), 52spectraData-methods

(MSImagingExperiment-class), 52spectraData<-

(MSImagingExperiment-class), 52spectraData<-,MSImagingExperiment-method

(MSImagingExperiment-class), 52spectrumRepresentation

(MSImagingInfo-class), 54spectrumRepresentation,MSImageProcess-method

(MSImageProcess-class), 47spectrumRepresentation,Vector-method

(MSImagingInfo-class), 54spectrumRepresentation<-

(MSImagingInfo-class), 54spectrumRepresentation<-,MSImageProcess-method

(MSImageProcess-class), 47spectrumRepresentation<-,Vector-method

(MSImagingInfo-class), 54stainingMethod (MIAPE-Imaging-class), 41stainingMethod,MIAPE-Imaging-method

(MIAPE-Imaging-class), 41standardizeRuns

(standardizeRuns-methods), 115standardizeRuns,MSImageSet-method

(standardizeRuns-methods), 115standardizeRuns-methods, 115standardizeRuns.sum

(standardizeRuns-methods), 115storageMode,ImageData-method

(ImageData-class), 28

Page 142: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

142 INDEX

storageMode,iSet-method (iSet-class), 36storageMode<-,ImageData,character-method

(ImageData-class), 28storageMode<-,iSet,ANY-method

(iSet-class), 36storageMode<-,iSet,character-method

(iSet-class), 36summarise (dplyr-methods), 13summarize (dplyr-methods), 13summary,CrossValidated-method

(cvApply-methods), 10summary,CrossValidated2-method

(cvApply-methods), 10summary,iSet-method (iSet-class), 36summary,MeansTest-method

(meansTest-methods), 39summary,OPLS-method (PLS-methods), 80summary,PCA-method (PCA-methods), 63summary,PCA2-method (PCA-methods), 63summary,PLS-method (PLS-methods), 80summary,PLS2-method (PLS-methods), 80summary,SegmentationTest-method

(meansTest-methods), 39summary,SpatialDGMM-method

(spatialDGMM-methods), 107summary,SpatialFastmap-method

(spatialFastmap-methods), 109summary,SpatialFastmap2-method

(spatialFastmap-methods), 109summary,SpatialKMeans-method

(spatialKMeans-methods), 111summary,SpatialKMeans2-method

(spatialKMeans-methods), 111summary,SpatialShrunkenCentroids-method

(spatialShrunkenCentroids-methods),113

summary,SpatialShrunkenCentroids2-method(spatialShrunkenCentroids-methods),113

summary,SummaryDataFrame-method(SummaryDataFrame-class), 116

SummaryDataFrame(SummaryDataFrame-class), 116

SummaryDataFrame-class, 116svd, 64

tapply, 72, 73tissueThickness (MIAPE-Imaging-class),

41tissueThickness,MIAPE-Imaging-method

(MIAPE-Imaging-class), 41tissueWash (MIAPE-Imaging-class), 41

tissueWash,MIAPE-Imaging-method(MIAPE-Imaging-class), 41

tolerance,MSProcessedImagingExperiment-method(MSProcessedImagingExperiment-class),55

tolerance,MSProcessedImagingSpectraList-method(MSProcessedImagingExperiment-class),55

tolerance<-,MSProcessedImagingExperiment-method(MSProcessedImagingExperiment-class),55

tolerance<-,MSProcessedImagingSpectraList-method(MSProcessedImagingExperiment-class),55

topFeatures, 9, 12topFeatures (topFeatures-methods), 117topFeatures,CrossValidated-method

(topFeatures-methods), 117topFeatures,MeansTest-method

(topFeatures-methods), 117topFeatures,OPLS-method

(topFeatures-methods), 117topFeatures,PCA-method

(topFeatures-methods), 117topFeatures,PLS-method

(topFeatures-methods), 117topFeatures,ResultSet-method

(topFeatures-methods), 117topFeatures,SegmentationTest-method

(topFeatures-methods), 117topFeatures,SpatialKMeans-method

(topFeatures-methods), 117topFeatures,SpatialShrunkenCentroids-method

(topFeatures-methods), 117topFeatures,SpatialShrunkenCentroids2-method

(topFeatures-methods), 117topFeatures-methods, 117topLabels (defunct), 12topLabels,ANY-method (defunct), 12

ungroup (reexports), 91

varLabels,iSet-method (iSet-class), 36varLabels<-,iSet-method (iSet-class), 36varMetadata,iSet-method (iSet-class), 36varMetadata<-,iSet,ANY-method

(iSet-class), 36varMetadata<-,iSet-method (iSet-class),

36Versioned, 17, 20, 29, 36, 42, 45, 48, 50, 91,

94, 98VersionedBiobase, 36, 50, 91, 98viridis, 35

Page 143: Package ‘Cardinal’ - BioconductorCardinal provides an abstracted interface to manipulating mass spectrometry imaging datasets, sim- ... (Cardinal.numblocks=20): The default number

INDEX 143

viridis (reexports), 91

width,AnnotatedImage-method(AnnotatedImage-class), 4

width,AnnotatedImagingExperiment-method(AnnotatedImagingExperiment-class),5

width<-,AnnotatedImage-method(AnnotatedImage-class), 4

writeAnalyze (writeMSIData), 119writeAnalyze,MSImageSet-method

(writeMSIData), 119writeImzML (writeMSIData), 119writeImzML,MSImageSet-method

(writeMSIData), 119writeMSIData, 87, 119writeMSIData,MSImageSet,character-method

(writeMSIData), 119

XDataFrame, 33, 38, 39, 82, 83XDataFrame (XDataFrame-class), 120XDataFrame-class, 120xyplot, 78, 79