SparseImagingExperiment-class: SparseImagingExperiment: Pixel-sparse imaging experiments

Description Usage Arguments Slots Methods Author(s) See Also Examples

Description

The SparseImagingExperiment class specializes the virtual ImagingExperiment class by assuming that each pixel may be a high-dimensional feature vector (e.g., a spectrum), but the pixels themselves may be sparse. Therefore, the data may be more efficiently stored as a matrix where rows 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 experiments.

Usage

1
2
3
4
5
6
7
8
9
## Instance creation
SparseImagingExperiment(
    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 features and 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 new objects.

Slots

imageData:

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

featureData:

Contains feature information in a DataFrame. Each row includes the metadata for a 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 the metadata for a single observation (e.g., a pixel), including specialized slot-columns for tracking pixel coordinates and experimental runs.

metadata:

A list containing experiment-level metadata.

processing:

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

Methods

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

pixels(object, ...):

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

features(object, ...):

Returns the row indices of featureData corresponding to conditions passed 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 from pixelData.

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 position slot-columns from pixelData.

gridded(object), gridded(object) <- value:

Get or set whether the spatial positions are gridded or not. Typically, this should not be set manually.

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

Get or set the spatial resolution of the spatial 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 image raster).

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 multidimensional image raster).

processingData(object), processingData(object) <- value:

Get or set the processing slot.

preproc(object):

List the preprocessing steps queued and applied to the dataset.

pull(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

See Also

ImagingExperiment, MSImagingExperiment

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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)

Example output

Loading required package: BiocGenerics
Loading required package: parallel

Attaching package:BiocGenericsThe following objects are masked frompackage:parallel:

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked frompackage:stats:

    IQR, mad, sd, var, xtabs

The following objects are masked frompackage:base:

    anyDuplicated, append, as.data.frame, basename, cbind, colnames,
    dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep,
    grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget,
    order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
    rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply,
    union, unique, unsplit, which.max, which.min

Loading required package: BiocParallel
Loading required package: EBImage
Loading required package: S4Vectors
Loading required package: stats4

Attaching package:S4VectorsThe following object is masked frompackage:base:

    expand.grid

Loading required package: ProtGenerics

Attaching package:ProtGenericsThe following object is masked frompackage:stats:

    smooth


Attaching package:CardinalThe following object is masked frompackage:stats:

    filter

An object of class 'SparseImagingExperiment'
  <9 feature, 9 pixel> imaging dataset
    imageData(1): data0
    featureData(1): t
    pixelData(1): a
    run(1): run0
    raster dimensions: 3 x 3
    coord(2): x = 1..3, y = 1..3

Cardinal documentation built on Nov. 8, 2020, 11:10 p.m.