cytoframe: A reference class for efficiently managing the data representation of a
This class serves the same purpose as the
flowFrame class from the
to store quantitative data on cell populations from a single FCS run. The primary difference is in the underlying representation
of the data. While
flowFrame objects store the underlying data matrix in the
as an R object,
cytoframe objects store the matrix (as well as the data from the other slots) in a
C data structure that is accessed through an external pointer. This allows for greater optimization of
data operations including I/O, parsing, transformation, and gating.
From the user's standpoint, interacting with a
cytoframe is very similar to interacting with a
flowframe, with one important difference. While operations such as subsetting or copying a
using the standard R assignment operator (<-) will perform a deep copy of the data in its slots, the same
operations on a
cytoframe will produce a view to the same underlying data as the original object.
This means that changes made to the
cytoframe resulting from subsetting or copying will affect
cytoframe. If a deep copy of the underyling data is desired, the
will accomplish this.
cytoframe class inherits from
flowFrame slots are present but
not utilized. Thus, attempting to access them directly will yield empty data structures. However, the
description methods work in a manner similar
flowFrame by accessing the same information from the underlying data structure.
Many of the methods here have their own documentation pages or are more extensively explained
in the documentation for
flowFrame, so those documentation pages may
be consulted as well for more details.
Subsetting. Returns an object of class
The syntax for subsetting is similar to that of
In addition to the usual index vectors (integer and logical by
position, character by parameter names),
cytoframes can be
filter objects. Usage:
Note that the value of argument
drop is ignored when
Subsetting by channel name. This is similar to subsetting
of columns of
frame$FSC.H is equivalent to
frame[, "FSC.H"]. Note
that column names may have to be quoted if they are not valid R
exprs returns an object of class
matrix containing the
measured intensities. Rows correspond to cells, columns to the
different measurement channels. The
colnames attribute of
the matrix should hold the names or identifiers for the
rownames attribute would usually not be set.
exprs<- replaces the raw data intensities. The replacement value
must be a numeric matrix with
colnames matching the parameter definitions.
Implicit subsetting is allowed (i.e. less columns in the replacement value
compared to the original
cytoframe), but all columns must be defined in the original
exprs(cytoframe) <- value
Extract all entries or a single entry
from the annotations by keyword or replace
the entire list of key/value pairs with a new named
keyword for details.
keyword(cytoframe) <- list(value)
Extract parameters and return an object of class
containing information about each column of the
or replace such an object.
This information will generally be filled in by
load_cytoframe_from_fcs or similar functions using data from the
FCS keywords describing the parameters. To access the actual parameter
Replacement is only valid with
containing all varLabels
maxRange, and matching entries in the
name column to the colnames of the
exprs matrix. See
parameters for more details.
parameters(cytoframe) <- value
Display details about the
Return descriptive statistical summary (min, max, mean and quantile) for each channel
Basic plots for
cytoframe objects. If the object
has only a single parameter this produces a
For exactly two parameters we plot a bivariate density map (see
and for more than two parameters we produce a simple
To select specific parameters from a
flowFrame for plotting, either subset the object or
specify the parameters as a character vector in the second argument to
The smooth parameters lets you toggle between density-type
plots and regular scatterplots. For far more sophisticated plotting of flow cytometry data,
plot(cytoframe, character, ...)
plot(cytoframe, smooth=FALSE, ...)
featureNames are synonyms. They extract parameter names
(i.e., the colnames of the data matrix).
colnames there is also a replacement method. This will
name column in the
parameters slot as well.
colnames(cytoframe) <- value
Access or replace the marker names associated
with the channels of the
cytoframe. For replacement,
be a named list or character vector where the names correspond to the channel names
and the values correpond to the marker names.
markernames(object) <- value
Extract pretty formatted names of the parameters
including parameter descriptions.
Get instrument or actual data range of the
cytoframe. Note that
instrument dynamic range is not necessarily the same as the range of the actual data values, but
the theoretical range of values the measurement instrument was
able to capture. The values of the dynamic range will be
transformed when using the transformation methods for
x: cytoframe object.
type: Range type. either "instrument" or "data". Default is "instrument"
range(x, type = "data")
Apply functions over rows or columns of
the data matrix. These are convenience methods. See
each_col for details.
each_row(cytoframe, function, ...)
each_col(cytoframe, function, ...)
Apply a transformation function on a
cytoframe object. This uses R's
transform function by treating the
cytoframe like a regular
provides an additional inline mechanism for transformations (see
%on%) which is strictly more limited
than the out-of-line transformation described here.
transform(cytoframe, translist, ...)
filter object on a
cytoframe object. This returns an object of class
filterResult, which could then be used for
subsetting of the data or to calculate summary statistics. See
filter for details.
cytoframe object according to a
filterResult or a
factor. For most types of filters, an optional
flowSet=TRUE parameter will create a
flowSet rather than a simple list. See
split for details.
split(cytoframe, filter, flowSet=FALSE, ...)
split(cytoframe, filterResult, flowSet=FALSE, ...)
split(cytoframe, factor, flowSet=FALSE, ...)
cytoframe according to a
or a logical vector. The same can be done using the standard
subsetting operator with a
a logical vector as first argument.
Not yet implemented.
cytoframe by the data in a
numeric matrix of the same length. The
have column names different from those of the
cytoframe. The additional method for
raises a useful error message.
Apply a compensation matrix (or a
compensation object) on a
object. This returns a compensated
Not yet implemented.
Reverse the application of a compensation matrix (or a
compensation object) on a
object. This returns a decompensated
Extract spillover matrix from description slot if
present. It is equivalent to
keyword(x, c("spillover", "SPILL"))
Thus will simply return a list of keyword values for "spillover" and "SPILL".
Returns a new
cytoframe with its own copy of the
underlying data (a deep copy). The optional
filepath argument accepts
a string to specify a full filename for storing the new copy of the data in h5