Last chance! 50% off unlimited learning
Sale ends in
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. exprs
: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
: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
: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
. 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"
). flowFrame
, but all have to be defined there). Usage: exprs(flowFrame)
exprs(flowFrame) <- value
head(flowFrame)
tail(flowFrame)
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
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)
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
flowFrame
object. summary(flowFrame)
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(flowFrame)
nrow(flowFrame)
dim(flowFrame)
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(flowFrame)
flowFrame
. Returns the
file name if no GUID is available. See identifier
for details. Usage: identifier(flowFrame)
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_col
for details. Usage: each_row(flowFrame, function, ...)
each_col(flowFrame, function, ...)
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
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)
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. Usage: split(flowFrame, filter, flowSet=FALSE, ...)
split(flowFrame, filterResult, flowSet=FALSE, ...)
split(flowFrame, factor, flowSet=FALSE, ...)
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)
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)
compensation
object) on a flowFrame
object. This returns a compensated flowFrame
. Usage: compensate(flowFrame, matrix)
compensate(flowFrame, data.frame)
keyword(x, c("spillover", "SPILL"))
Thus will simply return a list of keywords value for "spillover" and "SPILL". Usage: spillover(flowFrame)
flowFrames
flowFrame
as a numeric matrix.initialize(flowFrame)
:new
; not to be called directly by the user.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.flowSet
, read.FCS
## load example data
data(GvHD)
frame <- GvHD[[1]]
## subsetting
frame[1:4,]
frame[,3]
frame[,"FSC-H"]
frame$"SSC-H"
## accessing and replacing raw values
head(exprs(frame))
exprs(frame) <- exprs(frame)[1:3000,]
frame
exprs(frame) <- exprs(frame)[,1:6]
frame
## access FCS keywords
head(description(frame))
keyword(frame, c("FILENAME", "$FIL"))
## parameter annotation
parameters(frame)
pData(parameters(frame))
## summarize frame data
summary(frame)
## plotting
plot(frame)
if(require(flowViz)){
plot(frame)
plot(frame, c("FSC-H", "SSC-H"))
plot(frame[,1])
plot(frame, c("FSC-H", "SSC-H"), smooth=FALSE)
}
## frame dimensions
ncol(frame)
nrow(frame)
dim(frame)
## accessing and replacing parameter names
featureNames(frame)
all(featureNames(frame) == colnames(frame))
colnames(frame) <- make.names(colnames(frame))
colnames(frame)
parameters(frame)$name
names(frame)
## accessing a GUID
identifier(frame)
identifier(frame) <- "test"
## dynamic range of a frame
range(frame)
range(frame, "FSC.H", "FL1.H")
range(frame)$FSC.H
## iterators
head(each_row(frame, mean))
head(each_col(frame, mean))
## transformation
opar <- par(mfcol=c(1:2))
if(require(flowViz))
plot(frame, c("FL1.H", "FL2.H"))
frame <- transform(frame, transformList(c("FL1.H", "FL2.H"), log))
if(require(flowViz))
plot(frame, c("FL1.H", "FL2.H"))
par(opar)
range(frame)
## filtering of flowFrames
rectGate <- rectangleGate(filterId="nonDebris","FSC.H"=c(200,Inf))
fres <- filter(frame, rectGate)
summary(fres)
## splitting of flowFrames
split(frame, rectGate)
split(frame, rectGate, flowSet=TRUE)
split(frame, fres)
f <- cut(exprs(frame$FSC.H), 3)
split(frame, f)
## subsetting according to filters and filter results
Subset(frame, rectGate)
Subset(frame, fres)
Subset(frame, as.logical(exprs(frame$FSC.H) < 300))
frame[rectGate,]
frame[fres,]
## accessing the spillover matrix
try(spillover(frame))
## check equality
frame2 <- frame
frame == frame2
exprs(frame2) <- exprs(frame)*2
frame == frame2
Run the code above in your browser using DataLab