Title: | Visualization for flow cytometry |
---|---|
Description: | Provides visualization tools for flow cytometry data. |
Authors: | B. Ellis, R. Gentleman, F. Hahne, N. Le Meur, D. Sarkar, M. Jiang |
Maintainer: | Mike Jiang <[email protected]> |
License: | Artistic-2.0 |
Version: | 1.71.0 |
Built: | 2024-10-30 07:55:02 UTC |
Source: | https://github.com/bioc/flowViz |
Functions and methods to visualize flow cytometry data. This package heavily depends on the flowCore package.
Package: | flowViz |
Type: | Package |
Version: | 0.2.1 |
Date: | 2006-11-16 |
License: | Artistic |
Traditionally, large parts of the analysis process of flow cytometry data has been mostly qualitative. To this end, dedicated visualization techniques have been used for both quality control and infernece of the data. This package provides a number of different visualization tools for flow data.
Maintainer: Florian Hahne <[email protected]> Authors: T. Duong, B. Ellis, R. Gentleman, F. Hahne, N. Le Meur, D. Sarkar, M. Tang
## examples go here
## examples go here
convert a single flowFrame or a list of flowFrames to a list of flowSet
.process_flowFrame_overlay(overlay, sn)
.process_flowFrame_overlay(overlay, sn)
overlay |
flowFrame or a list of flowFrame objects |
sn |
sample name |
extract the respective flowFrame from each flowSet based on the given sampleName
.process_overlay_flowSet(overlay, nm)
.process_overlay_flowSet(overlay, nm)
overlay |
a list of flowSet |
nm |
sample name |
These methods add gate names to a flowViz
plot, either derived from
the population identifiers or as provided by the user. These methods are
ment for internal use and are usually not called directly by the user.
## S4 method for signature 'rectangleGate,character' addName(x, name, data, gp, pos = 0.5, abs = FALSE, xlim, ylim, ...)
## S4 method for signature 'rectangleGate,character' addName(x, name, data, gp, pos = 0.5, abs = FALSE, xlim, ylim, ...)
x |
rectangleGate, ellipsoidGate, quadGate, polygonGate or kmeansFilter |
name |
character or logical or matrix |
data |
flowFrame |
gp |
a list of graphical parameters |
pos , abs
|
specifying location of the name. see 'help(xyplot)' for more details |
xlim , ylim
|
limits of axis |
... |
other arguments |
The methods are called for their side effects. No value is returned.
User-provided names.
Get names from the
filter
or
filterResult
object
see above
see above
see above
see above
see above
see above
see above
see above
see above
see above
see above
see above
see above
F. Hahne
Basic contour plots for both
flowFrame
s and
flowSet
s. The densities for the
contours are estimated using the fast kernel density estimation algorithm
bkde2D
.
## S4 method for signature 'flowFrame' contour(x, y = 1:2, nlevels = 10, bw, grid.size = c(65, 65), add = FALSE, xlab, ylab, xlim, ylim, lwd = 1, lty = 1, col = par("fg"), fill = "transparent", ...)
## S4 method for signature 'flowFrame' contour(x, y = 1:2, nlevels = 10, bw, grid.size = c(65, 65), add = FALSE, xlab, ylab, xlim, ylim, lwd = 1, lty = 1, col = par("fg"), fill = "transparent", ...)
x |
|
y |
Numeric or character vector of length 2 indicating the channels to plot. |
nlevels |
The approximate number of contour line levels, see
|
bw |
The bandwidth factor used for the kernel density estimation, see
|
grid.size |
The grid size used for the kernel density estimation, see
|
add |
Logical, indicating whether contour lines should be superimposed on an existing plot. |
xlab , ylab
|
The axis annotation. |
xlim , ylim
|
The plotting ranges. |
lwd , lty , col , fill
|
The usual plotting parameters, i.e. the line width, line type, line color and fill color. When using a fill color you should consider alpha blending to improve the results. |
... |
Parameters that are passed on to the plotting functions. |
A regular contour plot of the flow data in the
frame. It can be added on top of an existing plot using the add
argument.
Overlay of contours of densities for each individual
frame in the set. You should consider using differnt colors and alpha
blending to improve the result. This is only useful for a very limited
number of frames in a set (~5), for larger sets you should consider a
panelled lattice-type plot. Not that bw
, gridSize
and
nlevels
are passed on via the ... argument.
F. Hahne
bkde2D
, contour
,
flowFrame
,
flowSet
library(flowCore) data(GvHD) ## simple contour plot contour(GvHD[[1]]) ## overlay with existing plot plot(GvHD[[1]], c("FSC-H", "SSC-H")) contour(GvHD[[1]], add=TRUE, col="lightgray", lty=3) ## colored contours contour(GvHD[[1]], fill="red") cols <- rainbow(3, alpha=0.1) contour(GvHD[[1]], fill=cols, col=cols) ## overlay of multiple flowFrames in a flowSet contour(GvHD[1:3], col=cols, fill=cols)
library(flowCore) data(GvHD) ## simple contour plot contour(GvHD[[1]]) ## overlay with existing plot plot(GvHD[[1]], c("FSC-H", "SSC-H")) contour(GvHD[[1]], add=TRUE, col="lightgray", lty=3) ## colored contours contour(GvHD[[1]], fill="red") cols <- rainbow(3, alpha=0.1) contour(GvHD[[1]], fill=cols, col=cols) ## overlay of multiple flowFrames in a flowSet contour(GvHD[1:3], col=cols, fill=cols)
For flowSets
the idea is to
horizontally stack plots of density estimates for all frames in the
flowSet
for one or several flow parameters. In the latter case, each
parameter will be plotted in a separate panel, i.e., we implicitly condition
on parameters.
## S4 method for signature 'formula,flowSet' densityplot(x, data, ...) prepanel.densityplot.flowset.stack(x, y, frames, overlap = 0.3, subscripts, ..., which.channel) panel.densityplot.flowset.stack(x, y, darg = list(n = 50, na.rm = TRUE), frames, channel, overlap = 0.3, channel.name, filter = NULL, fill = superpose.polygon$col, lty = superpose.polygon$lty, lwd = superpose.polygon$lwd, alpha = superpose.polygon$alpha, col = superpose.polygon$border, groups = NULL, refline = NULL, margin = 0.005, stats = FALSE, pos = 0.5, digits = 2, abs = FALSE, fitGate = TRUE, checkName = TRUE, plotType = "densityplot", hist.type = "density", breaks = "Sturges", gp, ...) ## S4 method for signature 'formula,flowFrame' densityplot(x, data, overlay = NULL, ...) ## S4 method for signature 'formula,view' densityplot(x, data, ...) ## S4 method for signature 'formula,ncdfFlowSet' densityplot(x, data, ...) ## S4 method for signature 'formula,ncdfFlowList' densityplot(x, data, ...) ## S4 method for signature 'formula,flowSet' histogram(x, data, plotType, ...) ## S4 method for signature 'formula,flowFrame' histogram(x, data, ...) ## S4 method for signature 'formula,ncdfFlowSet' histogram(x, data, ...) ## S4 method for signature 'formula,ncdfFlowList' histogram(x, data, ...)
## S4 method for signature 'formula,flowSet' densityplot(x, data, ...) prepanel.densityplot.flowset.stack(x, y, frames, overlap = 0.3, subscripts, ..., which.channel) panel.densityplot.flowset.stack(x, y, darg = list(n = 50, na.rm = TRUE), frames, channel, overlap = 0.3, channel.name, filter = NULL, fill = superpose.polygon$col, lty = superpose.polygon$lty, lwd = superpose.polygon$lwd, alpha = superpose.polygon$alpha, col = superpose.polygon$border, groups = NULL, refline = NULL, margin = 0.005, stats = FALSE, pos = 0.5, digits = 2, abs = FALSE, fitGate = TRUE, checkName = TRUE, plotType = "densityplot", hist.type = "density", breaks = "Sturges", gp, ...) ## S4 method for signature 'formula,flowFrame' densityplot(x, data, overlay = NULL, ...) ## S4 method for signature 'formula,view' densityplot(x, data, ...) ## S4 method for signature 'formula,ncdfFlowSet' densityplot(x, data, ...) ## S4 method for signature 'formula,ncdfFlowList' densityplot(x, data, ...) ## S4 method for signature 'formula,flowSet' histogram(x, data, plotType, ...) ## S4 method for signature 'formula,flowFrame' histogram(x, data, ...) ## S4 method for signature 'formula,ncdfFlowSet' histogram(x, data, ...) ## S4 method for signature 'formula,ncdfFlowList' histogram(x, data, ...)
x |
A formula describing the structure of the plot and the variables to
be used in the display. The structure of the formula is |
data |
A flow data object that serves as a source of data, either a
|
... |
More arguments, usually passed on to the underlying lattice methods.
|
frames |
An environment containing frame-specific data. |
overlap |
The amount of overlap between stacked density plots. This
argument is ignored for the |
subscripts , which.channel , channel.name , y
|
Internal indices necessary to map panels to parameters. |
darg |
These arguments are passed unchanged to the corresponding
methods in lattice, and are listed here only because they provide different
defaults. See documentation for the original methods for details.
|
channel |
The name of the currently plotted flow parameter. |
filter |
A |
col , fill , lty , lwd , alpha
|
Graphical parameters. These mostly exist for
conveniance and much more control is available throught the
|
groups |
Use identical colors for grouping. The value of the argument
is expected to be a phenotypic variable in the |
refline |
Logical. Add one ore more vertical reference lines to the
plot. This argument is directly passed to
|
margin |
Either Logical value 'FALSE' or Numeric valuein |
stats , pos , digits , abs
|
Arguments to control statistics that is
associated with |
fitGate |
A |
checkName |
A |
plotType |
either 'densityplot' or 'histogram' |
hist.type |
see 'type' argument in 'help(panel.histogram)' |
breaks |
see 'help(hist)' |
gp |
A list of graphical parameters that are passed down to the low
level panel functions. This is for internal use only. The public user
interface to set graphical parameters is either |
overlay |
see help(xyplot). |
Not all standard lattice arguments will have the intended effect, but many should. For a fuller description of possible arguments and their effects, consult documentation on lattice (Trellis docs would also work for the fundamentals).
library(flowCore) library(flowStats) data(GvHD) GvHD <- GvHD[pData(GvHD)$Patient %in% 6:7] densityplot(~ `FSC-H`, GvHD) densityplot(~ `FSC-H` + `SSC-H`, GvHD) densityplot(~ ., GvHD[1:3]) ## include a filter densityplot(~ `FSC-H`, GvHD, filter=curv1Filter("FSC-H")) #display the gate by its boundaries with statistics densityplot(~ `FSC-H`, GvHD[1:2], filter=curv1Filter("FSC-H"),fitGate=FALSE,stats=TRUE) ## plot a single flowFrame densityplot(~ `SSC-H`, GvHD[[1]], margin=FALSE) ## plot histogram histogram(~ `SSC-H`, GvHD[[1]]) #default type is 'density' #change the type to 'count' and adjust breaks histogram(~ `SSC-H`, GvHD[[1]], margin=FALSE, type = "count", breaks = 50)
library(flowCore) library(flowStats) data(GvHD) GvHD <- GvHD[pData(GvHD)$Patient %in% 6:7] densityplot(~ `FSC-H`, GvHD) densityplot(~ `FSC-H` + `SSC-H`, GvHD) densityplot(~ ., GvHD[1:3]) ## include a filter densityplot(~ `FSC-H`, GvHD, filter=curv1Filter("FSC-H")) #display the gate by its boundaries with statistics densityplot(~ `FSC-H`, GvHD[1:2], filter=curv1Filter("FSC-H"),fitGate=FALSE,stats=TRUE) ## plot a single flowFrame densityplot(~ `SSC-H`, GvHD[[1]], margin=FALSE) ## plot histogram histogram(~ `SSC-H`, GvHD[[1]]) #default type is 'density' #change the type to 'count' and adjust breaks histogram(~ `SSC-H`, GvHD[[1]], margin=FALSE, type = "count", breaks = 50)
A method that makes standard plots from a flowFrame
. The user may
also provide various filter
or filterResult
arguments to
customize the plot.
## S4 method for signature 'flowFrame' flowPlot(x, child, filter = NULL, plotParameters = c("FSC-H", "SSC-H"), logx = FALSE, logy = FALSE, parent, colParent = "Grey", colChild = "Blue", showFilter = TRUE, gate.fill = "transparent", gate.border = "black", xlab, ylab, xlim, ylim, ...)
## S4 method for signature 'flowFrame' flowPlot(x, child, filter = NULL, plotParameters = c("FSC-H", "SSC-H"), logx = FALSE, logy = FALSE, parent, colParent = "Grey", colChild = "Blue", showFilter = TRUE, gate.fill = "transparent", gate.border = "black", xlab, ylab, xlim, ylim, ...)
x |
An object of class |
child |
An optional argument of class |
filter |
A |
plotParameters |
A vector of charactors defining the x and y variables in terms of columns in the data. |
logx , logy
|
Logical controlling wheterh the corresponding variables
will be log transfromed before passing to the panel function. Default to
|
parent |
An optional argument of class |
colParent |
Specifying the color for |
colChild |
Specifies the color for |
showFilter |
Logical, specifying whether to show the |
gate.fill |
Specifies the fill color of the gate. Default to
|
gate.border |
Character or specifying the color of the gate border.
Default to |
xlab , ylab
|
Labels for data axes. |
xlim , ylim
|
Numeric vectors of length 2 specifying axis limits. |
... |
More arguments, usually passed on to the underlying lattice methods. |
The plot that is most commonly used in flow cytometry data analysis is usuall called a "dot plot". In common statistical language, we would call this a scatter plot. The basic idea is a 2-dimensional plot that shows the location of every cell in regard to the measurements made on it, for example, forward scatter vs side scatter. Most applications will, in addition to the data, want to show information about one or more filters (gates). Since there can be a very large number of cells in a sample, it is common to show a smoothed version of the data that doesn't involve registering every point on the graph.
P. Haaland
library(flowCore) data(GvHD) flowPlot(GvHD[["s5a01"]]) flowPlot(transform("SSC-H"=asinh,"FSC-H"=asinh) %on% GvHD[["s5a01"]])
library(flowCore) data(GvHD) flowPlot(GvHD[["s5a01"]]) flowPlot(transform("SSC-H"=asinh,"FSC-H"=asinh) %on% GvHD[["s5a01"]])
flowViz.par.get
is the equivalent to
trellis.par.get
. It queries the session wide defaults
for all lattice
and flowViz
graphical parameters.
flowViz.par.get(name = NULL) flowViz.par.set(name, value, ..., theme, warn = TRUE, strict = FALSE, reset = FALSE)
flowViz.par.get(name = NULL) flowViz.par.set(name, value, ..., theme, warn = TRUE, strict = FALSE, reset = FALSE)
name |
The name of a parameter category to set. |
value |
A named list of values to set for category |
... |
Further arguments that get passed on. |
theme |
The theme to set. See
|
warn |
This gets passed on directly to |
strict |
This gets passed on directly to |
reset |
|
flowViz.par.set
is the equivalent to
trellis.par.set
. It sets the same set
of graphical parameters, either in the flowViz
package or directly in
lattice
.
Getting and setting graphical parameters in flowViz
follows exactly
the mechanism of the lattice
package. For all purpose and intentions,
flowViz.par.get
and flowViz.par.get
can be viewed as wrappers
around their lattice
counterparts
trellis.par.get
and
trellis.par.set
and you should
consult their documentation for further details.
We introduce four new categories of graphical parameters that are relevant
for flowViz
plots:
Controls the appearance of gate boundaries in
xyplots
(if smooth=TRUE
) or of the points within a gate region
(smooth=FALSE
). Available parameters are col
,
cex
,pch
,alpha
,lwd
,lty
and fill
.
Controls the appearance of gate boundaries in
densityplots
. Available parameters are col
,
alpha
,lwd
,lty
and fill
.
Controls the appearance of 'regular' points in a
flowViz
plot. Available parameters are col
,
cex
,pch
,alpha
and fill
.
Controls the appearance of the text used for gate names.
Available parameters are col
, cex
,font
,alpha
and
lineheight
.
flowViz.par.get
returns a list of graphical parameter defaults, if
name
is not empty, only for this particular category. For an empty
name
argument, the function returns all parameter defaults, including
the ones specified in the lattice package.
flowViz.par.set
is called for its side-effects of setting default
parameters.
Because parameter settings in lattice
are device-dependent,
flowViz.par.get
will open a (default) device none is open at the time
of the query.
F. Hahne
Deepayan Sarker, Lattice, Multivariate Data Visualization with R, Springer, New York, 2008
trellis.par.get
and
trellis.par.set
## Return all available parameters, including lattice ones flowViz.par.get() ## Set the font for gate names flowViz.par.set("gate.text", list(font=2)) ## Query only the gate.text category flowViz.par.get("gate.text") ## Set a lattice parameter plot.symbol <- trellis.par.get("plot.symbol") flowViz.par.set("plot.symbol", list(col="red")) trellis.par.get("plot.symbol") ## undo all settings flowViz.par.set(list(plot.symbol=plot.symbol, gate.text=list(font=1))) library(flowCore) data(GvHD) fs <- GvHD[1:2] # using default ggplot2like theme densityplot(~`FSC-H`, fs) xyplot(`SSC-H`~`FSC-H`, fs, smooth = FALSE) # reset it with default lattice theme flowViz.par.set(theme = trellis.par.get(), reset = TRUE) densityplot(~`FSC-H`, fs) xyplot(`SSC-H`~`FSC-H`, fs, smooth = FALSE)
## Return all available parameters, including lattice ones flowViz.par.get() ## Set the font for gate names flowViz.par.set("gate.text", list(font=2)) ## Query only the gate.text category flowViz.par.get("gate.text") ## Set a lattice parameter plot.symbol <- trellis.par.get("plot.symbol") flowViz.par.set("plot.symbol", list(col="red")) trellis.par.get("plot.symbol") ## undo all settings flowViz.par.set(list(plot.symbol=plot.symbol, gate.text=list(font=1))) library(flowCore) data(GvHD) fs <- GvHD[1:2] # using default ggplot2like theme densityplot(~`FSC-H`, fs) xyplot(`SSC-H`~`FSC-H`, fs, smooth = FALSE) # reset it with default lattice theme flowViz.par.set(theme = trellis.par.get(), reset = TRUE) densityplot(~`FSC-H`, fs) xyplot(`SSC-H`~`FSC-H`, fs, smooth = FALSE)
These methods extend the basic graphics lines
methods for
drawing of filter
boundaries. They
allow for multiple dispatch, since not all
filter
types need to be evaluated for
plotting, but this decision should be made internally.
## S4 method for signature 'filter,missing' glines(x, data, verbose = TRUE, ...)
## S4 method for signature 'filter,missing' glines(x, data, verbose = TRUE, ...)
x |
filter or filterResult or any derived filter class |
data |
flowFrame or filterResult or character or missing or ANY |
verbose |
logical |
... |
other arguments
|
When plotting flowFrames
using the
plot
or xyplot
methods provided by flowViz
, the plotted
parameters are recorded, which makes it possible to correctly overlay the
outlines of filter
assuming that they
are defined for the respective parameters. Warnings and error will be cast
for the cases where the parameters are non-distinct or ambigious.
The flow parameters plotted can be passed on to any of the methods through
the optional channels
argument, which always gets precedence over
automatically detected parameters.
The methods support all plotting parameters that are available for the
base
lines
functions.
F. Hahne
These methods extend the lattice lpoints
methods for drawing of points contained within a
filter
. They allow for multiple
dispatch, since not all filter
types
need to be evaluated for plotting, but this decision should be made
internally. In any case, we need the raw data in the form of a
flowFrame
.
## S4 method for signature 'filter,flowFrame,missing' glpoints(x, data, channels, verbose = TRUE, filterResult = NULL, ...)
## S4 method for signature 'filter,flowFrame,missing' glpoints(x, data, channels, verbose = TRUE, filterResult = NULL, ...)
x |
filter, filterResult or any derived filter class |
data |
flowFrame or missing |
channels |
character or missing |
verbose |
logical |
filterResult |
filterResult class |
... |
other arguments |
When plotting flowFrame
s using the
plot
method provided by flowViz
, the plotted parameters are
recorded, which makes it possible to correctly overlay the points within
filter
s assuming that they are defined
for the respective parameters. Warnings and error will be cast for the cases
where the parameters are non-distinct or ambigious. These methods are meant
to be used within lattice panel functions and are probably not of much use
outside of those.
General
method for all objects inheriting from
filter
. This is used as the default
when no more explicit method is found. It tries to find the plotted
parameters from the internal flowViz.state
environment. This only
works if the flow data has been plotted using the plot
methods
provided by this flowViz
package.
This gives a useful error message when we don't get what we need.
We can get all
the information about a filter
from its
filterResult
without the need to
re-evaluate.
We can get all the information about a
filter
from its
filterResult
without the need to
re-evaluate.
We either need a
filterResult
or the raw data as a
flowFrame
for
curv1Filter
s.
see above
see above
see above
We either need a
filterResult
or the raw data as a
flowFrame
for
curv2Filter
s.
We evaluate the
filter
on the
flowFrame
and plot the subset of
selected points. By default, every subpopulation (if there are any) is
colored differently.
We evaluate the
filter
on the
flowFrame
and plot the subset of
selected points. By default, every subpopulation (if there are any) is
colored differently.
see above
see above
see above
see above
see above
see above
see above
see above
see above
see above
see above
see above
F. Hahne
These methods extend the lattice lpolygon
methods for drawing of filter
regions.
They allow for multiple dispatch, since not all
filter
types need to be evaluated for
plotting, but this decision should be made internally.
## S4 method for signature 'filter,missing' glpolygon(x, data, verbose = TRUE, gpar = flowViz.par.get(), strict = TRUE, ...)
## S4 method for signature 'filter,missing' glpolygon(x, data, verbose = TRUE, gpar = flowViz.par.get(), strict = TRUE, ...)
x |
filter or filterResult or any derived filter class |
data |
flowFrame or filterResult or character or missing or ANY |
verbose |
logical |
gpar |
a list of graphical parameters. see 'help(flowViz.par.get)' for details. |
strict |
logical |
... |
other arguments |
When plotting flowFrames
using the
any of the lattice-type plot
method provided by flowViz
, the
plotted parameters are recorded, which makes it possible to correctly
overlay the outlines of filter
assuming
that they are defined for the respective parameters. Warnings and error will
be cast for the cases where the parameters are non-distinct or ambigious.
These methods are meant to be used within lattice panel functions and are
probably not of much use outside of those.
The methods will return the outlines of the gate region as polygon vertices.
General method for all objects
inheriting from filter
. This is used as
the default when no more explicit method is found. It tries to find the
plotted parameters from the internal flowViz.state
environment. This
only works if the flow data has been plotted using the plot
methods
provided by this flowViz
package.
General method for all
filterResult
object. This
basically extracts the filter
from the
filterResult
and dispatches on
that.
For some
filter
types we need the raw data to
re-evaluate the filter.
We either need a
filterResult
or the raw data as a
flowFrame
for
curv1Filter
s.
see above
see above
see above
We either need a
filterResult
or the raw data as a
flowFrame
for
curv2Filter
.
see above
see above
We don't know how to plot regions
of a kmeansFilter
, hence we warn.
We either need a
filterResult
or the raw data as a
flowFrame
for
norm2Filter
.
see above
see above
We can plot a
polygonGate
directly from the gate definition.
see above
see above
We can plot a
quadGate
directly from the gate definition.
see above
see above
We can plot a
rectangleGate
directly from the gate definition.
see above
see above
We can plot a
rectangleGate
directly from the gate definition.
see above
see above
F. Hahne
These methods extend the basic graphics points
methods for
drawing of points contained within a
filter
. They allow for multiple
dispatch, since not all filter
types
need to be evaluated for plotting, but this decision should be made
internally. In any case, we need the raw data in the form of a
flowFrame
.
## S4 method for signature 'filter,flowFrame,missing' gpoints(x, data, channels, verbose = TRUE, filterResult = NULL, ...)
## S4 method for signature 'filter,flowFrame,missing' gpoints(x, data, channels, verbose = TRUE, filterResult = NULL, ...)
x |
filter, filterResult or any derived filter class |
data |
flowFrame or missing |
channels |
character or missing |
verbose |
logical |
filterResult |
filterResult class |
... |
other arguments |
When plotting flowFrame
s using the
plot
method provided by flowViz
, the plotted parameters are
recorded, which makes it possible to correctly overlay the points within
filter
s assuming that they are defined
for the respective parameters. Warnings and error will be cast for the cases
where the parameters are non-distinct or ambigious.
General
method for all objects inheriting from
filter
. This is used as the default
when no more explicit method is found. It tries to find the plotted
parameters from the internal flowViz.state
environment. This only
works if the flow data has been plotted using the plot
methods
provided by this flowViz
package.
This gives a useful error message when we don't get what we need.
We can get all
the information about a filter
from its
filterResult
without the need to
re-evaluate.
We can get all the information about a
filter
from its
filterResult
without the need to
re-evaluate.
We either need a
filterResult
or the raw data as a
flowFrame
for
curv1Filter
s.
see above
see above
see above
We either need a
filterResult
or the raw data as a
flowFrame
for
curv2Filter
s.
We evaluate the
filter
on the
flowFrame
and plot the subset of
selected points. By default, every subpopulation (if there are any) is
colored differently.
We evaluate the
filter
on the
flowFrame
and plot the subset of
selected points. By default, every subpopulation (if there are any) is
colored differently.
see above
see above
see above
see above
see above
see above
see above
see above
see above
see above
F. Hahne
filter
,
flowFrame
, glines
,
gpolygon
These methods extend the basic graphics polygon
methods for
drawing of filter
regions. They allow
for multiple dispatch, since not all
filter
types need to be evaluated for
plotting, but this decision should be made internally.
## S4 method for signature 'filter,missing' gpolygon(x, data, verbose = TRUE, ...)
## S4 method for signature 'filter,missing' gpolygon(x, data, verbose = TRUE, ...)
x |
filter or filterResult or any derived filter class |
data |
flowFrame or filterResult or character or missing or ANY |
verbose |
logical |
... |
other arguments |
When plotting flowFrame
s using the
plot
method provided by flowViz
, the plotted parameters are
recorded, which makes it possible to correctly overlay the outlines of
filter
s assuming that they are defined
for the respective parameters. Warnings and error will be cast for the cases
where the parameters are non-distinct or ambigious.
The flow parameters plotted can be passed on to any of the methods through
the optional channels
argument, which always gets precedence over
automatically detected parameters.
The methods support all plotting parameters that are available for the
base
polygon
functions.
General method for all objects
inheriting from filter
. This is used as
the default when no more explicit method is found. It tries to find the
plotted parameters from the internal flowViz.state
environment. This
only works if the flow data has been plotted using the plot
methods
provided by this flowViz
package.
General method for all
filterResult
object. This
basically extracts the filter
from the
filterResult
and dispatches on
that.
For some
filter
types we need the raw data to
re-evaluate the filter.
We either need a
filterResult
or the raw data as a
flowFrame
for
curv1Filter
s.
see above
see above
see above
We either need a
filterResult
or the raw data as a
flowFrame
for
curv2Filter
.
see above
see above
We don't know how to plot regions
of a kmeansFilter
, hence we warn.
We either need a
filterResult
or the raw data as a
flowFrame
for
norm2Filter
.
see above
see above
We can plot a
polygonGate
directly from the gate definition.
see above
see above
We can plot a
quadGate
directly from the gate definition.
see above
see above
We can plot a
rectangleGate
directly from the gate definition.
see above
see above
We can plot a
ellipsoidGate
directly from the gate definition.
see above
see above
F. Hahne
filter
,
flowFrame
, glines
,
gpoints
Various methods implementing multipanel visualizations for flow data using
infrastructure provided in the lattice package. The original generics for
these methods are defined in lattice, and these S4 methods (mostly) dispatch
on a formula and the data
argument which must be of class
flowSet
or flowFrame
. The formula has to be fairly basic:
conditioning can be done using phenodata variables and channel names (the
colnames
slot) can be used as panel variables. See examples below for
sample usage.
## S4 method for signature 'formula,flowSet' levelplot(x, data, xlab, ylab, as.table = TRUE, contour = TRUE, labels = FALSE, n = 50, ...) ## S4 method for signature 'formula,flowSet' qqmath(x, data, xlab, ylab, f.value = function(n) ppoints(ceiling(sqrt(n))), distribution = qnorm, ...) ## S4 method for signature 'flowFrame,missing' parallel(x, data, reorder.by = function(x) var(x, na.rm = TRUE), time = "Time", exclude.time = TRUE, ...) ## S4 method for signature 'formula,flowSet' parallel(x, data, time = "Time", exclude.time = TRUE, filter = NULL, xlab = NULL, ylab = NULL, ...)
## S4 method for signature 'formula,flowSet' levelplot(x, data, xlab, ylab, as.table = TRUE, contour = TRUE, labels = FALSE, n = 50, ...) ## S4 method for signature 'formula,flowSet' qqmath(x, data, xlab, ylab, f.value = function(n) ppoints(ceiling(sqrt(n))), distribution = qnorm, ...) ## S4 method for signature 'flowFrame,missing' parallel(x, data, reorder.by = function(x) var(x, na.rm = TRUE), time = "Time", exclude.time = TRUE, ...) ## S4 method for signature 'formula,flowSet' parallel(x, data, time = "Time", exclude.time = TRUE, filter = NULL, xlab = NULL, ylab = NULL, ...)
x |
a formula describing the structure of the plot and the variables to be used in the display. |
data |
a |
xlab , ylab
|
Labels for data axes, with suitable defaults taken from the formula |
as.table , contour , labels
|
These arguments are passed unchanged to the corresponding methods in lattice, and are listed here only because they provide different defaults. See documentation for the original methods for details. |
n |
the number of bins on each axis to be used when evaluating the density |
... |
more arguments, usually passed on to the underlying lattice methods. |
f.value , distribution
|
number of points used in Q-Q plot, and the
reference distribution used. See |
reorder.by |
a function, which is applied to each column. The columns
are ordered by the results. Reordering can be suppressed by setting this to
|
time |
A character string giving the name of the column recording time. |
exclude.time |
logical, specifying whether to exclude the time variable from a scatter plot matrix or parallel coordinates plot. It is rarely meaningful not to do so. |
filter |
flowCore filter |
Not all standard lattice arguments will have the intended effect, but many should. For a fuller description of possible arguments and their effects, consult documentation on lattice (Trellis docs would also work for the fundamentals).
signature(x = "formula", data = "flowSet")
: creates
theoretical quantile plots of a given channel, with one or more samples per
panel
signature(x = "formula", data = "flowSet")
: similar
to the xyplot
method, but plots estimated density (using
kde2d
) with a common z-scale and an optional color
key.
signature(x = "flowFrame", data = "missing")
: draws a
parallel coordinates plot of all channels (excluding time, by default) of a
flowFrame
object. This is rarely useful without transparency, but
that is currently only possible with the pdf
device (and
perhaps the aqua device as well).
library(flowCore) data(GvHD) qqmath( ~ `FSC-H` | factor(Patient), GvHD, grid = TRUE, type = "l", f.value = ppoints(100)) ## contourplot of bivariate density: require(colorspace) YlOrBr <- c("#FFFFD4", "#FED98E", "#FE9929", "#D95F0E", "#993404") colori <- colorRampPalette(YlOrBr) levelplot(asinh(`SSC-H`) ~ asinh(`FSC-H`) | Visit + Patient, GvHD, n = 20, col.regions = colori(50), main = "Contour Plot") ## parallel coordinate plots parallel(GvHD[["s6a01"]]) ## Not run: ## try with PDF device parallel(GvHD[["s7a01"]], alpha = 0.01) ## End(Not run)
library(flowCore) data(GvHD) qqmath( ~ `FSC-H` | factor(Patient), GvHD, grid = TRUE, type = "l", f.value = ppoints(100)) ## contourplot of bivariate density: require(colorspace) YlOrBr <- c("#FFFFD4", "#FED98E", "#FE9929", "#D95F0E", "#993404") colori <- colorRampPalette(YlOrBr) levelplot(asinh(`SSC-H`) ~ asinh(`FSC-H`) | Visit + Patient, GvHD, n = 20, col.regions = colori(50), main = "Contour Plot") ## parallel coordinate plots parallel(GvHD[["s6a01"]]) ## Not run: ## try with PDF device parallel(GvHD[["s7a01"]], alpha = 0.01) ## End(Not run)
A basic method to plot flowFrame
objects. Depending on the number of dimensions, different types of plots are
generates. See below for details.
## S4 method for signature 'flowFrame,missing' plot(x, y, smooth = TRUE, ...) ## S4 method for signature 'flowFrame,character' plot(x, y, smooth = TRUE, pch, ...)
## S4 method for signature 'flowFrame,missing' plot(x, y, smooth = TRUE, ...) ## S4 method for signature 'flowFrame,character' plot(x, y, smooth = TRUE, pch, ...)
x |
flowFrame |
y |
(optional) channel names |
smooth |
logical |
... |
other arguments |
pch |
point type |
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 scatter
or pairs plots. For far more sophisticated plotting of flow cytometry data,
see the lattice-style plot methods provided by this package.
F. Hahne
xyplot
,
flowFrame
,
densityplot
This function creates Trellis displays of Empirical Cumulative Distribution Functions from flow cytometry data using a formula interface.
prepanel.ecdfplot.flowset(x, frames, channel, f.value, ...) panel.ecdfplot.flowset(x, frames, channel, f.value, ref = TRUE, groups = NULL, subscripts, col = superpose.symbol$col, col.points = col, pch = superpose.symbol$pch, cex = superpose.symbol$cex, alpha = superpose.symbol$alpha, col.line = col, lty = superpose.line$lty, lwd = superpose.line$lwd, ...) ## S4 method for signature 'formula,flowSet' ecdfplot(x, data, xlab, f.value = function(n) ppoints(ceiling(sqrt(n))), prepanel = prepanel.ecdfplot.flowset, panel = panel.ecdfplot.flowset, type = "l", as.table = TRUE, ...)
prepanel.ecdfplot.flowset(x, frames, channel, f.value, ...) panel.ecdfplot.flowset(x, frames, channel, f.value, ref = TRUE, groups = NULL, subscripts, col = superpose.symbol$col, col.points = col, pch = superpose.symbol$pch, cex = superpose.symbol$cex, alpha = superpose.symbol$alpha, col.line = col, lty = superpose.line$lty, lwd = superpose.line$lwd, ...) ## S4 method for signature 'formula,flowSet' ecdfplot(x, data, xlab, f.value = function(n) ppoints(ceiling(sqrt(n))), prepanel = prepanel.ecdfplot.flowset, panel = panel.ecdfplot.flowset, type = "l", as.table = TRUE, ...)
x |
a formula describing the structure of the plot and the variables to be used in the display. For the prepanel and panel functions, a vector of names for the flow frames to be used in the panel. |
frames |
environment containing frame-specific data |
channel |
expression involving names of columns in the data |
f.value |
determines the number of points used in the plot
|
... |
more arguments, usually passed on to the underlying lattice methods and the panel function. |
ref |
logical; whether to add reference lines at 0 and 1 |
groups , subscripts
|
grouping variable, if specified, and subscripts
indexing which frames are being used in the panel. See
|
col , col.points , pch , cex , alpha , col.line , lty , lwd
|
vector of graphical parameters that are replicated for each group |
data |
a |
xlab |
Labels for data axes, with suitable defaults taken from the formula |
panel , prepanel
|
the panel and prepanel functions. |
type |
type of rendering; by default lines are drawn |
as.table |
logical; whether to draw panels from top left |
signature(x = "formula", data = "flowSet")
: plote
empirical CDF for a given channel, with one or more samples per panel
Not all standard lattice arguments will have the intended effect, but many should. For a fuller description of possible arguments and their effects, consult documentation on lattice.
library(flowCore) data(GvHD) ecdfplot(~ `FSC-H` | Patient, GvHD, f.value = ppoints(100)) ecdfplot(~ asinh(`FSC-H`) | Patient, GvHD, strip = strip.custom(strip.names = TRUE), ref = FALSE) ecdfplot(~ asinh(`FSC-H`) | Patient, GvHD, groups = Visit, strip = strip.custom(strip.names = TRUE), ref = FALSE, auto.key = list(columns = 4))
library(flowCore) data(GvHD) ecdfplot(~ `FSC-H` | Patient, GvHD, f.value = ppoints(100)) ecdfplot(~ asinh(`FSC-H`) | Patient, GvHD, strip = strip.custom(strip.names = TRUE), ref = FALSE) ecdfplot(~ asinh(`FSC-H`) | Patient, GvHD, groups = Visit, strip = strip.custom(strip.names = TRUE), ref = FALSE, auto.key = list(columns = 4))
This function create Trellis scatter plots matrices (splom) from flow cytometry data.
## S4 method for signature 'flowFrame,missing' splom(x, data, pscales, time, exclude.time = TRUE, names = FALSE, ...)
## S4 method for signature 'flowFrame,missing' splom(x, data, pscales, time, exclude.time = TRUE, names = FALSE, ...)
x |
A formula describing the structure of the plot and the variables to be used in the display. |
data |
A |
pscales |
This arguments is passed unchanged to the corresponding methods in lattice, and is listed here only because it provides a different default. See documentation for the original methods for details. |
time |
A character string giving the name of the data column recording time. If not provided, we try to guess from the available parameters. |
exclude.time |
Logical, specifying whether to exclude the time variable
from a scatter plot matrix. Defaults to |
names |
Logical specifying wether gate names should be added to the plot. Currently, this feature is not supported for splom plots. |
... |
More arguments, usually passed on to the underlying lattice methods. |
The function draws a scatter plot matrix of the data for each flow parameter
in a flowFrame
. For the most, one can think about this as a
rectangular arrangement of separate xyplots
,
and most of that functionality is also available here. To be more precise,
the function repeatedly calls panel.xyplot.flowframe
to do the actual
plotting. Please see its documentation for details.
F. Hahne, D. Sarkar
Not all standard lattice arguments will have the intended effect, but many should. For a fuller description of possible arguments and their effects, consult documentation on lattice.
library(flowCore) data(GvHD) library(flowStats) tf <- transformList(colnames(GvHD)[3:7], asinh) dat <- tf %on% GvHD[[3]] ## scatter plot matrix of individual flowFrames lattice.options(panel.error=NULL) splom(dat) splom(dat[,1:3], smooth = FALSE) ## displaying filters rg <- rectangleGate("FSC-H"=c(200,400), "SSC-H"=c(300,700), "FL1-H"=c(2,4), "FL2-A"=c(4,7)) splom(dat, filter=rg) splom(dat, filter=rectangleGate("FSC-H"=c(400,800))) splom(dat[,1:4], smooth = FALSE, filter=norm2Filter("FSC-H", "SSC-H", scale=1.5))
library(flowCore) data(GvHD) library(flowStats) tf <- transformList(colnames(GvHD)[3:7], asinh) dat <- tf %on% GvHD[[3]] ## scatter plot matrix of individual flowFrames lattice.options(panel.error=NULL) splom(dat) splom(dat[,1:3], smooth = FALSE) ## displaying filters rg <- rectangleGate("FSC-H"=c(200,400), "SSC-H"=c(300,700), "FL1-H"=c(2,4), "FL2-A"=c(4,7)) splom(dat, filter=rg) splom(dat, filter=rectangleGate("FSC-H"=c(400,800))) splom(dat[,1:4], smooth = FALSE, filter=norm2Filter("FSC-H", "SSC-H", scale=1.5))
Plots values of one parameter for each flowFrame in a flowSet against time.
timelineplot(x, channel, type = c("stacked", "scaled", "native", "frequency"), col, ylab = names(x), binSize, varCut = 1, ...) ## S4 method for signature 'flowSet,character' timeLinePlot(x, channel, type = c("stacked", "scaled", "native", "frequency"), col = NULL, ylab = sampleNames(x), binSize, varCut = 1, ...) ## S4 method for signature 'flowFrame,character' timeLinePlot(x, channel, ...) ## S4 method for signature 'ANY,missing' timeLinePlot(x, channel, ...)
timelineplot(x, channel, type = c("stacked", "scaled", "native", "frequency"), col, ylab = names(x), binSize, varCut = 1, ...) ## S4 method for signature 'flowSet,character' timeLinePlot(x, channel, type = c("stacked", "scaled", "native", "frequency"), col = NULL, ylab = sampleNames(x), binSize, varCut = 1, ...) ## S4 method for signature 'flowFrame,character' timeLinePlot(x, channel, ...) ## S4 method for signature 'ANY,missing' timeLinePlot(x, channel, ...)
x |
An object of class
|
channel |
The parameter for which the data is to be plotted |
type |
One in 'stacked', 'scaled' or 'native'. 'stacked' will plot the measurements for the frames on top of each other. 'scaled' will align the median values around zero and 'native' will plot the values in the original dimensions of the measurement range. |
col |
Optional color parameter. |
ylab |
The axis annotation to add on the y-axis for stacked plots. |
binSize |
The number of events per bin. If not set, a reasonable default is computed. |
varCut |
The cutoff in the adjusted variance to which the quality score
is computed. Basically, all values that are outside of the confidence
interval defined by |
... |
Further arguments that are passed on to the base plotting functions. |
Plotting flow cytometry data against the time domain can help to identify problems with the fluidics or drifts in the instrument setting during measurement runs.
This function creates plots for all flowFrames in a flowSet for a given parameter against time. A barplot legend indicates the deviation from the median for each sample. There is also a flowFrame method, which will create a plot for a single flowFrame only.
In addition, the function computes a quality score for each frame, which essentially is the sum of the positive distances of each bin mean from a frame-specific confidence interval, divided by the number of bins. Values larger than zero indicate a problem.
A numeric vector of quality scores.
F. Hahne
library(flowCore) data(GvHD) opar <- par(ask=TRUE) res <- timeLinePlot(GvHD[[1]], "SSC-H") res res <- timeLinePlot(GvHD, "SSC-H") res <- timeLinePlot(GvHD, "SSC-H", type="scaled", varCut=4) res <- timeLinePlot(GvHD[1:4], "SSC-H", type="native", binSize=50) par(opar)
library(flowCore) data(GvHD) opar <- par(ask=TRUE) res <- timeLinePlot(GvHD[[1]], "SSC-H") res res <- timeLinePlot(GvHD, "SSC-H") res <- timeLinePlot(GvHD, "SSC-H", type="scaled", varCut=4) res <- timeLinePlot(GvHD[1:4], "SSC-H", type="native", binSize=50) par(opar)
These functions create Trellis scatter plots (a.k.a. dot plots in the Flow Cytometry community) from flow cytometry data.
## S4 method for signature 'flowFrame,missing' xyplot(x, data, time, xlab, ylab = "", layout, prepanel = prepanel.xyplot.flowframe.time, panel = panel.xyplot.flowframe.time, type = "discrete", ...) prepanel.xyplot.flowframe.time(x, y, frame, time, xlim, ylim, ...) panel.xyplot.flowframe.time(x, y, frame, time, type = "discrete", nrpoints = 0, binSize = 100, ...) ## S4 method for signature 'formula,flowFrame' xyplot(x, data, filter = NULL, overlay = NULL, stats = FALSE, strip.text = NULL, ...) prepanel.xyplot.flowframe(frame, channel.x.name, channel.y.name, x, y, xlim, ylim, ...) panel.xyplot.flowframe(frame, filter = NULL, smooth = TRUE, margin = TRUE, outline = FALSE, channel.x.name, channel.y.name, pch = gp$flow.symbol$pch, alpha = gp$flow.symbol$alpha, cex = gp$flow.symbol$cex, col = gp$flow.symbol$col, gp, xbins = 0, binTrans = sqrt, stats = FALSE, pos = 0.5, digits = 2, abs = FALSE, overlay = NULL, checkName = TRUE, sample.ratio = 1, overlay.symbol = NULL, ...) ## S4 method for signature 'formula,flowSet' xyplot(x, data, ...) prepanel.xyplot.flowset(x, frames, channel.x.name, channel.y.name, xlim, ylim, ...) panel.xyplot.flowset(x, frames, filter = NULL, channel.x, channel.y, overlay = NULL, stats = FALSE, ...) ## S4 method for signature 'formula,view' xyplot(x, data, ...) ## S4 method for signature 'view,missing' xyplot(x, data, ...) ## S4 method for signature 'formula,gateView' xyplot(x, data, filter = NULL, par.settings, ...) ## S4 method for signature 'formula,ncdfFlowSet' xyplot(x, data, ...) ## S4 method for signature 'formula,ncdfFlowList' xyplot(x, data, ...)
## S4 method for signature 'flowFrame,missing' xyplot(x, data, time, xlab, ylab = "", layout, prepanel = prepanel.xyplot.flowframe.time, panel = panel.xyplot.flowframe.time, type = "discrete", ...) prepanel.xyplot.flowframe.time(x, y, frame, time, xlim, ylim, ...) panel.xyplot.flowframe.time(x, y, frame, time, type = "discrete", nrpoints = 0, binSize = 100, ...) ## S4 method for signature 'formula,flowFrame' xyplot(x, data, filter = NULL, overlay = NULL, stats = FALSE, strip.text = NULL, ...) prepanel.xyplot.flowframe(frame, channel.x.name, channel.y.name, x, y, xlim, ylim, ...) panel.xyplot.flowframe(frame, filter = NULL, smooth = TRUE, margin = TRUE, outline = FALSE, channel.x.name, channel.y.name, pch = gp$flow.symbol$pch, alpha = gp$flow.symbol$alpha, cex = gp$flow.symbol$cex, col = gp$flow.symbol$col, gp, xbins = 0, binTrans = sqrt, stats = FALSE, pos = 0.5, digits = 2, abs = FALSE, overlay = NULL, checkName = TRUE, sample.ratio = 1, overlay.symbol = NULL, ...) ## S4 method for signature 'formula,flowSet' xyplot(x, data, ...) prepanel.xyplot.flowset(x, frames, channel.x.name, channel.y.name, xlim, ylim, ...) panel.xyplot.flowset(x, frames, filter = NULL, channel.x, channel.y, overlay = NULL, stats = FALSE, ...) ## S4 method for signature 'formula,view' xyplot(x, data, ...) ## S4 method for signature 'view,missing' xyplot(x, data, ...) ## S4 method for signature 'formula,gateView' xyplot(x, data, filter = NULL, par.settings, ...) ## S4 method for signature 'formula,ncdfFlowSet' xyplot(x, data, ...) ## S4 method for signature 'formula,ncdfFlowList' xyplot(x, data, ...)
x |
A formula describing the structure of the plot and the variables to
be used in the display. In the |
data , y , frame
|
a |
time |
A character string giving the name of the data column recording time. If not provided, we try to guess from the available parameters. |
xlab , ylab
|
Labels for data axes, with suitable defaults taken from the formula. |
layout |
These arguments are passed unchanged to the corresponding methods in lattice, and are listed here only because they provide different defaults. See documentation for the original methods for details. |
prepanel |
The prepanel function. See
|
panel |
The panel function. See |
type |
type of rendering; see
|
... |
marker.only More arguments, usually passed on to the underlying lattice methods. |
xlim , ylim
|
limits for data axes. If not given, they are taken from the ranges stored in flowFrame |
nrpoints |
The number of points plotted on the smoothed plot in sparse
regions. This is only listed here because we use a different default. See
|
binSize |
The size of a bin (i.e., the number of events within a bin) used for the smoothed average timeline plots. |
filter |
A |
overlay |
The extra cell events plotted on top of the current cell
population. It is a |
stats , pos , digits , abs
|
Arguments to control statistics that is
associated with |
strip.text |
A |
channel.x.name , channel.y.name
|
Character strings giving corresponding names used to match filter parameters if applicable. |
smooth |
Logical. If |
margin |
Logical indicating whether to truncate the density estimation
on the margins of the measurement range and plot margin events as lines if
|
outline |
Logical, specifying whether to add the boundaries of a gate
to the plot when |
pch , cex , col , alpha
|
Graphical parameters used when |
gp |
A list of graphical parameters that are passed down to the low
level panel functions. This is for internal use only. The public user
interface to set graphical parameters is either |
xbins |
The argument passed to |
binTrans |
The argument passed to
|
checkName |
|
sample.ratio |
|
overlay.symbol |
list of the lattice graphic parameters to format the overlay points. |
frames |
An environment containing frame-specific data. |
channel.x , channel.y
|
Expressions defining the x and y variables in terms of columns in the data. Can involve functions or multiple columns from the data, however this usage is discouraged. |
par.settings |
A list of lists of graphical parameters. See |
The implementation of xyplot
in flowViz
is very close to the
original lattice
version. Concepts like conditioning and the use of
panels apply directly to the flow cytometry data. The single fundamental
difference is that conditioning variables are not evaluated in the context
of the raw data, but rather in the phenoData
slot environment (only
for the flowSet
methods. Thus, we can directly condition on pheotypic
variables like sample groups, patients or treatments.
In the formula interface, the primary and secondary variables (separated by
the tilde) have to be valid parameter names. Please note that frequently
used variants like FSC-H
and SSC-H
are not syntactically
correct R symbols, and need to be wrapped in ` `
. E.g.,
`FSC-H`
. For flowSets
, the use of a conditioning variable is
optional. We implicitely condition on flowFrames
and the default is
to arrange panels by sample names.
signature(x = "flowFrame", data = "missing")
: Creates
diagnostic time series plots of flow parameter values against time. These
plots are useful to detect quality issues in the raw data. If not provided
explicitely via the tine
argument, the time parameter will be
automatically detected. The additional arguments xlab
, ylab
,
nrpoints
, and layout
are only listed because flowViz
provides different defaults. Internally, they are directly passed on to the
underlying lattice
functions
. Argument type
can be a
combination of any of the types allowed in lattice xyplots
, or
discrete
, in which case a smoothed average of the parameter against
time is plotted. binSize
controls the binning that is used for the
smoothing procedure.
signature(x = "formula", data = "flowFrame")
: Creates
scatter plots (a.k.a. dot plots) of a pair of FCM channels. Depending on the
setting of the smooth
argument, the data will be rendered as a
partially smoothed density estimate (smooth=TRUE
, the default) or as
a regular scatter plot with separate points for individual events. The
formula interface allows for fairly general plotting, however there are
certain limitations on the use of expressions as part of the formulae.
Unless you are sure about what you are doing, you should transform the raw
data in a separate step using one of the tools in the
flowCore
package rather than inline
using the formula interface. The method allows to superimpose gating results
though the filter
argument. If smooth=TRUE
, we try to add
spherical 2D representations of the gates if applicable. For
smooth=FALSE
, gates are indicated by a grouping mechanism using
different point shapes or colors (unless outline
is also TRUE
,
in which case the gate outlines are superimposed in addition to the
grouping). Argument margins
controls how events on the margins of the
measurement range are treated. The default (TRUE
) is to discard them
from any density estimation and later add them as separate glyphs. Argument par.settings
can be used
to supply lists of graphical parameters. See flowViz.par.set
for details on controlling graphical
parameters in these plots.
signature(x = "formula", data = "flowSet")
: Scatter
plots from a flowSet
object. We allow for conditioning on variables
in the phenoData
slot of the flowSet
. All additional arguments
that apply to the flowFrame
method are also valid for
flowSets
.
F. Hahne, D. Sarkar
Not all standard lattice arguments will have the intended effect, but many should. For a fuller description of possible arguments and their effects, consult documentation on lattice.
library(flowCore) data(GvHD) GvHD <- GvHD[pData(GvHD)$Patient %in% 5:6] ## a bivariate scatterplot ## by default ('smooth=TRUE') panel.smoothScatter is used xyplot(`FSC-H` ~ `SSC-H`, GvHD[["s5a05"]], nbin = 100, main="A single flowFrame") ## A non-smooth version of the same data xyplot(`FSC-H` ~ `SSC-H`, GvHD[["s5a05"]], nbin = 100, main="A single flowFrame", smooth=FALSE) ## A non-smooth version of the same data with customerized color scheme require(IDPmisc) colramp <- colorRampPalette(IDPcolorRamp(21)) xyplot(`FSC-H` ~ `SSC-H`, GvHD[["s5a05"]], nbin = 100, main="A single flowFrame", smooth=FALSE, colramp=colramp, pch=20, cex=0.1) ## A hexbin version of non-smooth scatter plot xyplot(`FSC-H` ~ `SSC-H`, GvHD[["s5a05"]], xbin = 128 ,main="A single flowFrame", smooth=FALSE) ## Visual artifacts created by the pileup of margin events xyplot(`FSC-H` ~ `SSC-H`, GvHD[["s5a05"]], nbin = 100, main="A single flowFrame", margin=FALSE) ## simple bivariate scatter plot (a.k.a. dot plot) ## for the whole flowSet, conditioning on Patient and ## Visit xyplot(`SSC-H` ~ `FSC-H` | Patient:Visit, data = GvHD) ## Same bivariate scatter plot with replacing default color require(IDPmisc) cols <- colorRampPalette(IDPcolorRamp(21)) xyplot(`SSC-H` ~ `FSC-H` | Patient:Visit, data = GvHD, colramp=cols) ## several examples with time on the X axis ## first for a flowFrame xyplot(GvHD[[1]]) ## and for flowSets xyplot(`FSC-H` ~ Time | Visit, GvHD, smooth = FALSE, type = "l", subset = (Patient == 5), xbin = 32) xyplot(`FSC-H` ~ Time | Patient+Visit, GvHD, smooth = FALSE, type = "a", strip = FALSE, strip.left = TRUE, aspect = "xy", xbin = 32) ## combine plots for two channels ssc.time <- xyplot(`SSC-H` ~ Time | factor(Patient):factor(Visit), GvHD, smooth = FALSE, type = "a", strip = FALSE, strip.left = strip.custom(horizontal = TRUE), par.strip.text = list(lines = 3), between = list(y = rep(c(0, 0.5), c(6, 1))), scales = list(x = list(axs = "i"), y = list(draw = FALSE)), layout = c(1, 14), xbin = 32) fsc.time <- xyplot(`FSC-H` ~ Time | factor(Patient):factor(Visit), GvHD, smooth = FALSE, type = "a", strip = FALSE, strip.left = strip.custom(horizontal = TRUE), par.strip.text = list(lines = 3), between = list(y = rep(c(0, 0.5), c(6, 1))), scales = list(x = list(axs = "i"), y = list(draw = FALSE)), layout = c(1, 14), xbin = 32) plot(fsc.time, split = c(1, 1, 2, 1)) plot(ssc.time, split = c(2, 1, 2, 1), newpage = FALSE) ## saving plots as variables allows more manipulation plot(update(fsc.time[8:14], layout = c(1, 7)), split = c(1, 1, 1, 2)) plot(update(ssc.time[8:14], layout = c(1, 7)), split = c(1, 2, 1, 2), newpage = FALSE) ## displaying filters library(flowStats) n2gate <- norm2Filter("SSC-H", "FSC-H") xyplot(`SSC-H` ~ `FSC-H` | Patient:Visit, data = GvHD, filter=n2gate, subset=Patient==5) xyplot(`SSC-H` ~ `FSC-H` | Patient:Visit, data=transform("SSC-H"=asinh,"FSC-H"=asinh) %on% GvHD, smooth=FALSE, filter=n2gate, subset=Patient == 5, xbin = 32) ## displaying filters with stats n2gate.results <- filter(GvHD, n2gate) xyplot(`SSC-H` ~ `FSC-H` | Visit, data=GvHD, subset=Patient == "6", filter=n2gate.results, smooth=FALSE, xbin = 32 ,stats=TRUE ,abs=TRUE ,digits=3 ) ## displaying multiple filters in one panel with stats recGate1<-rectangleGate("FL3-H"=c(2.3,4.1),"FL2-H"=c(6.8,9)) recGate2<-rectangleGate("FL3-H"=c(1,3),"FL2-H"=c(4,6)) filters1<-filters(list(recGate1,recGate2)) trans<-transform("FL2-H"=asinh,"FL3-H"=asinh) trans_data<-transform(GvHD[1:2],trans) #replicate filters object across samples flist <- list(filters1 , filters1) names(flist) <- sampleNames(trans_data) xyplot(`FL2-H` ~ `FL3-H` ,data=trans_data ,filter= flist ,stats=TRUE ,margin=FALSE , xbin = 32 , smooth = FALSE ) #display recGate2 as a overlay overlay <- Subset(trans_data,recGate1) xyplot(`FL2-H` ~ `FL3-H` ,data=trans_data ,filter=recGate2 ,stats=TRUE ,margin=FALSE , smooth = FALSE , xbin = 32 ,overlay= list(rect2 = overlay) ,par.settings = list(overlay.symbol = list(cex = 0.1)) )
library(flowCore) data(GvHD) GvHD <- GvHD[pData(GvHD)$Patient %in% 5:6] ## a bivariate scatterplot ## by default ('smooth=TRUE') panel.smoothScatter is used xyplot(`FSC-H` ~ `SSC-H`, GvHD[["s5a05"]], nbin = 100, main="A single flowFrame") ## A non-smooth version of the same data xyplot(`FSC-H` ~ `SSC-H`, GvHD[["s5a05"]], nbin = 100, main="A single flowFrame", smooth=FALSE) ## A non-smooth version of the same data with customerized color scheme require(IDPmisc) colramp <- colorRampPalette(IDPcolorRamp(21)) xyplot(`FSC-H` ~ `SSC-H`, GvHD[["s5a05"]], nbin = 100, main="A single flowFrame", smooth=FALSE, colramp=colramp, pch=20, cex=0.1) ## A hexbin version of non-smooth scatter plot xyplot(`FSC-H` ~ `SSC-H`, GvHD[["s5a05"]], xbin = 128 ,main="A single flowFrame", smooth=FALSE) ## Visual artifacts created by the pileup of margin events xyplot(`FSC-H` ~ `SSC-H`, GvHD[["s5a05"]], nbin = 100, main="A single flowFrame", margin=FALSE) ## simple bivariate scatter plot (a.k.a. dot plot) ## for the whole flowSet, conditioning on Patient and ## Visit xyplot(`SSC-H` ~ `FSC-H` | Patient:Visit, data = GvHD) ## Same bivariate scatter plot with replacing default color require(IDPmisc) cols <- colorRampPalette(IDPcolorRamp(21)) xyplot(`SSC-H` ~ `FSC-H` | Patient:Visit, data = GvHD, colramp=cols) ## several examples with time on the X axis ## first for a flowFrame xyplot(GvHD[[1]]) ## and for flowSets xyplot(`FSC-H` ~ Time | Visit, GvHD, smooth = FALSE, type = "l", subset = (Patient == 5), xbin = 32) xyplot(`FSC-H` ~ Time | Patient+Visit, GvHD, smooth = FALSE, type = "a", strip = FALSE, strip.left = TRUE, aspect = "xy", xbin = 32) ## combine plots for two channels ssc.time <- xyplot(`SSC-H` ~ Time | factor(Patient):factor(Visit), GvHD, smooth = FALSE, type = "a", strip = FALSE, strip.left = strip.custom(horizontal = TRUE), par.strip.text = list(lines = 3), between = list(y = rep(c(0, 0.5), c(6, 1))), scales = list(x = list(axs = "i"), y = list(draw = FALSE)), layout = c(1, 14), xbin = 32) fsc.time <- xyplot(`FSC-H` ~ Time | factor(Patient):factor(Visit), GvHD, smooth = FALSE, type = "a", strip = FALSE, strip.left = strip.custom(horizontal = TRUE), par.strip.text = list(lines = 3), between = list(y = rep(c(0, 0.5), c(6, 1))), scales = list(x = list(axs = "i"), y = list(draw = FALSE)), layout = c(1, 14), xbin = 32) plot(fsc.time, split = c(1, 1, 2, 1)) plot(ssc.time, split = c(2, 1, 2, 1), newpage = FALSE) ## saving plots as variables allows more manipulation plot(update(fsc.time[8:14], layout = c(1, 7)), split = c(1, 1, 1, 2)) plot(update(ssc.time[8:14], layout = c(1, 7)), split = c(1, 2, 1, 2), newpage = FALSE) ## displaying filters library(flowStats) n2gate <- norm2Filter("SSC-H", "FSC-H") xyplot(`SSC-H` ~ `FSC-H` | Patient:Visit, data = GvHD, filter=n2gate, subset=Patient==5) xyplot(`SSC-H` ~ `FSC-H` | Patient:Visit, data=transform("SSC-H"=asinh,"FSC-H"=asinh) %on% GvHD, smooth=FALSE, filter=n2gate, subset=Patient == 5, xbin = 32) ## displaying filters with stats n2gate.results <- filter(GvHD, n2gate) xyplot(`SSC-H` ~ `FSC-H` | Visit, data=GvHD, subset=Patient == "6", filter=n2gate.results, smooth=FALSE, xbin = 32 ,stats=TRUE ,abs=TRUE ,digits=3 ) ## displaying multiple filters in one panel with stats recGate1<-rectangleGate("FL3-H"=c(2.3,4.1),"FL2-H"=c(6.8,9)) recGate2<-rectangleGate("FL3-H"=c(1,3),"FL2-H"=c(4,6)) filters1<-filters(list(recGate1,recGate2)) trans<-transform("FL2-H"=asinh,"FL3-H"=asinh) trans_data<-transform(GvHD[1:2],trans) #replicate filters object across samples flist <- list(filters1 , filters1) names(flist) <- sampleNames(trans_data) xyplot(`FL2-H` ~ `FL3-H` ,data=trans_data ,filter= flist ,stats=TRUE ,margin=FALSE , xbin = 32 , smooth = FALSE ) #display recGate2 as a overlay overlay <- Subset(trans_data,recGate1) xyplot(`FL2-H` ~ `FL3-H` ,data=trans_data ,filter=recGate2 ,stats=TRUE ,margin=FALSE , smooth = FALSE , xbin = 32 ,overlay= list(rect2 = overlay) ,par.settings = list(overlay.symbol = list(cex = 0.1)) )