CyData {cydar} | R Documentation

## CyData class and methods

### Description

The CyData class is derived from the SingleCellExperiment class. It is intended to store the cell counts for each group of cells (rows) for each sample (columns). Groups are intended to be hyperspheres (see `countCells`) but could also be arbitrary clusters of cells. It also stores the median intensities for each group and the identity of cells in the groups, parallel to the rows.

### Details

CyData objects should not be created directly by users. The class has some strict validity conditions that are not easily satisfied by manual construction. Users should rely on functions like `prepareCellData` and `countCells` to create the objects. An overview of the CyData class and the available methods.

### Getter functions for group-level data

In the following code chunks, `x` or `object` are CyData objects. `mode` is a string specifying the types of markers that should be returned; this defaults to only those markers that are used in `prepareCellData`, but can also return the unused markers or all of them.

- `intensities(x, mode=c("used", "all", "unused")` returns a numeric matrix of intensities for each group of cells (rows) and markers (columns). Rows of the output matrix correspond to rows of `x`. Values are returned for the markers specified by `mode` (see above).

- `cellAssignments(x)` returns a list of integer vectors, where each vector corresponds to a row of `x` and contains the indices of the cells in that group. Indices refer to columns of `cellIntensities(x)`.

- `markernames(object, mode=c("used", "all", "unused"))` returns a character vector of the marker names, depending on `mode` (see above).

- `getCenterCell(x)` returns the index of the cell used at the center of each hypersphere.

### Getter functions for cell-level data

In the following code chunks, `x` is a CyData object and `mode` is as previously described.

- `cellIntensities(x, mode=c("used", "all", "unused"))` returns a numeric matrix of intensities for each marker (row) and cell (column).

- `cellInformation(x)` returns a DataFrame with one row per cell. The `sample` field specifies the sample of origin for each cell, while the `cell` field specifies the original row index of that cell in its original sample.

### Subsetting

The subsetting and combining behaviour of CyData objects is mostly the same as that of SingleCellExperiment objects. The only difference is that subsetting or combining CyData objects by column is not advisable. Indeed, attempting to do so will result in a warning from the associated methods. This is because the columns are usually not independent in contexts involving clustering cells across multiple samples. If a sample is to be removed, it is more appropriate to do so in the function that generates the CyData object (usually `prepareCellData`).

### Author(s)

Aaron Lun

### Examples

    example(countCells, echo=FALSE)

    markernames(cnt)
    head(intensities(cnt))
    head(cellAssignments(cnt))

[Package cydar version 1.11.6 Index]