| MSImageSet-class {Cardinal} | R Documentation |
Container for mass spectrometry imaging experimental data and metadata. MSImageSet is derived from iSet through SImageSet. It extends these classes with information about the processing and analysis, requiring MIAPE-Imaging in its experimentData slot.
## Instance creation
MSImageSet(
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
spectra |
A matrix-like object with number of rows equal to the number of features and number of columns equal to the number of non-missing pixels. Each column should be a mass spectrum. Alternatively, a multidimensional array that represents the datacube with the first dimension as the features (m/z values) can also be supplied. Additional dimensions could be the spatial dimensions of the image, for example. |
mz |
A numeric vector representing the mass-to-charge ratio features (m/z values) corresponding to the rows in the |
coord |
A |
imageData |
An object of class |
pixelData |
An object of class |
featureData |
An object of class |
processingData |
An object of class |
protocolData |
An object of class |
experimentData |
An object derived from class |
... |
Additional arguments passed to the initializer. |
imageData:An instance of SImageData, which stores one or more matrices of equal number of dimensions as elements in an 'immutableEnvironment'. This slot preserves copy-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 pixel coordinates 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 imageData in an IAnnotatedDataFrame.
processingData:Contains details about the pre-processing steps that have been applied to the spectra. 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 an IAnnotatedDataFrame.
.__classVersion__:A Versions object describing the version of the class used to created the instance. Intended for developer use.
SImageSet, directly.
iSet, by class "SImageSet", distance 1.
VersionedBiobase, by class "iSet", distance 2.
Versioned, by class "VersionedBiobase", distance 3.
MSImageSet instances can be created through MSImageSet(), but are more commonly created through reading of external data files.
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 corresponding to 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 picking have been performed. This is a shortcut for peakData(imageData(object)). These are the unaligned peaks. Aligned peaks (if they exist) are accesed by spectra(object).
mz(object), mz(object) <- value:Returns and sets the common m/z values of the mass spectra in the dataset. This is a required column of featureData.
features(object, ..., mz):Access the feature indices (rows in featureData) corresponding to 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 to variables in pixelData. If specified, coord should be a data.frame where each row corresponds to the coordinates of a desired pixel.
centroided(object), centroided(object) <- value:Access whether the dataset consists of profile 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 to accept unprocessed spectra. (This is usually a bad idea.)
processingData(object), processingData(object) <- value:Access and set the processingData slot.
Standard generic methods:
combine(x, y, ...):Combine two or more MSImageSet objects. Unique 'sample's in pixelData are treated as a dimension.
MSImageSet[i, j, ..., drop]:Subset an SImageSet based on the rows (featureData components) and the columns (pixelData components). The result is a new MSImageSet.
See iSet and SImageSet for additional methods.
Kylie A. Bemis
## Create an MSImageSet object spectra <- matrix(1:27, nrow=3) mz <- 101:103 coord <- expand.grid(x=1:3, y=1:3) msset <- MSImageSet(spectra=spectra, mz=mz, coord=coord) ## Access a single image corresponding to the first feature imageData(msset)[1,,] ## Reconstruct the datacube imageData(msset)[] ## Access the P x N matrix of column-wise mass spectra spectra(msset) ## Subset the MSImageSet to the first 2 m/z values and first 6 mass spectra msset2 <- msset[1:2, 1:6] imageData(msset2)[] msset2