R: 'flowFrame': a class for storing observed quantitative...
flowFrame-class
R Documentation
'flowFrame': a class for storing observed quantitative
properties for a population of cells from a FACS run
Description
This class represents the data contained in a FCS
file or similar data structure. There are three parts of the data:
a numeric matrix of the raw measurement values with
rows=events and columns=parameters
annotation for the parameters (e.g., the measurement channels,
stains, dynamic range)
additional annotation provided through keywords in the
FCS file
Details
Objects of class flowFrame can be used to hold arbitrary data
of cell populations, acquired in flow-cytometry.
FCS is the Data File Standard for Flow Cytometry, the
current version is FCS 3.0. See the vignette of this package for
additional information on using the object system for handling of
flow-cytometry data.
Creating Objects
Objects can be created using new("flowFrame", exprs = ...., Object of class matrix parameters = ...., Object of class AnnotatedDataFrame description = ...., Object of class list )
or the constructor flowFrame, with mandatory arguments
exprs and optional arguments parameters and
description.
flowFrame(exprs, parameters, description=list())
To create a flowFrame directly from an FCS file, use
function read.FCS. This is the recommended and
safest way of object creation, since read.FCS will perform
basic data quality checks upon import. Unless you know exactly what
you are doing, creating objects using new or the constructor is
discouraged.
Slots
exprs:
Object of class matrix containing the
measured intensities. Rows correspond to cells, columns to the
different measurement channels. The colnames attribute of
the matrix is supposed to hold the names or identifiers for the
channels. The rownames attribute would usually not be set.
parameters:
An
AnnotatedDataFrame
containing information about each column of the
flowFrame. This will generally be filled in by
read.FCS or similar functions using data from the
FCS keywords describing the parameters.
description:
A list containing the meta data included
in the FCS file.
Methods
There are separate documentation pages for most of the methods
listed here which should be consulted for more details.
[
Subsetting. Returns an object of class flowFrame.
The subsetting is applied to the exprs slot, while the
description slot is unchanged. The syntax for subsetting is
similar to that of data.frames. In
addition to the usual index vectors (integer and logical by
position, character by parameter names), flowFrames can be
subset via filterResult and
filter objects.
Usage:
flowFrame[i,j]
flowFrame[filter,]
flowFrame[filterResult,]
Note that the value of argument drop is ignored when
subsetting flowFrames.
$
Subsetting by channel name. This is similar to subsetting
of columns of data.frames, i.e.,
frame$FSC.H is equivalent to frame[, "FSC.H"]. Note
that column names may have to be quoted if they are no valid R
symbols (e.g. frame$"FSC-H").
exprs, exprs<-
Extract or replace 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 flowFrame, but all have to be defined there).
Usage:
exprs(flowFrame)
exprs(flowFrame) <- value
head, tail
Show first/last elements of the raw data matrix
Usage:
head(flowFrame)
tail(flowFrame)
description, description<-
Extract or replace the whole list
of annotation keywords. Usually one would only be interested in a
subset of keywords, in which case the keyword method is
more appropriate. The optional hideInternal parameter can
be used to exclude internal FCS parameters starting
with$.
Usage:
description(flowFrame)
description(flowFrame) <- value
keyword, keyword<-
Extract ore replace one or more entries
from the description slot by keyword. Methods are defined
for character vectors (select a keyword by name), functions
(select a keyword by evaluating a function on their content) and
for lists (a combination of the above). See keyword
for details.
Usage:
keyword(flowFrame)
keyword(flowFrame, character)
keyword(flowFrame, list)
keyword(flowFrame) <- list(value)
parameters, parameters<-
Extract parameters and return an
object of class
AnnotatedDataFrame,
or replace such an object. To access the actual parameter
annotation, use pData(parameters(frame)). Replacement is
only valid with
AnnotatedDataFrames
containing all varLabels name, desc, range,
minRange and maxRange, and matching entries in the
name column to the colnames of the exprs matrix. See
parameters for more details.
Usage:
parameters(flowFrame)
parameters(flowFrame) <- value
show
Display details about the flowFrame object.
summary
Return descriptive statistical summary (min, max,
mean and quantile) for each channel
Usage:
summary(flowFrame)
plot
Basic plots for flowFrame objects. If the object
has only a single parameter this produces a
histogram. For exactly two parameters
we plot a bivariate density map (see
smoothScatter
and for more than two parameters we produce a simple
splom plot. 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 plot. The smooth parameters lets you toggle
between density-type
smoothScatter
plots and regular scatterplots. For far more sophisticated
plotting of flow cytometry data, see the
flowViz package.
Usage:
plot(flowFrame, ...)
plot(flowFrame, character, ...)
plot(flowFrame, smooth=FALSE, ...)
ncol, nrow, dim
Extract the dimensions of the data matrix.
Usage:
ncol(flowFrame)
nrow(flowFrame)
dim(flowFrame)
featureNames, colnames, colnames<-
. colnames and
featureNames are synonyms, they extract parameter names (i.e., the
colnames of the data matrix) .
For colnames there is
also a replacement method. This will update the name column
in the parameters slot as well.
Usage:
featureNames(flowFrame)
colnames(flowFrame)
colnames(flowFrame) <- value
names
Extract pretty formated names of the parameters
including parameter descriptions.
Usage:
names(flowFrame)
identifier
Extract GUID of a flowFrame. Returns the
file name if no GUID is available. See identifier
for details.
Usage:
identifier(flowFrame)
range
Get dynamic range of the flowFame. Note that
this is not necessarily 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
flowFrames. Additional character arguments are evaluated as
parameter names for which to return the dynamic range.
Usage:
range(flowFrame, ...)
each_row, each_col
Apply functions over rows or columns of
the data matrix. These are convenience methods. See
each_col for details.
Usage:
each_row(flowFrame, function, ...)
each_col(flowFrame, function, ...)
transform
Apply a transformation function on a
flowFrame object. This uses R's
transform function by treating the
flowFrame like a regular data.frame. flowCore
provides an additional inline mechanism for transformations (see
%on%) which is strictly more limited
than the out-of-line transformation described here.
Usage:
transform(flowFrame, translist, ...)
filter
Apply a filter object on a
flowFrame 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.
Usage:
filter(flowFrame, filter)
split
Split flowFrame object according to a
filter, 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.
Subset a flowFrame according to a filter
or a logical vector. The same can be done using the standard
subsetting operator with a filter, filterResult, or
a logical vector as first argument.
Usage:
Subset(flowFrame, filter)
Subset(flowFrame, logical)
cbind2
Expand a flowFrame by the data in a
numeric matrix of the same length. The matrix must
have column names different from those of the
flowFrame. The additional method for numerics only
raises a useful error message.
Usage:
cbind2(flowFrame, matrix)
cbind2(flowFrame, numeric)
compensate
Apply a compensation matrix (or a
compensation object) on a flowFrame
object. This returns a compensated flowFrame.
Extract spillover matrix from description slot if
present. It is equivalent to
keyword(x, c("spillover", "SPILL"))
Thus will simply return a list of keywords value for "spillover" and "SPILL".
Usage:
spillover(flowFrame)
==
Test equality between two flowFrames
<, >, <=, >=
These operators basically treat the
flowFrame as a numeric matrix.
initialize(flowFrame):
Object instantiation, used
by new; not to be called directly by the user.