bioconductor v3.9.0 FlowCore
Provides S4 data structures and basic functions to deal with flow
Link to this section Summary
Functions
Class "EHtrans"
Computes a transform using the 'iplogicle' function
Extract of a Graft versus Host Disease monitoring experiment (Rizzieri et al., 2007)
Subset a flowFrame or a flowSet
Create the definition of an arcsinh transformation function (base specified by user) to be applied on a data set
Class asinhtGml2
Class "asinht"
Compute a transform using the 'biexponential' function
Class "boundaryFilter"
Class "characterOrNumeric"
Class "characterOrParameters"
Class "characterOrTransformation"
Fix the offset when its values recorded in header and TEXT don't agree
Convert an object to another class
Coerce the list of the keywords into a character Also flatten spillover matrix into a string
Class "compensatedParameter"
Class "compensation"
Class complementFilter
Class "concreteFilter"
Decompensate a flowFrame
Class "dg1polynomial"
Methods to apply functions over flowFrame margins
Class "ellipsoidGate"
Estimates a common logicle transformation for a flowSet.
Class "exponential"
Class "expressionFilter"
Obtain details about a filter operation
Class "filterList"
Class filterReference
Class "filterResultList"
Class "filterResult"
Class "filterSummaryList"
Class "filterSummary"
Take the intersection of two filters
A class for representing filtering operations to be applied to flow data.
Filter-specific membership methods
filter out $PnX keywords
Filter FCS files
Methods for Function %on% in Package flowCore' ## Description This operator is used to construct a
transformFilterthat first applies a
transformListto the data before applying the
filteroperation. You may also apply the operator to a
flowFrameor
flowSetto obtain transformed values specified in the list. ## Usage ```r e1 %on% e2 ``` ## Arguments |Argument |Description| |------------- |----------------| |
e1| a filter , transform , or transformList object| |
e2` | a transform , transformList , flowFrame , or flowSet object|
## Author
B. Ellis
## Examples
r samp <- read.FCS(system.file("extdata","0877408774.B08", package="flowCore")) plot(transform("FSC-H"=log, "SSC-H"=log) %on% samp) rectangle <- rectangleGate(filterId="rectangleGateI","FSC-H"=c(4.5, 5.5)) sampFiltered <- filter(samp, rectangle %on% transform("FSC-H"=log, "SSC-H"=log)) res <- Subset(samp, sampFiltered) plot(transform("FSC-H"=log, "SSC-H"=log) %on% res)
Class "filters" and "filtersList"
flowCore: Basic structures for flow cytometry data
'flowFrame': a class for storing observed quantitative properties for a population of cells from a FACS run
'flowSet': a class for storing flow cytometry raw data from quantitative cell-based assays
Append data columns to a flowFrame
Apply a Function over values in a flowSet
get channel and marker information from a flowFrame
that matches to the given keyword
Extract Index Sorted Data from an FCS File
Class "hyperlog"
Class hyperlogtGml2
Retrieve the GUID of flowCore objects
Class intersectFilter
Computes the inverse of the transform defined by the 'logicleTransform' function or the transformList generated by 'estimateLogicle' function
Class "invsplitscale"
Methods to retrieve keywords of a flowFrame
Class "kmeansFilter"
Create the definition of a linear transformation function to be applied on a data set
Class lintGml2
Create the definition of a ln transformation function (natural logarthim) to be applied on a data set
Create the definition of a log transformation function (base specified by user) to be applied on a data set
Class "logarithm"
Class "logicalFilterResult"
Computes a transform using the 'logicle_transform' function
Class logicletGml2
Class logtGml2
Class "manyFilterResult"
get or update the marker names
Class "multipleFilterResult"
Class "norm2Filter"
Class "normalization"
Class "nullParameter"
Class "parameterFilter"
Class "parameterTransform"
Class "parameters"
Obtain information about parameters for flow cytometry objects.
Class "polygonGate"
Define filter boundaries
Class "quadGate"
Create the definition of a quadratic transformation function to be applied on a data set
Class "quadratic"
Class "randomFilterResult"
Class "ratio"
Class "ratiotGml2"
Read an FCS file
Read the TEXT section of a FCS file
Read a set of FCS files
Class "rectangleGate"
Simplified geometric rotation of gates
Class "sampleFilter"
Create the definition of a scale transformation function to be applied on a data set
Simplified geometric scaling of gates
Class "setOperationFilter"
Simplified geometric translation of gates
Class "singleParameterTransform"
Class "sinht"
Compute a spillover matrix from a flowSet
Construct a flowSet
for use with spillover
by matching channel
names to compensation control filenames
Compute the split-scale transformation describe by FL. Battye
Methods to split flowFrames and flowSets according to filters
Class "splitscale"
Class "squareroot"
Class subsetFilter
Methods for function summarizeFilter
Class "timeFilter"
A class for encapsulating a filter to be performed on transformed parameters
Class "transformList"
A class for mapping transforms between parameters
Class "transformReference"
'transform': a class for transforming flow-cytometry data by applying scale factors.
Simplified geometric transformation of gates
Class "transformation"
Create the definition of a truncate transformation function to be applied on a data set
Class unionFilter
Class "unitytransform"
modify description to reflect the transformation Involve inserting/updating 'transformation' and flowCore_$PnRmax keywords
Check if all filters in a filters matches same paramters
Write an FCS file
Write an FCS file
Link to this section Functions
EHtrans_class()
Class "EHtrans"
Description
EH transformation of a parameter is defined by the function
$$EH(parameter,a,b)= 10^{(rac{parameter}{a})} +rac{b*parameter}{a}-1, parameter>=0$$
$$-10^{(rac{-parameter}{a})} + rac{b*parameter}{a}+1, parameter<0$$
Seealso
hyperlog
Other mathematical transform classes: asinht-class
,
asinhtGml2-class
,
dg1polynomial-class
,
exponential-class
,
hyperlog-class
,
hyperlogtGml2-class
,
invsplitscale-class
,
lintGml2-class
,
logarithm-class
,
logicletGml2-class
,
logtGml2-class
,
quadratic-class
, ratio-class
,
ratiotGml2-class
,
sinht-class
,
splitscale-class
,
squareroot-class
,
unitytransform-class
Note
The transformation object can be evaluated using the eval method by passing the data frame as an argument.The transformed parameters are returned as a matrix with a single column. (See example below)
Author
Gopalakrishnan N, F.Hahne
References
Gating-ML Candidate Recommendation for Gating Description in Flow Cytometry V 1.5
Examples
dat <- read.FCS(system.file("extdata","0877408774.B08",
package="flowCore"))
eh1<-EHtrans("FSC-H",a=1250,b=4,transformationId="eh1")
transOut<-eval(eh1)(exprs(dat))
FCSTransTransform()
Computes a transform using the 'iplogicle' function
Description
Transforms FCS data using the iplogicle function from FCSTrans by Quian et
al. The core functionality of FCSTrans has been imported to produce
transformed FCS data rescaled and truncated as produced by FCSTrans. The
w
parameter is estimated by iplogicle
automatically, then
makes a call to iplogicore
which in turn uses the logicle transform
code of Wayne Moore.
Usage
FCSTransTransform(transformationId = "defaultFCSTransTransform",
channelrange = 2^18, channeldecade = 4.5,
range = 4096, cutoff = -111, w = NULL, rescale = TRUE)
Arguments
Argument | Description |
---|---|
transformationId | A name to assign to the transformation. Used by the transform/filter routines. |
channelrange | is the range of the data. By default, 2^18 = 262144. |
channeldecade | is the number of logarithmic decades. By default, it is set to 4.5. |
range | the target resolution. The default value is 2^12 = 4096. |
cutoff | a threshold below which the logicle transformation maps values to 0. |
w | the logicle width. This is estimated by iplogicle by default. Details can be found in the Supplementary File from Quian et al. |
rescale | logical parameter whether or not the data should be rescaled to the number of channels specified in range . By default, the value is TRUE but can be set to FALSE if you want to work on the transformed scale. |
Details
For the details of the FCSTrans transformation, we recommend the excellent Supplementary File that accompanies Quian et al. (2012): http://onlinelibrary.wiley.com/doi/10.1002/cyto.a.22037/suppinfo
Seealso
inverseLogicleTransform
,
estimateLogicle
,
logicleTransform
Author
Wayne Moore, N Gopalakrishnan
References
Y Quian, Y Liu, J Campbell, E Thompson, YM Kong, RH Scheuermann; FCSTrans: An open source software system for FCS file conversion and data transformation. Cytometry A, 2012
Examples
data(GvHD)
samp <- GvHD[[1]]
## User defined logicle function
lgcl <- transformList(c('FL1-H', 'FL2-H'), FCSTransTransform())
after <- transform(samp, lgcl)
GvHD()
Extract of a Graft versus Host Disease monitoring experiment (Rizzieri et al., 2007)
Description
A flow cytometry high throughput screening was used to identify biomarkers that would predict the development of GvHD. The GvHD dataset is an extract of a collection of weekly peripheral blood samples obtained from patients following allogenic blood and marrow transplant. Samples were taken at various time points before and after graft.
Format
The format is an object of class flowSet
composed of 35
flowFrames
. Each flowFrame
corresponds to one sample at one
time point.
The phenodata
lists:
list("
", list(list("Patient"), list("The patient Id code ")), "
", list(list("Visit"), list("The number of visits to the hospital")), "
", list(list("Days"), list("The number of days since the graft. Negative values correpond to
", "days before the graft.")), "
", list(list("Grade"), list("Grade of the cancer")), "
")
Usage
data(GvHD)
Details
This GvHD dataset represents the measurements of one biomarker (leukocyte) for 5 patients over 7 visits (7 time points). The blood samples were labeled with four different fluorescent probes to identify the biomarker and the fluorescent intensity was determined for at least ten thousand cells per sample.
References
Rizzieri DA et al. J Clin Oncol. 2007 Jan 16; [Epub ahead of print] PMID: 17228020
Subset_methods()
Subset a flowFrame or a flowSet
Description
An equivalent of a subset
function for
flowFrame or a flowSet object.
Alternatively, the regular subsetting operators can be used for most of the
topics documented here.
Usage
Subset(x, subset, ...)
Arguments
Argument | Description |
---|---|
x | The flow object, frame or set, to subset. |
subset | A filter object or, in the case of flowSet subsetting, a named list of filters. |
list() | Like the original subset function, you can also select columns. |
Details
The Subset
method is the recommended method for obtaining a
flowFrame that only contains events consistent with a
particular filter. It is functionally equivalent to
frame[as(filter(frame,subset),"logical"),]
when used in the
flowFrame context. Used in the
flowSet context, it is equivalent to using
fsApply
to apply the filtering operation to each
flowFrame .
Additionally, using Subset
on a flowSet can also
take a named list
as the subset. In this case, the names of the list
object should correspond to the sampleNames
of the flowSet, allowing
a different filter to be applied to each frame. If not all of the names are
used or excess names are present, a warning will be generated but the valid
filters will be applied for the rare instances where this is the intended
operation. Note that a filter
operation will generate a list
of filterResult objects that can be used directly with
Subset
in this manner.
Value
Depending on the original context, either a flowFrame or a flowSet .
Seealso
Author
B. Ellis
Examples
sample <- read.flowSet(path=system.file("extdata", package="flowCore"),
pattern="0877408774")
result <- filter(sample, rectangleGate("FSC-H"=c(-Inf, 1024)))
result
Subset(sample,result)
arcsinhTransform()
Create the definition of an arcsinh transformation function (base specified by user) to be applied on a data set
Description
Create the definition of the arcsinh Transformation that will be applied on
some parameter via the transform
method. The definition of this
function is currently x<-asinh(a+b*x)+c). The transformation would normally
be used to convert to a linear valued parameter to the natural logarithm
scale. By default a and b are both equal to 1 and c to 0.
Usage
arcsinhTransform(transformationId="defaultArcsinhTransform", a=1, b=1, c=0)
Arguments
Argument | Description |
---|---|
transformationId | character string to identify the transformation |
a | positive double that corresponds to a shift about 0. |
b | positive double that corresponds to a scale factor. |
c | positive double |
Value
Returns an object of class transform
.
Seealso
transform-class
, transform
,
asinh
Other Transform functions: biexponentialTransform
,
inverseLogicleTransform
,
linearTransform
, lnTransform
,
logTransform
,
logicleTransform
,
quadraticTransform
,
scaleTransform
,
splitScaleTransform
,
truncateTransform
Author
B. Ellis
Examples
samp <- read.FCS(system.file("extdata",
"0877408774.B08", package="flowCore"))
asinhTrans <- arcsinhTransform(transformationId="ln-transformation", a=1, b=1, c=1)
translist <- transformList('FSC-H', asinhTrans)
dataTransform <- transform(samp, translist)
asinhtGml2_class()
Class asinhtGml2
Description
Inverse hyperbolic sin transformation as parameterized in Gating-ML 2.0.
Details
asinhtGml2 is defined by the following function:
$$bound(f, boundMin, boundMax) = max(min(f,boundMax),boundMin))$$ where
$$f(parameter, T, M, A) = (asinh(parameter sinh(M ln(10)) / T) +A ln(10)) / ((M + A) ln(10))$$
This transformation is equivalent to Logicle(T, 0, M, A) (i.e., with W=0). It provides an inverse hyperbolic sine transformation that maps a data value onto the interval [0,1] such that:
The top of scale value (i.e., T ) is mapped to 1.
Large data values are mapped to locations similar to an (M + A)-decade logarithmic scale.
A decades of negative data are brought on scale.
In addition, if a boundary is defined by the boundMin and/or boundMax parameters, then the result of this transformation is restricted to the [boundMin,boundMax] interval. Specifically, should the result of the f function be less than boundMin, then let the result of this transformation be boundMin. Analogically, should the result of the f function be more than boundMax, then let the result of this transformation be boundMax. The boundMin parameter shall not be greater than the boundMax parameter.
Seealso
asinht
, transform-class
,
transform
Other mathematical transform classes: EHtrans-class
,
asinht-class
,
dg1polynomial-class
,
exponential-class
,
hyperlog-class
,
hyperlogtGml2-class
,
invsplitscale-class
,
lintGml2-class
,
logarithm-class
,
logicletGml2-class
,
logtGml2-class
,
quadratic-class
, ratio-class
,
ratiotGml2-class
,
sinht-class
,
splitscale-class
,
squareroot-class
,
unitytransform-class
Note
The inverse hyperbolic sin transformation object can be evaluated using the eval method by passing the data frame as an argument. The transformed parameters are returned as a matrix with a single column. (See example below)
Author
Spidlen, J.
References
Gating-ML 2.0: International Society for Advancement of Cytometry (ISAC) standard for representing gating descriptions in flow cytometry. http://flowcyt.sourceforge.net/gating/20141009.pdf
Examples
myDataIn <- read.FCS(system.file("extdata", "0877408774.B08",
package="flowCore"))
myASinH1 <- asinhtGml2(parameters = "FSC-H", T = 1000, M = 4.5,
A = 0, transformationId="myASinH1")
transOut <- eval(myASinH1)(exprs(myDataIn))
asinht_class()
Class "asinht"
Description
Inverse hyperbolic sine transform class, which represents a transformation defined by the function:
$$f(parameter,a,b)=sinh^{-1}(aparameter)b$$
This definition is such that it can function as an inverse of sinht using the same definitions of the constants a and b.
Seealso
sinht
Other mathematical transform classes: EHtrans-class
,
asinhtGml2-class
,
dg1polynomial-class
,
exponential-class
,
hyperlog-class
,
hyperlogtGml2-class
,
invsplitscale-class
,
lintGml2-class
,
logarithm-class
,
logicletGml2-class
,
logtGml2-class
,
quadratic-class
, ratio-class
,
ratiotGml2-class
,
sinht-class
,
splitscale-class
,
squareroot-class
,
unitytransform-class
Note
The inverse hyperbolic sin transformation object can be evaluated using the eval method by passing the data frame as an argument.The transformed parameters are returned as a matrix with a single column. (See example below)
Author
Gopalakrishnan N, F.Hahne
References
Gating-ML Candidate Recommendation for Gating Description in Flow Cytometry V 1.5
Examples
dat <- read.FCS(system.file("extdata","0877408774.B08", package="flowCore"))
asinh1<-asinht(parameters="FSC-H",a=2,b=1,transformationId="asinH1")
transOut<-eval(asinh1)(exprs(dat))
biexponentialTransform()
Compute a transform using the 'biexponential' function
Description
The 'biexponential' is an over-parameterized inverse of the hyperbolic sine. The function to be inverted takes the form biexp(x) = aexp(b(x-w))-cexp(-d(x-w))+f with default parameters selected to correspond to the hyperbolic sine.
Usage
biexponentialTransform(transformationId="defaultBiexponentialTransform",
a = 0.5, b = 1, c = 0.5, d = 1, f = 0, w = 0,
tol = .Machine$double.eps^0.25, maxit = as.integer(5000))
Arguments
Argument | Description |
---|---|
transformationId | A name to assign to the transformation. Used by the transform/filter integration routines. |
a | See the function description above. Defaults to 0.5 |
b | See the function description above. Defaults to 1.0 |
c | See the function description above. Defaults to 0.5 (the same as a ) |
d | See the function description above. Defaults to 1 (the same as b ) |
f | A constant bias for the intercept. Defaults to 0. |
w | A constant bias for the 0 point of the data. Defaults to 0. |
tol | A tolerance to pass to the inversion routine ( uniroot usually) |
maxit | A maximum number of iterations to use, also passed to uniroot |
Value
Returns values giving the inverse of the biexponential within a
certain tolerance. This function should be used with care as numerical
inversion routines often have problems with the inversion process due to the
large range of values that are essentially 0. Do not be surprised if you end
up with population splitting about w
and other odd artifacts.
Seealso
Other Transform functions: arcsinhTransform
,
inverseLogicleTransform
,
linearTransform
, lnTransform
,
logTransform
,
logicleTransform
,
quadraticTransform
,
scaleTransform
,
splitScaleTransform
,
truncateTransform
Author
B. Ellis, N Gopalakrishnan
Examples
# Construct some "flow-like" data which tends to be hetereoscedastic.
data(GvHD)
biexp <- biexponentialTransform("myTransform")
after.1 <- transform(GvHD, transformList('FSC-H', biexp))
biexp <- biexponentialTransform("myTransform",w=10)
after.2 <- transform(GvHD, transformList('FSC-H', biexp))
opar = par(mfcol=c(3, 1))
plot(density(exprs(GvHD[[1]])[, 1]), main="Original")
plot(density(exprs(after.1[[1]])[, 1]), main="Standard Transform")
plot(density(exprs(after.2[[1]])[, 1]), main="Shifted Zero Point")
boundaryFilter_class()
Class "boundaryFilter"
Description
Class and constructor for data-driven filter
objects that
discard margin events.
Usage
boundaryFilter(x, tolerance=.Machine$double.eps, side=c("both", "lower",
"upper"), filterId="defaultBoundaryFilter")
Arguments
Argument | Description |
---|---|
x | Character giving the name(s) of the measurement parameter(s) on which the filter is supposed to work. Note that all events on the margins of ay of the channels provided by x will be discarded, which is often not desired. Such events may not convey much information in the particular channel on which their value falls on the margin, however they may well be informative in other channels. |
tolerance | Numeric vector, used to set the tolerance slot of the object. Can be set separately for each element in x . R's recycling rules apply. |
side | Character vector, used to set the side slot of the object. Can be set separately for each element in x . R's recycling rules apply. |
filterId | An optional parameter that sets the filterId slot of this filter. The object can later be identified by this name. |
Details
Flow cytomtery instruments usually operate on a given data range, and the
limits of this range are stored as keywords in the FSC files. Depending on
the amplification settings and the dynamic range of the measured signal,
values can occur that are outside of the measurement range, and most
instruments will simply pile those values at the minimum or maximum range
limit. The boundaryFilter
removes these values, either for a single
parameter, or for a combination of parameters. Note that it is often
desirable to treat boundary events on a per-parameter basis, since their
values might be uninformative for one particular channel, but still be
useful in all of the other channels.
The constructor boundaryFilter
is a convenience function for object
instantiation. Evaluating a boundaryFilter
results in a single
sub-populations, an hence in an object of class filterResult
.
Value
Returns a boundaryFilter
object for use in filtering
flowFrame
s or other flow cytometry objects.
Seealso
flowFrame
, flowSet
,
filter
for evaluation of
boundaryFilters
and Subset
for subsetting of flow
cytometry data sets based on that.
Author
Florian Hahne
Examples
## Loading example data
dat <- read.FCS(system.file("extdata","0877408774.B08",
package="flowCore"))
## Create directly. Most likely from a command line
boundaryFilter("FSC-H", filterId="myBoundaryFilter")
## To facilitate programmatic construction we also have the following
bf <- boundaryFilter(filterId="myBoundaryFilter", x=c("FSC-H"))
## Filtering using boundaryFilter
fres <- filter(dat, bf)
fres
summary(fres)
## We can subset the data with the result from the filtering operation.
Subset(dat, fres)
## A boundaryFilter on the lower margins of several channels
bf2 <- boundaryFilter(x=c("FSC-H", "SSC-H"), side="lower")
characterOrNumeric_class()
Class "characterOrNumeric"
Description
A simple union class of character
and numeric
.
Objects will be created internally whenever necessary and the user should
not need to explicitly interact with this class.
Examples
showClass("characterOrNumeric")
characterOrParameters_class()
Class "characterOrParameters"
Description
A simple union class of character
and parameters .
Objects will be created internally whenever necessary and the user should
not need to explicitly interact with this class.
Examples
showClass("characterOrParameters")
characterOrTransformation_class()
Class "characterOrTransformation"
Description
A simple union class of character
and transformation .
Objects will be created internally whenever necessary and the user should
not need to explicitly interact with this class.
Examples
showClass("characterOrTransformation")
checkOffset()
Fix the offset when its values recorded in header and TEXT don't agree
Description
Fix the offset when its values recorded in header and TEXT don't agree
Usage
checkOffset(offsets, x, ignore.text.offset = FALSE, ...)
Arguments
Argument | Description |
---|---|
offsets | the named vector returned by findOffsets |
x | the text segmented returned by readFCStext |
ignore.text.offset | whether to ignore the offset info stored in TEXT segment |
... | not used. |
Value
the updated offsets
coerce()
Convert an object to another class
Description
These functions manage the relations that allow coercing an object to a given class.
Arguments
Argument | Description |
---|---|
from, to | The classes between which def performs coercion. (In the case of the coerce function, these are objects from the classes, not the names of the classes, but you're not expected to call coerce directly.) |
Details
The function supplied as the third argument is to be called to implement
as(x, to)
when x
has class from
. Need we add that the
function should return a suitable object with class to
.
Author
F. Hahne, B. Ellis
Examples
samp1 <- read.FCS(system.file("extdata","0877408774.E07", package="flowCore"))
samp2 <- read.FCS(system.file("extdata","0877408774.B08",package="flowCore"))
samples <-list("sample1"=samp1,"sample2"=samp2)
experiment <- as(samples,"flowSet")
collapse_desc()
Coerce the list of the keywords into a character Also flatten spillover matrix into a string
Description
Coerce the list of the keywords into a character Also flatten spillover matrix into a string
Usage
collapse_desc(d, collapse.spill = TRUE)
Arguments
Argument | Description |
---|---|
d | a named list of keywords |
collapse.spill | whether to flatten spillover matrix to a string |
Value
a list of strings
Examples
data(GvHD)
fr <- GvHD[[1]]
collapse_desc(keyword(fr))
compensatedParameter_class()
Class "compensatedParameter"
Description
Emission spectral overlap can be corrected by subtracting the amount of spectral overlap from the total detected signals. This compensation process can be described by using spillover matrices.
Details
The compensatedParameter class allows for compensation of specific parameters the user is interested in by creating compensatedParameter objects and evaluating them. This allows for use of compensatedParameter in gate definitions.
Seealso
compensation
Note
The transformation object can be evaluated using the eval method by passing the data frame as an argument. The transformed parameters are returned as a matrix with a single column. (See example below)
Author
Gopalakrishnan N,F.Hahne
Examples
samp <- read.flowSet(path=system.file("extdata", "compdata", "data", package="flowCore"))
cfile <- system.file("extdata","compdata","compmatrix", package="flowCore")
comp.mat <- read.table(cfile, header=TRUE, skip=2, check.names = FALSE)
comp.mat
## create a compensation object
comp <- compensation(comp.mat,compensationId="comp1")
## create a compensated parameter object
cPar1<-compensatedParameter(c("FL1-H","FL3-H"),"comp",searchEnv=.GlobalEnv)
compOut<-eval(cPar1)(exprs(samp[[1]]))
compensation_class()
Class "compensation"
Description
Class and methods to compensate for spillover between channels by applying a
spillover matrix to a flowSet
or a flowFrame
assuming a simple
linear combination of values.
Usage
compensation(list(), spillover, compensationId="defaultCompensation")
compensate(x, spillover, list())
Arguments
Argument | Description |
---|---|
spillover | The spillover or compensation matrix. |
compensationId | The identifier for the compensation object. |
x | An object of class flowFrame or flowSet . |
list() | Further arguments. The constructor is designed to be useful in both programmatic and interactive settings, and list() list() serves as a container for possible arguments. The following combinations of values are allowed: Elements in list() list() are character scalars of parameter names or list("transform") objects and the colnames in spillover match to these parameter names. The first element in list() list() is a character vector of parameter names or a list of character scalars or list("transform") objects and the colnames in spillover match to these parameter names. Argument spillover is missing and the first element in list() list() is a matrix , in which case it is assumed to be the spillover matrix. list() list() is missing, in which case all parameter names are taken from the colnames of spillover . |
Details
The essential premise of compensation is that some fluorochromes may register signals in detectors that do not correspond to their primary detector (usually a photomultiplier tube). To compensate for this fact, some sort of standard is used to obtain the background signal (no dye) and the amount of signal on secondary channels for each fluorochrome relative to the signal on their primary channel.
To calculate the spillover percentage we use either the mean or the median
(more often the latter) of the secondary signal minus the background signal
for each dye to obtain n
by n
matrix, S
, of so-called
spillover values, expressed as a percentage of the primary channel. The
observed values are then considered to be a linear combination of the true
fluorescence and the spillover from each other channel so we can obtain the
true values by simply multiplying by the inverse of the spillover matrix.
The spillover matrix can be obtained through several means. Some flow
cytometers provide a spillover matrix calculated during acquisition,
possibly by the operator, that is made available in the metadata of the
flowFrame. While there is a theoretical standard keyword $SPILL
it
can also be found in the SPILLOVER
or SPILL
keyword depending
on the cytometry. More commonly the spillover matrix is calculated using a
series of compensation cells or beads collected before the experiment. If
you have set of FCS files with one file per fluorochrome as well as an
unstained FCS file you can use the
spillover
method for
flowSets
to automatically calculate a
spillover matrix.
The compensation
class is essentially a wrapper around a
matrix
that allows for transformed parameters and method dispatch.
Value
A compensation
object for the constructor.
A flowFrame or flowSet for the
compensate
methods.
Seealso
Author
F.Hahne, B. Ellis, N. Le Meur
Examples
## Read sample data and a sample spillover matrix
samp <- read.flowSet(path=system.file("extdata", "compdata", "data",
package="flowCore"))
cfile <- system.file("extdata","compdata","compmatrix", package="flowCore")
comp.mat <- read.table(cfile, header=TRUE, skip=2, check.names = FALSE)
comp.mat
## compensate using the spillover matrix directly
summary(samp)
samp <- compensate(samp, comp.mat)
summary(samp)
## create a compensation object and compensate using that
comp <- compensation(comp.mat)
compensate(samp, comp)
## demo the sample-specific compensation
## create a list of comps (each element could be a
## different compensation tailored for the specific sample)
comps <- sapply(sampleNames(samp), function(sn)comp, simplify = FALSE)
# the names of comps must be matched to sample names of the flowset
compensate(samp, comps)
complementFilter_class()
Class complementFilter
Description
This class represents the logical complement of a single filter, which is
itself a filter that can be incorporated in to further set operations.
complementFilter
s are constructed using the prefix unary set operator
"!"
with a single filter operand.
Seealso
filter
, setOperationFilter
Other setOperationFilter classes: intersectFilter-class
,
setOperationFilter-class
,
subsetFilter-class
,
unionFilter-class
Author
B. Ellis
concreteFilter_class()
Class "concreteFilter"
Description
The concreteFilter
serves as a base class for all filters that
actually implement a filtering process. At the moment this includes all
filters except filterReference , the only non-concrete
filter at present.
Seealso
parameterFilter
Author
B. Ellis
decompensate_methods()
Decompensate a flowFrame
Description
Reverse the application of a compensation matrix on a flowFrame
Usage
list(list("decompensate"), list("flowFrame,matrix"))(x, spillover)
list(list("decompensate"), list("flowFrame,data.frame"))(x, spillover)
Arguments
Argument | Description |
---|---|
x | flowFrame. |
spillover | matrix or data.frame. |
Value
a decompensated flowFrame
Examples
library(flowCore)
f = list.files(system.file("extdata",
"compdata",
"data",
package="flowCore"),
full.name=TRUE)[1]
f = read.FCS(f)
spill = read.csv(system.file("extdata",
"compdata", "compmatrix",
package="flowCore"),
,sep=" ",skip=2)
colnames(spill) = gsub("\.","-",colnames(spill))
f.comp = compensate(f,spill)
f.decomp = decompensate(f.comp,as.matrix(spill))
sum(abs(f@exprs-f.decomp@exprs))
all.equal(decompensate(f.comp,spill)@exprs,decompensate(f.comp,as.matrix(spill))@exprs)
all.equal(f@exprs,decompensate(f.comp,spill)@exprs)
dg1polynomial_class()
Class "dg1polynomial"
Description
dg1polynomial allows for scaling,linear combination and translation within a single transformation defined by the function
$$f(parameter1,...,parameter_n,a_1,...,a_n,b) = b + Sigma{i=1}^na_i*parameter_i$$
Seealso
ratio,quadratic,squareroot
Other mathematical transform classes: EHtrans-class
,
asinht-class
,
asinhtGml2-class
,
exponential-class
,
hyperlog-class
,
hyperlogtGml2-class
,
invsplitscale-class
,
lintGml2-class
,
logarithm-class
,
logicletGml2-class
,
logtGml2-class
,
quadratic-class
, ratio-class
,
ratiotGml2-class
,
sinht-class
,
splitscale-class
,
squareroot-class
,
unitytransform-class
Note
The transformation object can be evaluated using the eval method by passing the data frame as an argument.The transformed parameters are returned as a matrix with a single column.(See example below)
Author
Gopalakrishnan N, F.Hahne
References
Gating-ML Candidate Recommendation for Gating Description in Flow Cytometry V 1.5
Examples
dat <- read.FCS(system.file("extdata","0877408774.B08",
package="flowCore"))
dg1<-dg1polynomial(c("FSC-H","SSC-H"),a=c(1,2),b=1,transformationId="dg1")
transOut<-eval(dg1)(exprs(dat))
each_col()
Methods to apply functions over flowFrame margins
Description
Returns a vector or array of values obtained by applying a function to the
margins of a flowFrame. This is equivalent of running apply
on
the output of exprs(flowFrame)
.
Usage
each_col(x, FUN, ...)
each_row(x, FUN, ...)
Arguments
Argument | Description |
---|---|
x | Object of class flowFrame . |
FUN | the function to be applied. In the case of functions like '+', '%*%', etc., the function name must be backquoted or quoted. |
... | optional arguments to 'FUN'. |
Seealso
Author
B. Ellis, N. LeMeur, F. Hahne
Examples
samp <- read.FCS(system.file("extdata", "0877408774.B08", package="flowCore"),
transformation="linearize")
each_col(samp, summary)
ellipsoidGate_class()
Class "ellipsoidGate"
Description
Class and constructor for n-dimensional ellipsoidal filter
objects.
Usage
ellipsoidGate(list(), .gate, mean, distance=1, filterId="defaultEllipsoidGate")
Arguments
Argument | Description |
---|---|
filterId | An optional parameter that sets the filterId of this gate. |
.gate | A definition of the gate via a covariance matrix. |
mean | Numeric vector of equal length as dimensions in .gate . |
distance | Numeric scalar giving the Mahalanobis distance defining the size of the ellipse. This mostly exists for compliance reasons to the gatingML standard as mean and gate should already uniquely define the ellipse. Essentially, distance is merely a factor that gets applied to the values in the covariance matrix. |
list() | You can also directly describe the covariance matrix through named arguments, as described below. |
Details
A convenience method to facilitate the construction of a ellipsoid
filter
objects. Ellipsoid gates in n dimensions (n >= 2) are
specified by a a covarinace matrix and a vector of mean values giving the
center of the ellipse.
This function is designed to be useful in both direct and programmatic usage. In the first case, simply describe the covariance matrix through named arguments. To use this function programmatically, you may pass a covarince matrix and a mean vector directly, in which case the parameter names are the colnames of the matrix.
Value
Returns a ellipsoidGate
object for use in filtering
flowFrame
s or other flow cytometry objects.
Seealso
flowFrame
, polygonGate
,
rectangleGate
, polytopeGate
,
filter
for evaluation of rectangleGates
and
split
and Subset
for splitting and subsetting of
flow cytometry data sets based on that.
Other Gate classes: polygonGate-class
,
polytopeGate-class
,
quadGate-class
,
rectangleGate-class
Note
See the documentation in the flowViz
package for plotting of ellipsoidGates
.
Author
F.Hahne, B. Ellis, N. LeMeur
Examples
## Loading example data
dat <- read.FCS(system.file("extdata","0877408774.B08",
package="flowCore"))
## Defining the gate
cov <- matrix(c(6879, 3612, 3612, 5215), ncol=2,
dimnames=list(c("FSC-H", "SSC-H"), c("FSC-H", "SSC-H")))
mean <- c("FSC-H"=430, "SSC-H"=175)
eg <- ellipsoidGate(filterId= "myEllipsoidGate", .gate=cov, mean=mean)
## Filtering using ellipsoidGates
fres <- filter(dat, eg)
fres
summary(fres)
## The result of ellipsoid filtering is a logical subset
Subset(dat, fres)
## We can also split, in which case we get those events in and those
## not in the gate as separate populations
split(dat, fres)
##ellipsoidGate can be converted to polygonGate by interpolation
pg <- as(eg, "polygonGate")
pg
estimateMedianLogicle()
Estimates a common logicle transformation for a flowSet.
Description
Of the negative values for each channel specified, the median of the specified quantiles are used.
Usage
estimateMedianLogicle(flow_set, channels, m = 4.5, q = 0.05)
Arguments
Argument | Description |
---|---|
flow_set | object of class 'flowSet' |
channels | character vector of channels to transform |
m | TODO -- default value from .lgclTrans |
q | quantile |
Value
TODO
exponential_class()
Class "exponential"
Description
Exponential transform class, which represents a transformation given by the function $$f(parameter,a,b)=e^{parameter/b}*rac{1}{a}$$
Seealso
logarithm
Other mathematical transform classes: EHtrans-class
,
asinht-class
,
asinhtGml2-class
,
dg1polynomial-class
,
hyperlog-class
,
hyperlogtGml2-class
,
invsplitscale-class
,
lintGml2-class
,
logarithm-class
,
logicletGml2-class
,
logtGml2-class
,
quadratic-class
, ratio-class
,
ratiotGml2-class
,
sinht-class
,
splitscale-class
,
squareroot-class
,
unitytransform-class
Note
The exponential transformation object can be evaluated using the eval method by passing the data frame as an argument.The transformed parameters are returned as a matrix with a single column
Author
Gopalakrishnan N, F.Hahne
References
Gating-ML Candidate Recommendation for Gating Description in Flow Cytometry V 1.5
Examples
dat <- read.FCS(system.file("extdata","0877408774.B08",
package="flowCore"))
exp1<-exponential(parameters="FSC-H",a=1,b=37,transformationId="exp1")
transOut<-eval(exp1)(exprs(dat))
expressionFilter_class()
Class "expressionFilter"
Description
A filter
holding an expression that can be evaluated to a
logical vector or a vector of factors.
Usage
expressionFilter(expr, ..., filterId="defaultExpressionFilter")
char2ExpressionFilter(expr, ..., filterId="defaultExpressionFilter")
Arguments
Argument | Description |
---|---|
filterId | An optional parameter that sets the filterId of this filter . The object can later be identified by this name. |
expr | A valid R expression or a character vector that can be parsed into an expression. |
list() | Additional arguments that are passed to the evaluation environment of the expression. |
Details
The expression is evaluated in the environment of the flow cytometry values,
hence the parameters of a flowFrame
can be accessed through
regular R symbols. The convenience function char2ExpressionFilter
exists to programmatically construct expressions.
Value
Returns a expressionFilter
object for use in filtering
flowFrame
s or other flow cytometry objects.
Seealso
flowFrame
, filter
for evaluation of
sampleFilters
and split
and Subset
for
splitting and subsetting of flow cytometry data sets based on that.
Author
F. Hahne, B. Ellis
Examples
## Loading example data
dat <- read.FCS(system.file("extdata","0877408774.B08",
package="flowCore"))
#Create the filter
ef <- expressionFilter(`FSC-H` > 200, filterId="myExpressionFilter")
ef
## Filtering using sampeFilters
fres <- filter(dat, ef)
fres
summary(fres)
## The result of sample filtering is a logical subset
newDat <- Subset(dat, fres)
all(exprs(newDat)[,"FSC-H"] > 200)
## We can also split, in which case we get those events in and those
## not in the gate as separate populations
split(dat, fres)
## Programmatically construct an expression
dat <- dat[,-8]
r <- range(dat)
cn <- paste("`", colnames(dat), "`", sep="")
exp <- paste(cn, ">", r[1,], "&", cn, "<", r[2,], collapse=" & ")
ef2 <- char2ExpressionFilter(exp, filterId="myExpressionFilter")
ef2
fres2 <- filter(dat, ef2)
fres2
summary(fres2)
filterDetails_methods()
Obtain details about a filter operation
Description
A filtering operation captures details about its metadata and stores it in a
filterDetails
slot in a filterResult object
that is accessed using the filterDetails
method. Each set of metadata
is indexed by the filterId
of the filter allowing for all the metadata
in a complex filtering operation to be recovered after the final filtering.
Author
B. Ellis, P.D. Haaland and N. LeMeur
filterList_class()
Class "filterList"
Description
Container for a list of filter
objects. The class mainly exists for method dispatch.
Usage
filterList(x, filterId=identifier(x[[1]]))
Arguments
Argument | Description |
---|---|
x | A list of filter objects. |
filterId | The global identifier of the filter list. As default, we take the filterId of the first filter object in x . |
Value
A filterList
object for the constructor.
Seealso
filter
,
Author
Florian Hahne
Examples
f1 <- rectangleGate(FSC=c(100,200), filterId="testFilter")
f2 <- rectangleGate(FSC=c(200,400))
fl <- filterList(list(a=f1, b=f2))
fl
identifier(fl)
filterReference_class()
Class filterReference
Description
A reference to another filter inside a reference. Users should generally not be aware that they are using this class.
Author
B. Ellis
filterResultList_class()
Class "filterResultList"
Description
Container to store the result of applying a filter
on a
flowSet
object
Seealso
filter , filterResult , logicalFilterResult , multipleFilterResult , randomFilterResult
Author
Florian Hahne
Examples
library(flowStats)
## Loading example data and creating a curv1Filter
data(GvHD)
dat <- GvHD[1:3]
c1f <- curv1Filter(filterId="myCurv1Filter", x=list("FSC-H"), bwFac=2)
## applying the filter
fres <- filter(dat, c1f)
fres
## subsetting the list
fres[[1]]
fres[1:2]
## details about the object
parameters(fres)
names(fres)
summary(fres)
## splitting based on the filterResults
split(dat, fres)
filterResult_class()
Class "filterResult"
Description
Container to store the result of applying a filter
on a
flowFrame
object
Seealso
filter
,
"
,
"
,
"
Author
B. Ellis, N. LeMeur
Examples
showClass("filterResult")
filterSummaryList_class()
Class "filterSummaryList"
Description
Class and methods to handle summary statistics for from filtering operations
on whole flowSets
.
Arguments
Argument | Description |
---|---|
object | An object of class. filterResultList which is to be summarized. |
list() | Further arguments that are passed to the generic. |
Details
Calling summary
on a filterResultList
object prints summary
information on the screen, but also creates objects of class
filterSummaryList
for computational access.
Value
An object of class filterSummaryList
.
Seealso
filterResult , filterResultList , logicalFilterResult , multipleFilterResult , flowFrame filterSummary
Author
Florian Hahne
Examples
library(flowStats)
## Loading example data, creating and applying a curv1Filter
data(GvHD)
dat <- GvHD[1:3]
c1f <- curv1Filter(filterId="myCurv1Filter", x=list("FSC-H"), bwFac=2)
fres <- filter(dat, c1f)
## creating and showing the summary
summary(fres)
s <- summary(fres)
## subsetting
s[[1]]
##accessing details
toTable(s)
filterSummary_class()
Class "filterSummary"
Description
Class and methods to handle the summary information of a gating operation.
Usage
list(list("summary"), list("filterResult"))(object, list())
Arguments
Argument | Description |
---|---|
object | An object inheriting from class filterResult which is to be summarized. |
list() | Further arguments that are passed to the generic. |
Details
Calling summary
on a filterResult
object prints summary
information on the screen, but also creates objects of class
filterSummary
for computational access.
Value
An object of class filterSummary
for the summary
constructor,
a named list for the subsetting operators. The $
operator returns a
named vector of the respective value, where each named element corresponds
to one sub-population.
Seealso
filterResult , logicalFilterResult , multipleFilterResult , flowFrame filterSummaryList
Author
Florian Hahne, Byron Ellis
Examples
library(flowStats)
## Loading example data, creating and applying a curv1Filter
dat <- read.FCS(system.file("extdata","0877408774.B08",
package="flowCore"))
c1f <- curv1Filter(filterId="myCurv1Filter", x=list("FSC-H"), bwFac=2)
fres <- filter(dat, c1f)
## creating and showing the summary
summary(fres)
s <- summary(fres)
## subsetting
s[[1]]
s[["peak 2"]]
##accessing details
s$true
s$n
toTable(s)
filter_and_methods()
Take the intersection of two filters
Description
There are two notions of intersection in flowCore
. First, there is
the usual intersection boolean operator &
that has been overridden to
allow the intersection of two filters or of a filter and a list for
convenience. There is also the %&%
or %subset%
operator that
takes an intersection, but with subset semantics rather than simple
intersection semantics. In other words, when taking a subset, calculations
from summary
and other methods
are taken with respect to the right hand filter. This primarily affects
calculations, which are ordinarily calculated with respect to the entire
population as well as data-driven gating procedures which will operate only
on elements contained by the right hand filter. This becomes especially
important when using filters such as
norm2Filter
Usage
e1 %&% e2
e1 %subset% e2
Arguments
Argument | Description |
---|---|
e1, e2 | filter objects or lists of filter objects |
Author
B. Ellis
filter_class()
A class for representing filtering operations to be applied to flow data.
Description
The filter
class is the virtual base class for all filter/gating
objects in flowCore
. In general you will want to subclass or create a
more specific filter.
Seealso
Author
B. Ellis, P.D. Haaland and N. LeMeur
filter_in_methods()
Filter-specific membership methods
Description
Membership methods must be defined for every object of type filter
with respect to a flowFrame
object. The operation is considered to
be general and may return a logical
, numeric
or factor
vector that will be handled appropriately. The ability to handle logical
matrices as well as vectors is also planned but not yet implemented.
Usage
x %in% table
Arguments
Argument | Description |
---|---|
x | a flowFrame |
table | an object of type filter or filterResult or one of their derived classes, representing a gate, filter, or result to check for the membership of x |
Value
Vector of type logical
, numeric
or factor
depending on the arguments
Author
F.Hahne, B. Ellis
filter_keywords()
filter out $PnX keywords
Description
filter out $PnX keywords
Usage
filter_keywords(kw, par.id)
Arguments
Argument | Description |
---|---|
kw | a named list of keywords |
par.id | a vector of integer specifies the parameter ids to be perserved |
Value
a filtered list
Examples
data(GvHD)
fr <- GvHD[[1]]
kw <- description(fr)
kw <- filter_keywords(kw, c(1,3,5))
filter_methods()
Filter FCS files
Description
These methods link filter descriptions to a particular set of flow cytometry data allowing for the lightweight calculation of summary statistics common to flow cytometry analysis.
Usage
filter(x, filter, method = c("convolution", "recursive"),
sides = 2L, circular = FALSE, init = NULL)
Arguments
Argument | Description |
---|---|
x | Object of class flowFrame or flowSet . |
filter | An object of class filter or a named list filters . |
method, sides, circular, init | These arguments are not used. |
Details
The filter
method conceptually links a filter description,
represented by a filter object, to a particular
flowFrame . This is accomplished via the
filterResult object, which tracks the linked frame as
well as caching the results of the filtering operation itself, allowing for
fast calculation of certain summary statistics such as the percentage of
events accepted by the filter
. This method exists chiefly to allow
the calculation of these statistics without the need to first
Subset
a flowFrame , which can be quite
large.
When applying on a flowSet
, the filter
argument can either be
a single filter
object, in which case it is recycled for all frames
in the set, or a named list of filter
objects. The names are supposed
to match the frame identifiers (i.e., the output of sampleNames(x)
of
the flowSet
. If some frames identifiers are missing, the particular
frames are skipped during filtering. Accordingly, all filters
in the
filter list that can't be mapped to the flowSet
are ignored. Note
that all filter
objects in the list must be of the same type, e.g.
rectangleGates
.
Value
A filterResult object or a
filterResultList object if x
is a
flowSet . Note that filterResult
objects are themselves filters, allowing them to be used in filter
expressions or Subset
operations.
Seealso
Subset
, filter , filterResult
Author
F Hahne, B. Ellis, N. Le Meur
Examples
## Filtering a flowFrame
samp <- read.FCS(system.file("extdata","0877408774.B08", package="flowCore"))
rectGate <- rectangleGate(filterId="nonDebris","FSC-H"=c(200,Inf))
fr <- filter(samp,rectGate)
class(fr)
summary(fr)
## filtering a flowSet
data(GvHD)
foo <- GvHD[1:3]
fr2 <- filter(foo, rectGate)
class(fr2)
summary(fr2)
## filtering a flowSet using different filters for each frame
rg2 <- rectangleGate(filterId="nonDebris","FSC-H"=c(300,Inf))
rg3 <- rectangleGate(filterId="nonDebris","FSC-H"=c(400,Inf))
flist <- list(rectGate, rg2, rg3)
names(flist) <- sampleNames(foo)
fr3 <- filter(foo, flist)
filter_on_methods()
Methods for Function %on% in Package flowCore' ## Description This operator is used to construct a
transformFilterthat first applies a
transformListto the data before applying the
filteroperation. You may also apply the operator to a
flowFrameor
flowSetto obtain transformed values specified in the list. ## Usage ```r e1 %on% e2 ``` ## Arguments |Argument |Description| |------------- |----------------| |
e1| a filter , transform , or transformList object| |
e2` | a transform , transformList , flowFrame , or flowSet object|
## Author
B. Ellis
## Examples
r samp <- read.FCS(system.file("extdata","0877408774.B08", package="flowCore")) plot(transform("FSC-H"=log, "SSC-H"=log) %on% samp) rectangle <- rectangleGate(filterId="rectangleGateI","FSC-H"=c(4.5, 5.5)) sampFiltered <- filter(samp, rectangle %on% transform("FSC-H"=log, "SSC-H"=log)) res <- Subset(samp, sampFiltered) plot(transform("FSC-H"=log, "SSC-H"=log) %on% res)
filters_class()
Class "filters" and "filtersList"
Description
The filters
class is the container for a list of
filter
objects. list() list()
The filtersList
class is the container for a list of filters
objects.
Usage
filters(x)
filtersList(x)
Arguments
Argument | Description |
---|---|
x | A list of filter or filters objects. |
Details
The filters
class mainly
exists for displaying multiple filters/gates on one single panel(flowFrame)
of xyplot
. Note that it is different from
filterList
class which is to be applied to
a flowSet. In other words, filter
objects of a fliterList
are
to be applied to different flowFrames. However,all of filter
objects
of a filters
object are for one single flowFrame, more specifically for one
pair of projections(parameters).So these filters should share the common
parameters. list() list()
And filtersList
is a list of filters
objects, which are to be
applied to a flowSet.
Value
A filters
or filtersList
object from the constructor
Seealso
Author
Mike Jiang
flowCore_package()
flowCore: Basic structures for flow cytometry data
Description
Provides S4 data structures and basic infrastructure and functions to deal with flow cytometry data.
Details
Define important flow cytometry data classes:
flowFrame
,
flowSet
and their accessors.
Provide important transformation, filter, gating, workflow, and summary functions for flow cytometry data analysis.
Most of flow cytometry related Bioconductor packages (such as flowStats, flowFP, flowQ, flowViz, flowMerge, flowClust) are heavily dependent on this package.
list(list("ll"), list(" Package: ", list(), " flowCore ", list(), " Type: ", list(), " Package ", list(), " Version: ", list(), " 1.11.20 ", list(), " Date: ", list(), " 2009-09-16 ", list(), " License: ", list(), " Artistic-2.0", list(), " "))
Author
Maintainer: Florian Hahne fhahne@fhcrc.org
Authors: B. Ellis, P. Haaland, F. Hahne, N. Le Meur, N. Gopalakrishnan
flowFrame_class()
'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.
Seealso
flowSet , read.FCS
Author
F. Hahne, B. Ellis, P. Haaland and N. Le Meur
Examples
## 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"
## range of a frame
range(frame) #instrument range
range(frame, type = "data") #actual data range
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
flowSet_class()
'flowSet': a class for storing flow cytometry raw data from quantitative cell-based assays
Description
This class is a container for a set of flowFrame objects
Seealso
flowFrame , read.flowSet
Author
F. Hahne, B. Ellis, P. Haaland and N. Le Meur
Examples
## load example data and object creation
data(GvHD)
## subsetting to flowSet
set <- GvHD[1:4]
GvHD[1:4,1:2]
sel <- sampleNames(GvHD)[1:2]
GvHD[sel, "FSC-H"]
GvHD[sampleNames(GvHD) == sel[1], colnames(GvHD[1]) == "SSC-H"]
## subsetting to flowFrame
GvHD[[1]]
GvHD[[1, 1:3]]
GvHD[[1, "FSC-H"]]
GvHD[[1, colnames(GvHD[1]) == "SSC-H"]]
GvHD$s5a02
## constructor
flowSet(GvHD[[1]], GvHD[[2]])
pd <- phenoData(GvHD)[1:2,]
flowSet(s5a01=GvHD[[1]], s5a02=GvHD[[2]],phenoData=pd)
## colnames
colnames(set)
colnames(set) <- make.names(colnames(set))
## object name
identifier(set)
identifier(set) <- "test"
## phenoData
pd <- phenoData(set)
pd
pd$test <- "test"
phenoData(set) <- pd
pData(set)
varLabels(set)
varLabels(set)[6] <- "Foo"
varLabels(set)
## sampleNames
sampleNames(set)
sampleNames(set) <- LETTERS[1:length(set)]
sampleNames(set)
## keywords
keyword(set, list("transformation"))
## length
length(set)
## compensation
samp <- read.flowSet(path=system.file("extdata","compdata","data",
package="flowCore"))
cfile <- system.file("extdata","compdata","compmatrix", package="flowCore")
comp.mat <- read.table(cfile, header=TRUE, skip=2, check.names = FALSE)
comp.mat
summary(samp[[1]])
samp <- compensate(samp, as.matrix(comp.mat))
summary(samp[[1]])
## transformation
opar <- par(mfcol=c(1:2))
plot(set[[1]], c("FL1.H", "FL2.H"))
set <- transform(set, transformList(c("FL1.H", "FL2.H"), log))
plot(set[[1]], c("FL1.H", "FL2.H"))
par(opar)
## filtering of flowSets
rectGate <- rectangleGate(filterId="nonDebris", FSC.H=c(200,Inf))
fres <- filter(set, rectGate)
class(fres)
summary(fres[[1]])
rectGate2 <- rectangleGate(filterId="nonDebris2", SSC.H=c(300,Inf))
fres2 <- filter(set, list(A=rectGate, B=rectGate2, C=rectGate, D=rectGate2))
## Splitting frames of a flowSet
split(set, rectGate)
split(set[1:2], rectGate, populatiuon="nonDebris2+")
split(set, c(1,1,2,2))
## subsetting according to filters and filter results
Subset(set, rectGate)
Subset(set, filter(set, rectGate))
Subset(set, list(A=rectGate, B=rectGate2, C=rectGate, D=rectGate2))
## combining flowSets
rbind2(set[1:2], set[3:4])
rbind2(set[1:3], set[[4]])
rbind2(set[[4]], set[1:2])
fr_append_cols()
Append data columns to a flowFrame
Description
Append data columns to a flowFrame
Usage
fr_append_cols(fr, cols)
Arguments
Argument | Description |
---|---|
fr | A flowFrame . |
cols | A numeric matrix containing the new data columns to be added. Must has column names to be used as new channel names. |
Details
It is used to add extra data columns to the existing flowFrame. It handles
keywords and parameters properly to ensure the new flowFrame can be written
as a valid FCS through the function write.FCS
.
Value
A flowFrame
Author
Mike Jiang
Examples
data(GvHD)
tmp <- GvHD[[1]]
kf <- kmeansFilter("FSC-H"=c("Pop1","Pop2","Pop3"), filterId="myKmFilter")
fres <- filter(tmp, kf)
cols <- as.integer(fres@subSet)
cols <- matrix(cols, dimnames = list(NULL, "km"))
tmp <- fr_append_cols(tmp, cols)
tmpfile <- tempfile()
write.FCS(tmp, tmpfile)
fsApply()
Apply a Function over values in a flowSet
Description
fsApply
, like many of the apply
-style functions in R, acts as an
iterator for flowSet
objects, allowing the application of a function
to either the flowFrame
or the data matrix itself. The output can then
be reconstructed as either a flowSet
, a list, or a matrix depending on
options and the type of objects returned.
Usage
fsApply(x, FUN, list(), simplify=TRUE, use.exprs=FALSE)
Arguments
Argument | Description |
---|---|
x | flowSet to be used |
FUN | the function to be applied to each element of x |
list() | optional arguments to FUN . |
simplify | logical (default: TRUE); if all true and all objects are flowFrame objects, a flowSet object will be constructed. If all of the values are of the same type there will be an attempt to construct a vector or matrix of the appropriate type (e.g. all numeric results will return a matrix). |
use.exprs | logical (default: FALSE); should the FUN be applied on the flowFrame object or the expression values. |
Seealso
Author
B. Ellis
Examples
fcs.loc <- system.file("extdata",package="flowCore")
file.location <- paste(fcs.loc, dir(fcs.loc), sep="/")
samp <- read.flowSet(file.location[1:3])
#Get summary information about each sample.
fsApply(samp,summary)
#Obtain the median of each parameter in each frame.
fsApply(samp,each_col,median)
getChannelMarker()
get channel and marker information from a flowFrame
that matches to the given keyword
Description
This function tries best to guess the flow parameter based on the keyword supplied by name
It first does a complete word match(case insensitive) between name
and flow channels and markers.
If there are duplcated matches, throw the error. If no matches, it will try the partial match.
Usage
getChannelMarker(frm, name, ...)
Arguments
Argument | Description |
---|---|
frm | flowFrame object |
name | character the keyword to match |
... | other arguments: not used. |
Value
an one-row data.frame
that contains "name"(i.e. channel) and "desc"(i.e. stained marker) columns.
getIndexSort_methods()
Extract Index Sorted Data from an FCS File
Description
Retrieve a data frame of index sorted data and sort indices from an FCS file.
Details
The input FCS file should already be compensated. Index sorting permits
association of cell-level fluorescence intensities with downstream data
collection on the sorted cells. Cells are sorted into a plate with
X,Y
coordinates, and those coordinates are stored in the FCS file.
This function will extract the data frame of flow data and the X,Y
coordinates for the cell-level data, which can be written to a text file, or
concatenated with sample-level information and analyzed in R. The
coordinates are names 'XLoc','YLoc', and a 'name' column is also prepended
with the FCS file name.
Value
Matrix of fluorescence intensities and sort indices for plate location. When no index sorting data is available, invisibly returns 0. Test for 0 to check success.
Author
G. Finak
Examples
samp <- read.FCS(system.file("extdata","0877408774.B08", package="flowCore"))
# This will return a message that no index sorting data is available
getIndexSort(samp)
hyperlog_class()
Class "hyperlog"
Description
Hyperlog transformation of a parameter is defined by the function
$$f(parameter,a,b)=root{EH(y,a,b)-parameter}$$
where EH is a function defined by $$EH(y,a,b) = 10^{(rac{y}{a})} +rac{b*y}{a}-1, y>=0$$
$$EH(y,a,b)= -10^{(rac{-y}{a})} + rac{b*y}{a}+1, y<0$$
Seealso
EHtrans
Other mathematical transform classes: EHtrans-class
,
asinht-class
,
asinhtGml2-class
,
dg1polynomial-class
,
exponential-class
,
hyperlogtGml2-class
,
invsplitscale-class
,
lintGml2-class
,
logarithm-class
,
logicletGml2-class
,
logtGml2-class
,
quadratic-class
, ratio-class
,
ratiotGml2-class
,
sinht-class
,
splitscale-class
,
squareroot-class
,
unitytransform-class
Note
The transformation object can be evaluated using the eval method by passing the data frame as an argument.The transformed parameters are returned as a matrix with a single column. (See example below)
Author
Gopalakrishnan N, F.Hahne
References
Gating-ML Candidate Recommendation for Gating Description in Flow Cytometry V 1.5
Examples
dat <- read.FCS(system.file("extdata","0877408774.B08",
package="flowCore"))
hlog1<-hyperlog("FSC-H",a=1,b=1,transformationId="hlog1")
transOut<-eval(hlog1)(exprs(dat))
hyperlogtGml2_class()
Class hyperlogtGml2
Description
Hyperlog transformation parameterized according to Gating-ML 2.0.
Details
hyperlogtGml2 is defined by the following function:
$$bound(hyperlog, boundMin, boundMax) = max(min(hyperlog,boundMax),boundMin))$$
where $$hyperlog(x, T, W, M, A) = root(EH(y, T, W, M, A) - x)$$ and $EH$ is defined as:
$$EH(y, T, W, M, A) = ae^{by} + cy - f$$ where
x is the value that is being transformed (an FCS dimension value). Typically, x is less than or equal to T, although the transformation function is also defined for x greater than T.
y is the result of the transformation.
T is greater than zero and represents the top of scale value.
M is greater than zero and represents the number of decades that the true logarithmic scale approached at the high end of the Hyperlog scale would cover in the plot range.
W is positive and not greater than half of M and represents the number of such decades in the approximately linear region.
A is the number of additional decades of negative data values to be included. A shall be greater than or equal to $-W$ , and less than or equal to $M$$- 2W$
root is a standard root finding algorithm (e.g., Newton's method) that finds y such as $B(y, T, W, M, A) = x$ . and $a$ , $b$ , $c$ and $f$ are defined by means of $T$ , $W$ , $M$ , $A$ , $w$ , $x0$ , $x1$ , $x2$ , $e0$ , $ca$ and $fa$ as:
$$ca= e0/w$$
In addition, if a boundary is defined by the boundMin and/or boundMax parameters, then the result of this transformation is restricted to the [boundMin,boundMax] interval. Specifically, should the result of the hyperlog function be less than boundMin, then let the result of this transformation be boundMin. Analogically, should the result of the hyperlog function be more than boundMax, then let the result of this transformation be boundMax. The boundMin parameter shall not be greater than the boundMax parameter.
Seealso
hyperlog
, logicleTransform
,
transform-class
, transform
Other mathematical transform classes: EHtrans-class
,
asinht-class
,
asinhtGml2-class
,
dg1polynomial-class
,
exponential-class
,
hyperlog-class
,
invsplitscale-class
,
lintGml2-class
,
logarithm-class
,
logicletGml2-class
,
logtGml2-class
,
quadratic-class
, ratio-class
,
ratiotGml2-class
,
sinht-class
,
splitscale-class
,
squareroot-class
,
unitytransform-class
Note
That hyperlogtGml2
transformation brings "reasonable" data
values to the scale of $[0,1]$ . The transformation is somewhat similar
to logicletGml2
. (See Gating-ML 2.0 for detailed comparison)
The hyperlog transformation object can be evaluated using the eval method by passing the data frame as an argument. The transformed parameters are returned as a matrix with a single column. (See example below)
Author
Spidlen, J., Moore, W.
References
Gating-ML 2.0: International Society for Advancement of Cytometry (ISAC) standard for representing gating descriptions in flow cytometry. http://flowcyt.sourceforge.net/gating/20141009.pdf
Examples
myDataIn <- read.FCS(system.file("extdata", "0877408774.B08",
package="flowCore"))
myHyperLg <- hyperlogtGml2(parameters = "FSC-H", T = 1023, M = 4.5,
W = 0.5, A = 0, transformationId="myHyperLg")
transOut <- eval(myHyperLg)(exprs(myDataIn))
identifier_methods()
Retrieve the GUID of flowCore objects
Description
Retrieve the GUID (globally unique identifier) of a flowFrame
that was generated by the cytometer or the identifier of a
filter or filterResult given by
the analyst.
Usage
identifier(object)
Arguments
Argument | Description |
---|---|
object | Object of class flowFrame , filter or filterResult . |
Details
GUID or Globally Unique Identifier is a pseudo-random number used in software applications. While each generated GUID is not guaranteed to be unique, the total number of unique keys (2^128) is so large that the probability of the same number being generated twice is very small.
Note that if no GUID has been recorded along with the FCS file, the name of the file is returned.
Value
Character vector representing the GUID or the name of the file.
Author
N. LeMeur
Examples
samp <- read.FCS(system.file("extdata","0877408774.B08", package="flowCore"))
identifier(samp)
intersectFilter_class()
Class intersectFilter
Description
This class represents the intersection of two filters, which is itself a filter
that can be incorporated in to further set operations. intersectFilter
s
are constructed using the binary set operator "&"
with operands consisting
of a single filter or list of filters.
Seealso
filter
, setOperationFilter
Other setOperationFilter classes: complementFilter-class
,
setOperationFilter-class
,
subsetFilter-class
,
unionFilter-class
Author
B. Ellis
inverseLogicleTransform()
Computes the inverse of the transform defined by the 'logicleTransform' function or the transformList generated by 'estimateLogicle' function
Description
inverseLogicleTransform can be use to compute the inverse of the Logicle transformation. The parameters w, t, m, a for calculating the inverse are obtained from the 'trans' input passed to the 'inverseLogicleTransform' function. (The inverseLogicleTransform method makes use of the C++ implementation of the inverse logicle transform contributed by Wayne Moore et al.)
Usage
inverseLogicleTransform(trans,transformationId,...)
Arguments
Argument | Description |
---|---|
trans | An object of class 'transform' created using the 'logicleTransform' function or class 'transformList' created by 'estimateLogicle'. The parameters w, t, m, a for calculating the inverse are obtained from the 'trans' input passed to the 'inverseLogicleTransform' function. |
transformationId | A name to assigned to the inverse transformation. Used by the transform routines. |
... | not used. |
Seealso
Other Transform functions: arcsinhTransform
,
biexponentialTransform
,
linearTransform
, lnTransform
,
logTransform
,
logicleTransform
,
quadraticTransform
,
scaleTransform
,
splitScaleTransform
,
truncateTransform
Author
Wayne Moore, N. Gopalakrishnan
References
Parks D.R., Roederer M., Moore W.A.(2006) A new "logicle" display method avoids deceptive effects of logarithmic scaling for low signals and compensated data. CytometryA, 96(6):541-51.
Examples
data(GvHD)
samp <- GvHD[[1]]
#########inverse the transform object###############
logicle <- logicleTransform(t = 10000, w = 0.5, m = 4.5 , a =0 ,"logicle")
## transform FL1-H parameter using logicle transformation
after <- transform(samp, transformList('FL1-H', logicle))
## Inverse transform the logicle transformed data to retrieve the original data
invLogicle <- inverseLogicleTransform(trans = logicle)
before <- transform (after, transformList('FL1-H', invLogicle))
#########inverse the transformList object###############
translist <- estimateLogicle(samp, c("FL1-H", "FL2-H"))
after <- transform(samp, translist)
## Inverse
invLogicle <- inverseLogicleTransform(translist)
before <- transform (after, invLogicle)
invsplitscale_class()
Class "invsplitscale"
Description
As its name suggests, the inverse split scale transformation class represents the inverse transformation of a split scale transformation that has a logarithmic scale at high values and a linear scale at low values.
Details
The inverse split scale transformation is defined by the function
$$f(parameter,r,maxValue,transitionChannel) rac{(parameter-b)}{a}, parameter<=t*a + b$$
$$f(parameter,r,maxValue,transitionChannel) = rac{10^{parameterrac{d}{r}}}{c}, parameter > ta+b$$
where
$$b=rac{transitionChannel}{2}$$
$$d=rac{2log_{10}(e)r}{transitionChannel} + log_{10}(maxValue)$$
$$t=10^{log_{10}t}$$
$$a= rac{transitionChannel}{2*t}$$
$$log_{10}ct=rac{(at+b)d}{r}$$
$$c=10^{log_{10}ct}$$
Seealso
splitscale
Other mathematical transform classes: EHtrans-class
,
asinht-class
,
asinhtGml2-class
,
dg1polynomial-class
,
exponential-class
,
hyperlog-class
,
hyperlogtGml2-class
,
lintGml2-class
,
logarithm-class
,
logicletGml2-class
,
logtGml2-class
,
quadratic-class
, ratio-class
,
ratiotGml2-class
,
sinht-class
,
splitscale-class
,
squareroot-class
,
unitytransform-class
Note
The transformation object can be evaluated using the eval method by passing the data frame as an argument.The transformed parameters are returned as a matrix with a single column. (See example below)
Author
Gopalakrishnan N,F.Hahne
References
Gating-ML Candidate Recommendation for Gating Description in Flow Cytometry
Examples
dat <- read.FCS(system.file("extdata","0877408774.B08",package="flowCore"))
sp1<-invsplitscale("FSC-H",r=512,maxValue=2000,transitionChannel=512)
transOut<-eval(sp1)(exprs(dat))
keyword_methods()
Methods to retrieve keywords of a flowFrame
Description
Accessor and replacement methods for items in the description slot (usually
read in from a FCS file header). It lists the keywords
and its values
for a flowFrame specified by a character vector. Additional methods for
function
and lists
exists for more programmatic access to the
keywords.
Usage
keyword(object, keyword, ...)
Arguments
Argument | Description |
---|---|
object | Object of class flowFrame . |
keyword | Character vector or list of potential keywords or function. If missing all keywords are returned. |
... | compact: logical scaler to indicate whether to hide all the cytometer instrument and laser settings from keywords. |
Details
The keyword
methods allow access to the keywords stored in the FCS
files, either for a flowFrame
or for a list of frames in a
flowSet
. The most simple use case is to provide a character vector or
a list of character strings of keyword names. A more sophisticated version
is to provide a function which has to take one mandatory argument, the value
of this is the flowFrame
. This can be used to query arbitrary
information from the flowFrames
description
slot or even the
raw data. The function has to return a single character string. The
list
methods allow to combine functional and direct keyword access.
The replacement method takes a named character vector or a named list as
input. R's usual recycling rules apply when replacing keywords for a whole
flowSet
Seealso
Author
N LeMeur,F Hahne,B Ellis
Examples
samp <- read.FCS(system.file("extdata","0877408774.B08", package="flowCore"))
keyword(samp)
keyword(samp, compact = TRUE)
keyword(samp, "FCSversion")
keyword(samp, function(x,...) paste(keyword(x, "SAMPLE ID"), keyword(x,
"GUID"), sep="_"))
keyword(samp) <- list(foo="bar")
data(GvHD)
keyword(GvHD, list("GUID", cellnumber=function(x) nrow(x)))
keyword(GvHD) <- list(sample=sampleNames(GvHD))
kmeansFilter_class()
Class "kmeansFilter"
Description
A filter that performs one-dimensional k-means (Lloyd-Max) clustering on a single flow parameter.
Usage
kmeansFilter(list(), filterId="defaultKmeansFilter")
Arguments
Argument | Description |
---|---|
list() | kmeansFilter are defined by a single flow parameter and an associated list of k population names. They can be given as a character vector via a named argument, or as a list with a single named argument. In both cases the name will be used as the flow parameter and the content of the list or of the argument will be used as population names, after coercing to character. For example kmeansFilter(FSC=c("a", "b", "c")) or kmeansFilter(list(SSC=1:3)) If the parameter is not fully realized, but instead is the result of a transformation operation, two arguments need to be passed to the constructor: the first one being the transform object and the second being a vector of population names which can be coerced to a character. For example kmeansFilter(tf, c("D", "E")) |
filterId | An optional parameter that sets the filterId of the object. The filter can later be identified by this name. |
Details
The one-dimensional k-means filter is a multiple population filter capable
of operating on a single flow parameter. It takes a parameter argument
associated with two or more populations and results in the generation of an
object of class multipleFilterResult
. Populations are
considered to be ordered such that the population with the smallest mean
intensity will be the first population in the list and the population with
the highest mean intensity will be the last population listed.
Value
Returns a kmeansFilter
object for use in filtering
flowFrames
or other flow cytometry
objects.
Seealso
flowFrame
, flowSet
, filter
for
evaluation of kmeansFilters
and split
for splitting of
flow cytometry data sets based on the result of the filtering operation.
Note
See the documentation in the flowViz
package for plotting of kmeansFilters
.
Author
F. Hahne, B. Ellis, N. LeMeur
Examples
## Loading example data
dat <- read.FCS(system.file("extdata","0877408774.B08",
package="flowCore"))
## Create the filter
kf <- kmeansFilter("FSC-H"=c("Pop1","Pop2","Pop3"), filterId="myKmFilter")
## Filtering using kmeansFilters
fres <- filter(dat, kf)
fres
summary(fres)
names(fres)
## The result of quadGate filtering are multiple sub-populations
## and we can split our data set accordingly
split(dat, fres)
## We can limit the splitting to one or several sub-populations
split(dat, fres, population="Pop1")
split(dat, fres, population=list(keep=c("Pop1","Pop2")))
linearTransform()
Create the definition of a linear transformation function to be applied on a data set
Description
Create the definition of the linear Transformation that will be applied on
some parameter via the transform
method. The definition of this
function is currently x <- a*x+b
Usage
linearTransform(transformationId="defaultLinearTransform", a = 1, b = 0)
Arguments
Argument | Description |
---|---|
transformationId | character string to identify the transformation |
a | double that corresponds to the multiplicative factor in the equation |
b | double that corresponds to the additive factor in the equation |
Value
Returns an object of class transform
.
Seealso
Other Transform functions: arcsinhTransform
,
biexponentialTransform
,
inverseLogicleTransform
,
lnTransform
, logTransform
,
logicleTransform
,
quadraticTransform
,
scaleTransform
,
splitScaleTransform
,
truncateTransform
Author
N. LeMeur
Examples
samp <- read.FCS(system.file("extdata",
"0877408774.B08", package="flowCore"))
linearTrans <- linearTransform(transformationId="Linear-transformation", a=2, b=0)
dataTransform <- transform(samp, transformList('FSC-H' ,linearTrans))
lintGml2_class()
Class lintGml2
Description
Linear transformation as parameterized in Gating-ML 2.0.
Details
lintGml2 is defined by the following function:
$$bound(f, boundMin, boundMax) = max(min(f,boundMax),boundMin))$$ where
$$f(parameter, T, A) = (parameter + A) / (T + A)$$
This transformation provides a linear display that maps scale values from the $[-A, T]$ interval to the $[0, 1]$ interval. However, it is defined for all $x in R$ including outside of the $[-A, T]$ interval.
In addition, if a boundary is defined by the boundMin and/or boundMax parameters, then the result of this transformation is restricted to the [boundMin,boundMax] interval. Specifically, should the result of the f function be less than boundMin, then let the result of this transformation be boundMin. Analogically, should the result of the f function be more than boundMax, then let the result of this transformation be boundMax. The boundMin parameter shall not be greater than the boundMax parameter.
Seealso
linearTransform
, transform-class
,
transform
Other mathematical transform classes: EHtrans-class
,
asinht-class
,
asinhtGml2-class
,
dg1polynomial-class
,
exponential-class
,
hyperlog-class
,
hyperlogtGml2-class
,
invsplitscale-class
,
logarithm-class
,
logicletGml2-class
,
logtGml2-class
,
quadratic-class
, ratio-class
,
ratiotGml2-class
,
sinht-class
,
splitscale-class
,
squareroot-class
,
unitytransform-class
Note
The linear transformation object can be evaluated using the eval method by passing the data frame as an argument. The transformed parameters are returned as a matrix with a single column. (See example below)
Author
Spidlen, J.
References
Gating-ML 2.0: International Society for Advancement of Cytometry (ISAC) standard for representing gating descriptions in flow cytometry. http://flowcyt.sourceforge.net/gating/20141009.pdf
Examples
myDataIn <- read.FCS(system.file("extdata", "0877408774.B08",
package="flowCore"))
myLinTr1 <- lintGml2(parameters = "FSC-H", T = 1000, A = 0,
transformationId="myLinTr1")
transOut <- eval(myLinTr1)(exprs(myDataIn))
lnTransform()
Create the definition of a ln transformation function (natural logarthim) to be applied on a data set
Description
Create the definition of the ln Transformation that will be applied on some
parameter via the transform
method. The definition of this function
is currently x<-log(x)*(r/d). The transformation would normally be used to
convert to a linear valued parameter to the natural logarithm scale.
Typically r and d are both equal to 1.0. Both must be positive.
Usage
lnTransform(transformationId="defaultLnTransform", r=1, d=1)
Arguments
Argument | Description |
---|---|
transformationId | character string to identify the transformation |
r | positive double that corresponds to a scale factor. |
d | positive double that corresponds to a scale factor |
Value
Returns an object of class transform
.
Seealso
Other Transform functions: arcsinhTransform
,
biexponentialTransform
,
inverseLogicleTransform
,
linearTransform
,
logTransform
,
logicleTransform
,
quadraticTransform
,
scaleTransform
,
splitScaleTransform
,
truncateTransform
Author
B. Ellis and N. LeMeur
Examples
data(GvHD)
lnTrans <- lnTransform(transformationId="ln-transformation", r=1, d=1)
ln1 <- transform(GvHD, transformList('FSC-H', lnTrans))
opar = par(mfcol=c(2, 1))
plot(density(exprs(GvHD[[1]])[ ,1]), main="Original")
plot(density(exprs(ln1[[1]])[ ,1]), main="Ln Transform")
logTransform()
Create the definition of a log transformation function (base specified by user) to be applied on a data set
Description
Create the definition of the log Transformation that will be applied on some
parameter via the transform
method. The definition of this function
is currently x<-log(x,logbase)*(r/d). The transformation would normally be
used to convert to a linear valued parameter to the natural logarithm scale.
Typically r and d are both equal to 1.0. Both must be positive. logbase =
10 corresponds to base 10 logarithm.
Usage
logTransform(transformationId="defaultLogTransform", logbase=10, r=1, d=1)
Arguments
Argument | Description |
---|---|
transformationId | character string to identify the transformation |
logbase | positive double that corresponds to the base of the logarithm. |
r | positive double that corresponds to a scale factor. |
d | positive double that corresponds to a scale factor |
Value
Returns an object of class transform
.
Seealso
Other Transform functions: arcsinhTransform
,
biexponentialTransform
,
inverseLogicleTransform
,
linearTransform
, lnTransform
,
logicleTransform
,
quadraticTransform
,
scaleTransform
,
splitScaleTransform
,
truncateTransform
Author
B. Ellis, N. LeMeur
Examples
samp <- read.FCS(system.file("extdata",
"0877408774.B08", package="flowCore"))
logTrans <- logTransform(transformationId="log10-transformation", logbase=10, r=1, d=1)
trans <- transformList('FSC-H', logTrans)
dataTransform <- transform(samp, trans)
logarithm_class()
Class "logarithm"
Description
Logartithmic transform class, which represents a transformation defined by the function
Details
$$f(parameter,a,b)= ln(aprarameter)b ~~~~a*parameter>0$$
$$0~~~~a*parameter<=0$$
Seealso
exponential, quadratic
Other mathematical transform classes: EHtrans-class
,
asinht-class
,
asinhtGml2-class
,
dg1polynomial-class
,
exponential-class
,
hyperlog-class
,
hyperlogtGml2-class
,
invsplitscale-class
,
lintGml2-class
,
logicletGml2-class
,
logtGml2-class
,
quadratic-class
, ratio-class
,
ratiotGml2-class
,
sinht-class
,
splitscale-class
,
squareroot-class
,
unitytransform-class
Note
The logarithm transformation object can be evaluated using the eval method by passing the data frame as an argument.The transformed parameters are returned as a matrix with a single column. (See example below)
Author
Gopalakrishnan N, F.Hahne
References
Gating-ML Candidate Recommendation for Gating Description in Flow Cytometry V 1.5
Examples
dat <- read.FCS(system.file("extdata","0877408774.B08",
package="flowCore"))
lg1<-logarithm(parameters="FSC-H",a=2,b=1,transformationId="lg1")
transOut<-eval(lg1)(exprs(dat))
logicalFilterResult_class()
Class "logicalFilterResult"
Description
Container to store the result of applying a filter
on a
flowFrame
object
Seealso
Author
B. Ellis
Examples
showClass("logicalFilterResult")
logicleTransform()
Computes a transform using the 'logicle_transform' function
Description
Logicle transformation creates a subset of
biexponentialTransform
hyperbolic sine transformation
functions that provides several advantages over linear/log transformations
for display of flow cytometry data. (The logicleTransform method makes use
of the C++ implementation of the logicle transform contributed by Wayne
Moore et al.)
Usage
logicleTransform(transformationId="defaultLogicleTransform", w = 0.5, t = 262144,
m = 4.5, a = 0)
estimateLogicle(x, channels,...)
Arguments
Argument | Description |
---|---|
transformationId | A name to assign to the transformation. Used by the transform/filter routines. |
w | w is the linearization width in asymptotic decades. w should be > 0 and determines the slope of transformation at zero. w can be estimated using the equation w=(m-log10(t/abs(r)))/2, where r is the most negative value to be included in the display |
t | Top of the scale data value, e.g, 10000 for common 4 decade data or 262144 for a 18 bit data range. t should be greater than zero |
m | m is the full width of the transformed display in asymptotic decades. m should be greater than zero |
a | Additional negative range to be included in the display in asymptotic decades. Positive values of the argument brings additional negative input values into the transformed display viewing area. Default value is zero corresponding to a Standard logicle function. |
x | Input flow frame for which the logicle transformations are to be estimated. |
channels | channels or markers for which the logicle transformation is to be estimated. |
... | other arguments: q: a numeric type specifying quantile value, default is 0.05 |
Seealso
inverseLogicleTransform
,
estimateLogicle
Other Transform functions: arcsinhTransform
,
biexponentialTransform
,
inverseLogicleTransform
,
linearTransform
, lnTransform
,
logTransform
,
quadraticTransform
,
scaleTransform
,
splitScaleTransform
,
truncateTransform
Author
Wayne Moore, N Gopalakrishnan
References
Parks D.R., Roederer M., Moore W.A.(2006) A new "logicle" display method avoids deceptive effects of logarithmic scaling for low signals and compensated data. CytometryA, 96(6):541-51.
Examples
data(GvHD)
samp <- GvHD[[1]]
## User defined logicle function
lgcl <- logicleTransform( w = 0.5, t= 10000, m =4.5)
trans <- transformList(c("FL1-H", "FL2-H"), lgcl)
after <- transform(samp, trans)
invLgcl <- inverseLogicleTransform(trans = lgcl)
trans <- transformList(c("FL1-H", "FL2-H"), invLgcl)
before <- transform (after, trans)
## Automatically estimate the logicle transformation based on the data
lgcl <- estimateLogicle(samp, channels = c("FL1-H", "FL2-H", "FL3-H", "FL2-A", "FL4-H"))
## transform parameters using the estimated logicle transformation
after <- transform(samp, lgcl)
logicletGml2_class()
Class logicletGml2
Description
Logicle transformation as published by Moore and Parks.
Details
logicletGml2 is defined by the following function:
$$bound(logicle, boundMin, boundMax) = max(min(logicle,boundMax),boundMin))$$
where $$logicle(x, T, W, M, A) = root(B(y, T, W, M, A) - x)$$ and $B$ is a modified biexponential function:
$$B(y, T, W, M, A) = ae^{by} - ce^{-dy} - f$$ where
x is the value that is being transformed (an FCS dimension value). Typically, x is less than or equal to T, although the transformation function is also defined for x greater than T.
y is the result of the transformation.
T is greater than zero and represents the top of scale value.
M is greater than zero and represents the number of decades that the true logarithmic scale approached at the high end of the Logicle scale would cover in the plot range.
W is non-negative and not greater than half of M and represents the number of such decades in the approximately linear region. The choice of $W = M/2$ specifies a scale that is essentially linear over the whole range except for a small region of large data values. For situations in which values of W approaching $M/2$ might be chosen, ordinary linear display scales will usually be more appropriate. The choice of $W = 0$ gives essentially the hyperbolic sine function.
A is the number of additional decades of negative data values to be included. A shall be greater than or equal to $-W$ , and less than or equal to $M - 2W$
root is a standard root finding algorithm (e.g., Newton's method) that finds y such as $B(y, T, W, M, A)$$= x$ . and $a$ , $b$ , $c$ , $d$ and $f$ are defined by means of $T$ , $W$ , $M$ , $A$ , $w$ , $x0$ , $x1$ , $x2$ , $ca$ and $fa$ as:
and $d$ is a constant so that $$2(ln(d) - ln(b)) + w(d + b) = 0$$ given $b$ and $w$ , and
The Logicle scale is the inverse of a modified biexponential function. It provides a Logicle display that maps scale values onto the $[0,1]$ interval such that the data value $T$ is mapped to 1, large data values are mapped to locations similar to an (M + A)-decade logarithmic scale, and A decades of negative data are brought on scale. For implementation purposes, it is recommended to follow guidance in Moore and Parks publication.
In addition, if a boundary is defined by the boundMin and/or boundMax parameters, then the result of this transformation is restricted to the [boundMin,boundMax] interval. Specifically, should the result of the logicle function be less than boundMin, then let the result of this transformation be boundMin. Analogically, should the result of the logicle function be more than boundMax, then let the result of this transformation be boundMax. The boundMin parameter shall not be greater than the boundMax parameter.
Seealso
logicleTransform
, transform-class
,
transform
Other mathematical transform classes: EHtrans-class
,
asinht-class
,
asinhtGml2-class
,
dg1polynomial-class
,
exponential-class
,
hyperlog-class
,
hyperlogtGml2-class
,
invsplitscale-class
,
lintGml2-class
,
logarithm-class
,
logtGml2-class
,
quadratic-class
, ratio-class
,
ratiotGml2-class
,
sinht-class
,
splitscale-class
,
squareroot-class
,
unitytransform-class
Note
Please note that logicletGml2
and
logicleTransform
are similar transformations; however, the
Gating-ML 2.0 compliant logicletGml2
brings "reasonable" data values
to the scale of $[0,1]$ while the logicleTransform
scales
these values to $[0,M]$ .
The logicle transformation object can be evaluated using the eval method by passing the data frame as an argument. The transformed parameters are returned as a matrix with a single column. (See example below)
Author
Spidlen, J., Moore, W.
References
Gating-ML 2.0: International Society for Advancement of Cytometry (ISAC) standard for representing gating descriptions in flow cytometry. http://flowcyt.sourceforge.net/gating/20141009.pdf
Moore, WA and Parks, DR. Update for the logicle data scale including operational code implementations. Cytometry A., 2012:81A(4):273-277.
Parks, DR and Roederer, M and Moore, WA. A new "Logicle" display method avoids deceptive effects of logarithmic scaling for low signals and compensated data. Cytometry A., 2006:69(6):541-551.
Examples
myDataIn <- read.FCS(system.file("extdata", "0877408774.B08",
package="flowCore"))
myLogicle <- logicletGml2(parameters = "FSC-H", T = 1023, M = 4.5,
W = 0.5, A = 0, transformationId="myLogicle")
transOut <- eval(myLogicle)(exprs(myDataIn))
logtGml2_class()
Class logtGml2
Description
Log transformation as parameterized in Gating-ML 2.0.
Details
logtGml2 is defined by the following function:
$$bound(f, boundMin, boundMax) = max(min(f,boundMax),boundMin))$$ where
$$f(parameter, T, M) = (1/M) * log10(x/T) + 1$$
This transformation provides a logarithmic display that maps scale values from the $(0, T]$ interval to the $(-Inf, 1]$ interval such that the data value T is mapped to 1 and M decades of data are mapped into the interval. Also, the limit for x going to 0 is -Inf.
In addition, if a boundary is defined by the boundMin and/or boundMax parameters, then the result of this transformation is restricted to the [boundMin,boundMax] interval. Specifically, should the result of the f function be less than boundMin, then let the result of this transformation be boundMin. Analogically, should the result of the f function be more than boundMax, then let the result of this transformation be boundMax. The boundMin parameter shall not be greater than the boundMax parameter.
Seealso
logTransform
, transform-class
,
transform
Other mathematical transform classes: EHtrans-class
,
asinht-class
,
asinhtGml2-class
,
dg1polynomial-class
,
exponential-class
,
hyperlog-class
,
hyperlogtGml2-class
,
invsplitscale-class
,
lintGml2-class
,
logarithm-class
,
logicletGml2-class
,
quadratic-class
, ratio-class
,
ratiotGml2-class
,
sinht-class
,
splitscale-class
,
squareroot-class
,
unitytransform-class
Note
The log transformation object can be evaluated using the eval method by passing the data frame as an argument. The transformed parameters are returned as a matrix with a single column. (See example below)
Author
Spidlen, J.
References
Gating-ML 2.0: International Society for Advancement of Cytometry (ISAC) standard for representing gating descriptions in flow cytometry. http://flowcyt.sourceforge.net/gating/20141009.pdf
Examples
myDataIn <- read.FCS(system.file("extdata", "0877408774.B08",
package="flowCore"))
myLogTr1 <- logtGml2(parameters = "FSC-H", T = 1023, M = 4.5,
transformationId="myLogTr1")
transOut <- eval(myLogTr1)(exprs(myDataIn))
manyFilterResult_class()
Class "manyFilterResult"
Description
The result of a several related, but possibly overlapping filter results.
The usual creator of this object will usually be a filter
operation on a flowFrame
object.
Seealso
Author
B. Ellis
Examples
showClass("manyFilterResult")
markernames()
get or update the marker names
Description
marker names corresponds to the 'desc' column of the phenoData of the flowFrame.
Usage
markernames(object, ...)
list(list("markernames"), list("flowFrame"))(object)
markernames(object) <- value
list(list("markernames"), list("flowFrame"))(object) <- value
list(list("markernames"), list("flowSet"))(object)
list(list("markernames"), list("flowSet"))(object) <- value
Arguments
Argument | Description |
---|---|
object | flowFrame or flowSet |
... | not used |
value | a named list or character vector. the names corresponds to the name(channel) and actual values are the desc(marker). |
Details
When extract marker names from a flowSet, it throws the warning if the marker names are not all the same across samples.
Value
marker names as a character vector. The marker names for FSC,SSC and Time channels are automatically excluded in the returned value. When object is a flowSet and the marker names are not consistent across flowFrames, it returns a list of unique marker sets.
Examples
data(GvHD)
fr <- GvHD[[1]]
markernames(fr)
chnls <- c("FL1-H", "FL3-H")
markers <- c("CD15", "CD14")
names(markers) <- chnls
markernames(fr) <- markers
markernames(fr)
fs <- GvHD[1:3]
markernames(fs)
multipleFilterResult_class()
Class "multipleFilterResult"
Description
Container to store the result of applying filter
on set of
flowFrame
objects
Seealso
Author
B. Ellis
Examples
showClass("multipleFilterResult")
norm2Filter_class()
Class "norm2Filter"
Description
Class and constructors for a filter
that fits a bivariate
normal distribution to a data set of paired values and selects data points
according to their standard deviation from the fitted distribution.
Usage
norm2Filter(x, y, method="covMcd", scale.factor=1, n=50000,
filterId="defaultNorm2Filter")
Arguments
Argument | Description |
---|---|
x, y | Characters giving the names of the measurement parameter on which the filter is supposed to work on. y can be missing in which case x is expected to be a character vector of length 2 or a list of characters. |
filterId | An optional parameter that sets the filterId slot of this filter. The object can later be identified by this name. |
scale.factor, n | Numerics of length 1, used to set the scale.factor and n slots of the object. |
method | Character in covMcd or cov.rob , used to set the method slot of the object. |
Details
The filter fits a bivariate normal distribution to the data and selects all
events within the Mahalanobis distance multiplied by the scale.factor
argument. The constructor norm2Filter
is a convenience function for
object instantiation. Evaluating a curv2Filter
results in an object
of class logicalFilterResult
. Accordingly, norm2Filters
can be used to subset and to split flow cytometry data sets.
Value
Returns a norm2Filter
object for use in filtering
flowFrame
s or other flow cytometry objects.
Seealso
cov.rob
, CovMcd
,
filter
for evaluation of
norm2Filters
and split
and Subset
for
splitting and subsetting of flow cytometry data sets based on that.
Note
See the documentation in the flowViz
package for plotting of norm2Filters
.
Author
F. Hahne
Examples
## Loading example data
dat <- read.FCS(system.file("extdata","0877408774.B08",
package="flowCore"))
## Create directly. Most likely from a command line
norm2Filter("FSC-H", "SSC-H", filterId="myCurv2Filter")
## To facilitate programmatic construction we also have the following
n2f <- norm2Filter(filterId="myNorm2Filter", x=list("FSC-H", "SSC-H"),
scale.factor=2)
n2f <- norm2Filter(filterId="myNorm2Filter", x=c("FSC-H", "SSC-H"),
scale.factor=2)
## Filtering using norm2Filter
fres <- filter(dat, n2f)
fres
summary(fres)
## The result of norm2 filtering is a logical subset
Subset(dat, fres)
## We can also split, in which case we get those events in and those
## not in the gate as separate populations
split(dat, fres)
normalization_class()
Class "normalization"
Description
Class and methods to normalize a a flowSet
using a potentially
complex normalization function.
Usage
normalization(parameters, normalizationId="defaultNormalization",
normFunction, arguments=list())
normalize(data, x,...)
Arguments
Argument | Description |
---|---|
parameters | Character vector of parameter names. |
normalizationId | The identifier for the normalization object. |
x | An object of class flowSet . |
normFunction | The normalization function |
arguments | The list of additional arguments to normFunction |
data | The flowSet to normalize. |
list() | other arguments: see normalize-methods for details. |
Details
Data normalization of a flowSet
is a rather fuzzy concept. The idea is
to have a rather general function that takes a flowSet
and a list of
parameter names as input and applies any kind of normalization to the
respective data columns. The output of the function has to be a
flowSet
again. Although we don't formally check for it, the
dimensions of the input and of the output set should remain the same.
Additional arguments may be passed to the normalization function via the
arguments
list. Internally we evaluate the function using
do.call
and one should check its documentation for details.
Currently, the most prominent example for a normalization function is
warping, as provided by the flowStats
package.
Value
A normalization
object for the constructor.
A flowSet for the normalize
methods.
Author
F. Hahne
nullParameter_class()
Class "nullParameter"
Description
A class used internally for coercing transforms to characters for a return value when a coercion cannot be performed. The user should never need to interact with this class.
parameterFilter_class()
Class "parameterFilter"
Description
A concrete filter that acts on a set of parameters.
Author
B. Ellis
parameterTransform_class()
Class "parameterTransform"
Description
Link a transformation to particular flow parameters
Author
Byron Ellis
parameters_class()
Class "parameters"
Description
A representation of flow parameters that allows for referencing.
Author
Nishant Gopalakrishnan
parameters_methods()
Obtain information about parameters for flow cytometry objects.
Description
Many different objects in flowCore
are associated with one or more
parameters. This includes filter ,
flowFrame and parameterFilter
objects that all either describe or use parameters.
Usage
parameters(object, list())
Arguments
Argument | Description |
---|---|
object | Object of class filter , flowFrame or parameterFilter . |
list() | Further arguments that get passed on to the methods. |
Value
When applied to a flowFrame
object, the result is an
AnnotatedDataFrame
describing the parameters recorded by the cytometer. For other objects it
will usually return a vector of names used by the object for its
calculations.
Author
B. Ellis, N. Le Meur, F. Hahne
Examples
samp <- read.FCS(system.file("extdata","0877408774.B08", package="flowCore"))
parameters(samp)
print(samp@parameters@data)
polygonGate_class()
Class "polygonGate"
Description
Class and constructor for 2-dimensional polygonal filter
objects.
Usage
polygonGate(list(), .gate, boundaries, filterId="defaultPolygonGate")
Arguments
Argument | Description |
---|---|
filterId | An optional parameter that sets the filterId of this gate. |
.gate, boundaries | A definition of the gate. This can be either a list or a named matrix as described below. Note the argument boundaries is deprecated and will go away in the next release. |
list() | You can also directly describe a gate without wrapping it in a list or matrix, as described below. |
Details
Polygons are specified by the coordinates of their vertices in two
dimensions. The constructor is designed to be useful in both direct and
programmatic usage. It takes either a list or a named matrix with 2
columns and at least 3
rows containing these coordinates.
Alternatively, vertices can be given as named arguments, in which case the
function tries to convert the values into a matrix.
Value
Returns a polygonGate
object for use in filtering
flowFrame
s or other flow cytometry objects.
Seealso
flowFrame
, rectangleGate
,
ellipsoidGate
, polytopeGate
,
filter
for evaluation of rectangleGates
and
split
and Subset
for splitting and subsetting of
flow cytometry data sets based on that.
Other Gate classes: ellipsoidGate-class
,
polytopeGate-class
,
quadGate-class
,
rectangleGate-class
Note
See the documentation in the flowViz
package for plotting of polygonGates
.
Author
F.Hahne, B. Ellis N. Le Meur
Examples
## Loading example data
dat <- read.FCS(system.file("extdata","0877408774.B08",
package="flowCore"))
## Defining the gate
sqrcut <- matrix(c(300,300,600,600,50,300,300,50),ncol=2,nrow=4)
colnames(sqrcut) <- c("FSC-H","SSC-H")
pg <- polygonGate(filterId="nonDebris", boundaries= sqrcut)
pg
## Filtering using polygonGates
fres <- filter(dat, pg)
fres
summary(fres)
## The result of polygon filtering is a logical subset
Subset(dat, fres)
## We can also split, in which case we get those events in and those
## not in the gate as separate populations
split(dat, fres)
polytopeGate_class()
Define filter boundaries
Description
Convenience methods to facilitate the construction of filter
objects
Usage
polytopeGate(list(), .gate, b, filterId="defaultPolytopeGate")
Arguments
Argument | Description |
---|---|
filterId | An optional parameter that sets the filterId of this gate. |
.gate | A definition of the gate. This can be either a list, vector or matrix, described below. |
b | Need documentation |
list() | You can also directly describe a gate without wrapping it in a list or matrix, as described below. |
Details
These functions are designed to be useful in both direct and programmatic usage.
For rectangle gate in n dimensions, if n=1 the gate correspond to a range
gate. If n=2, the gate is a rectangle gate. To use this function
programmatically, you may either construct a list or you may construct a
matrix with n
columns and 2
rows. The first row corresponds
to the minimal value for each parameter while the second row corresponds to
the maximal value for each parameter. The names of the parameters are taken
from the column names as in the third example.
Rectangle gate objects can also be multiplied together using the *
operator, provided that both gate have orthogonal axes.
For polygon gate, the boundaries are specified as vertices in 2 dimensions, for polytope gate objects as vertices in n dimensions.
Polytope gate objects will represent the convex polytope determined by the vertices and parameter b which together specify the polytope as an intersection of half-spaces represented as a system of linear inequalities, $Axle b$
For quadrant gates, the boundaries are specified as a named list or vector of length two.
Value
Returns a rectangleGate
or polygonGate
object
for use in filtering flowFrame
s or other flow cytometry
objects.
Seealso
Other Gate classes: ellipsoidGate-class
,
polygonGate-class
,
quadGate-class
,
rectangleGate-class
Author
F.Hahne, B. Ellis N. Le Meur
quadGate_class()
Class "quadGate"
Description
Class and constructors for quadrant-type filter
objects.
Usage
quadGate(list(), .gate, filterId="defaultQuadGate")
Arguments
Argument | Description |
---|---|
filterId | An optional parameter that sets the filterId of this filter . The object can later be identified by this name. |
.gate | A definition of the gate for programmatic access. This can be either a named list or a named numeric vector, as described below. |
list() | The parameters of quadGates can also be directly described using named function arguments, as described below. |
Details
quadGates
are defined by two parameters, which specify a separation
of a two-dimensional parameter space into four quadrants. The
quadGate
function is designed to be useful in both direct and
programmatic usage.
For the interactive use, these parameters can be given as additional named
function arguments, where the names correspond to valid parameter names in a
flowFrame
or flowSet
. For a more programmatic
approach, a named list or numeric vector of the gate boundaries can be
passed on to the function as argument .gate
.
Evaluating a quadGate
results in four sub-populations, and hence in
an object of class multipleFilterResult
. Accordingly,
quadGates
can be used to split flow cytometry data sets.
Value
Returns a quadGate
object for use in filtering
flowFrame
s or other flow cytometry objects.
Seealso
flowFrame
, flowSet
, filter
for
evaluation of quadGates
and split
for splitting of flow
cytometry data sets based on that.
Other Gate classes: ellipsoidGate-class
,
polygonGate-class
,
polytopeGate-class
,
rectangleGate-class
Note
See the documentation in the flowViz
package for plotting of quadGates
.
Author
F.Hahne, B. Ellis N. Le Meur
Examples
## Loading example data
dat <- read.FCS(system.file("extdata","0877408774.B08",
package="flowCore"))
## Create directly. Most likely from a command line
quadGate(filterId="myQuadGate1", "FSC-H"=100, "SSC-H"=400)
## To facilitate programmatic construction we also have the following
quadGate(filterId="myQuadGate2", list("FSC-H"=100, "SSC-H"=400))
## FIXME: Do we want this?
##quadGate(filterId="myQuadGate3", .gate=c("FSC-H"=100, "SSC-H"=400))
## Filtering using quadGates
qg <- quadGate(filterId="quad", "FSC-H"=600, "SSC-H"=400)
fres <- filter(dat, qg)
fres
summary(fres)
names(fres)
## The result of quadGate filtering are multiple sub-populations
## and we can split our data set accordingly
split(dat, fres)
## We can limit the splitting to one or several sub-populations
split(dat, fres, population="FSC-H-SSC-H-")
split(dat, fres, population=list(keep=c("FSC-H-SSC-H-",
"FSC-H-SSC-H+")))
quadraticTransform()
Create the definition of a quadratic transformation function to be applied on a data set
Description
Create the definition of the quadratic Transformation that will be applied
on some parameter via the transform
method. The definition of this
function is currently x <- ax^2 + bx + c
Usage
quadraticTransform(transformationId="defaultQuadraticTransform", a = 1, b = 1, c = 0)
Arguments
Argument | Description |
---|---|
transformationId | character string to identify the transformation |
a | double that corresponds to the quadratic coefficient in the equation |
b | double that corresponds to the linear coefficient in the equation |
c | double that corresponds to the intercept in the equation |
Value
Returns an object of class transform
.
Seealso
Other Transform functions: arcsinhTransform
,
biexponentialTransform
,
inverseLogicleTransform
,
linearTransform
, lnTransform
,
logTransform
,
logicleTransform
,
scaleTransform
,
splitScaleTransform
,
truncateTransform
Author
N. Le Meur
Examples
samp <- read.FCS(system.file("extdata",
"0877408774.B08", package="flowCore"))
quadTrans <- quadraticTransform(transformationId="Quadratic-transformation", a=1, b=1, c=0)
dataTransform <- transform(samp, transformList('FSC-H', quadTrans))
quadratic_class()
Class "quadratic"
Description
Quadratic transform class which represents a transformation defined by the function $$f(parameter,a)=a*parameter^2$$
Seealso
dg1polynomial,ratio,squareroot
Other mathematical transform classes: EHtrans-class
,
asinht-class
,
asinhtGml2-class
,
dg1polynomial-class
,
exponential-class
,
hyperlog-class
,
hyperlogtGml2-class
,
invsplitscale-class
,
lintGml2-class
,
logarithm-class
,
logicletGml2-class
,
logtGml2-class
, ratio-class
,
ratiotGml2-class
,
sinht-class
,
splitscale-class
,
squareroot-class
,
unitytransform-class
Note
The quadratic transformation object can be evaluated using the eval method by passing the data frame as an argument.The transformed parameters are returned as a column vector. (See example below)
Author
Gopalakrishnan N, F.Hahne
References
Gating-ML Candidate Recommendation for Gating Description in Flow Cytometry V 1.5
Examples
dat <- read.FCS(system.file("extdata","0877408774.B08",
package="flowCore"))
quad1<-quadratic(parameters="FSC-H",a=2,transformationId="quad1")
transOut<-eval(quad1)(exprs(dat))
randomFilterResult_class()
Class "randomFilterResult"
Description
Container to store the result of applying a filter
on a
flowFrame
object, with the population membership considered to be
stochastic rather than absolute. Currently not utilized.
Seealso
Author
B. Ellis
ratio_class()
Class "ratio"
Description
ratio transform calculates the ratio of two parameters defined by the function $$f(parameter_1,parameter_2)=rac{parameter_1}{parameter_2}$$
Seealso
dg1polynomial,quadratic,squareroot
Other mathematical transform classes: EHtrans-class
,
asinht-class
,
asinhtGml2-class
,
dg1polynomial-class
,
exponential-class
,
hyperlog-class
,
hyperlogtGml2-class
,
invsplitscale-class
,
lintGml2-class
,
logarithm-class
,
logicletGml2-class
,
logtGml2-class
,
quadratic-class
,
ratiotGml2-class
,
sinht-class
,
splitscale-class
,
squareroot-class
,
unitytransform-class
Note
The ratio transformation object can be evaluated using the eval method by passing the data frame as an argument.The transformed parameters are returned as matrix with one column. (See example below)
Author
Gopalakrishnan N, F.Hahne
References
Gating-ML Candidate Recommendation for Gating Description in Flow Cytometry V 1.5
Examples
dat <- read.FCS(system.file("extdata","0877408774.B08",
package="flowCore"))
rat1<-ratio("FSC-H","SSC-H",transformationId="rat1")
transOut<-eval(rat1)(exprs(dat))
ratiotGml2_class()
Class "ratiotGml2"
Description
Ratio transformation as parameterized in Gating-ML 2.0.
Details
ratiotGml2 is defined by the following function:
$$bound(f, boundMin, boundMax) =max(min(f,boundMax),boundMin))$$ where
$$f(p1, p2, A, B, C) = A * (p1 - B) / (p2 - C)$$
If a boundary is defined by the boundMin and/or boundMax parameters, then the result of this transformation is restricted to the [boundMin,boundMax] interval. Specifically, should the result of the f function be less than boundMin, then let the result of this transformation be boundMin. Analogically, should the result of the f function be more than boundMax, then let the result of this transformation be boundMax. The boundMin parameter shall not be greater than the boundMax parameter.
Seealso
ratio
, transform-class
,
transform
Other mathematical transform classes: EHtrans-class
,
asinht-class
,
asinhtGml2-class
,
dg1polynomial-class
,
exponential-class
,
hyperlog-class
,
hyperlogtGml2-class
,
invsplitscale-class
,
lintGml2-class
,
logarithm-class
,
logicletGml2-class
,
logtGml2-class
,
quadratic-class
, ratio-class
,
sinht-class
,
splitscale-class
,
squareroot-class
,
unitytransform-class
Note
The ratiotGml2 transformation object can be evaluated using the eval method by passing the data frame as an argument. The transformed parameters are returned as matrix with one column. (See example below)
Author
Spidlen, J.
References
Gating-ML 2.0: International Society for Advancement of Cytometry (ISAC) standard for representing gating descriptions in flow cytometry. http://flowcyt.sourceforge.net/gating/20141009.pdf
Examples
myDataIn <- read.FCS(system.file("extdata", "0877408774.B08",
package="flowCore"))
myRatioT <- ratiotGml2("FSC-H", "SSC-H", pA = 2, pB = 3,
pC = -10, transformationId = "myRatioT")
transOut <- eval(myRatioT)(exprs(myDataIn))
readFCS()
Read an FCS file
Description
Check validity and Read Data File Standard for Flow Cytometry
Usage
isFCSfile(files)
read.FCS(filename, transformation="linearize", which.lines=NULL,
alter.names=FALSE, column.pattern=NULL, invert.pattern = FALSE,
decades=0, ncdf = FALSE, min.limit=NULL,
truncate_max_range = TRUE, dataset=NULL, emptyValue=TRUE,
channel_alias = NULL, ...)
Arguments
Argument | Description |
---|---|
filename | Character of length 1: filename |
transformation | An character string that defines the type of transformation. Valid values are linearize (default), linearize-with-PnG-scaling , or scale . The linearize transformation applies the appropriate power transform to the data. The linearize-with-PnG-scaling transformation applies the appropriate power transform for parameters stored on log scale, and also a linear scaling transformation based on the 'gain' (FCS $PnG keywords) for parameters stored on a linear scale. The scale transformation scales all columns to $[0,10^decades]$. defaulting to decades=0 as in the FCS4 specification. A logical can also be used: TRUE is equal to linearize and FALSE (or NULL ) corresponds to no transformation. Also when the transformation keyword of the FCS header is set to "custom" or "applied", no transformation will be used. |
which.lines | Numeric vector to specify the indices of the lines to be read. If NULL all the records are read, if of length 1, a random sample of the size indicated by which.lines is read in. It's used to achieve partial disk IO for the large FCS that can't fit the full data into memory. Be aware the potential slow read (especially for the large size of random sampling) due to the frequent disk seek operations. |
alter.names | boolean indicating whether or not we should rename the columns to valid R names using make.names . The default is FALSE. |
column.pattern | An optional regular expression defining parameters we should keep when loading the file. The default is NULL. |
invert.pattern | logical. By default, FALSE . If TRUE , inverts the regular expression specified in column.pattern . This is useful for indicating the channel names that we do not want to read. If column.pattern is set to NULL , this argument is ignored. |
decades | When scaling is activated, the number of decades to use for the output. |
ncdf | Deprecated. Please use 'ncdfFlow' package for cdf based storage. |
min.limit | The minimum value in the data range that is allowed. Some instruments produce extreme artifactual values. The positive data range for each parameter is completely defined by the measurement range of the instrument and all larger values are set to this threshold. The lower data boundary is not that well defined, since compensation might shift some values below the original measurement range of the instrument. This can be set to an arbitrary number or to NULL (the default value), in which case the original values are kept. |
truncate_max_range | logical type. Default is TRUE. can be optionally turned off to avoid truncating the extreme positive value to the instrument measurement range .i.e.'$PnR'. |
dataset | The FCS file specification allows for multiple data segments in a single file. Since the output of read.FCS is a single flowFrame we can't automatically read in all available sets. This parameter allows to chose one of the subsets for import. Its value is supposed to be an integer in the range of available data sets. This argument is ignored if there is only a single data segment in the FCS file. |
emptyValue | boolean indicating whether or not we allow empty value for keyword values in TEXT segment. It affects how the double delimiters are treated. IF TRUE, The double delimiters are parsed as a pair of start and end single delimiter for an empty value. Otherwise, double delimiters are parsed one part of string as the keyword value. default is TRUE. |
channel_alias | a data.frame used to provide the alias of the channels to standardize and solve the discrepancy across FCS files.It is expected to contain 'alias' and 'channels' column. Each row/entry specifies the common alias name for a collection of channels (comma separated). See examples for details. |
... | ignore.text.offset: whether to ignore the keyword values in TEXT segment when they don't agree with the HEADER. Default is FALSE, which throws the error when such discrepancy is found. User can turn it on to ignore TEXT segment when he is sure of the accuracy of HEADER so that the file still can be read. |
files | A vector of filenames |
Details
The function isFCSfile
determines whether its arguments are valid FCS
files.
The function read.FCS
works with the output of the FACS machine
software from a number of vendors (FCS 2.0, FCS 3.0 and List Mode Data LMD).
However, the FCS 3.0 standard includes some options that are not yet
implemented in this function. If you need extensions, please let me know.
The output of the function is an object of class flowFrame
.
For specifications of FCS 3.0 see http://www.isac-net.org and the file
../doc/fcs3.html in the doc
directory of the package.
The which.lines
arguments allow you to read a subset of the record as
you might not want to read the thousands of events recorded in the FCS file.
It is mainly used when there is not enough memory to read one single FCS
(which probably will not happen). It will probably take more time than
reading the entire FCS (due to the multiple disk IO).
Value
isFCSfile
returns a logical vector.
read.FCS
returns an object of class
flowFrame
that contains the data in
the exprs
slot, the parameters monitored in the parameters
slot and the keywords and value saved in the header of the FCS file.
Seealso
Author
F. Hahne, N.Le Meur
Examples
## a sample file
fcsFile <- system.file("extdata", "0877408774.B08", package="flowCore")
## read file and linearize values
samp <- read.FCS(fcsFile, transformation="linearize")
exprs(samp[1:3,])
description(samp)[3:6]
class(samp)
## Only read in lines 2 to 5
subset <- read.FCS(fcsFile, which.lines=2:5, transformation="linearize")
exprs(subset)
## Read in a random sample of 100 lines
subset <- read.FCS(fcsFile, which.lines=100, transformation="linearize")
nrow(subset)
#manually supply the alias vs channel options mapping as a data.frame
map <- data.frame(alias = c("A", "B")
, channels = c("FL2", "FL4")
)
fr <- read.FCS(fcsFile, channel_alias = map)
fr
readFCSheader()
Read the TEXT section of a FCS file
Description
Read (part of) the TEXT section of a Data File Standard for Flow Cytometry that contains FACS keywords.
Usage
read.FCSheader(files, path = ".", keyword = NULL, emptyValue = TRUE)
Arguments
Argument | Description |
---|---|
files | Character vector of filenames. |
path | Directory where to look for the files. |
keyword | An optional character vector that specifies the FCS keyword to read. |
emptyValue | see link[flowCore]{read.FCS} |
Details
The function read.FCSheader
works with the output of the FACS machine
software from a number of vendors (FCS 2.0, FCS 3.0 and List Mode Data LMD).
The output of the function is the TEXT section of the FCS files. The user
can specify some keywords to limit the output to the information of
interest.
Value
A list of character vectors. Each element of the list correspond to one FCS file.
Seealso
link[flowCore]{read.flowSet}
,
link[flowCore]{read.FCS}
Author
N.Le Meur
Examples
samp <- read.FCSheader(system.file("extdata",
"0877408774.B08", package="flowCore"))
samp
samp <- read.FCSheader(system.file("extdata",
"0877408774.B08", package="flowCore"), keyword=c("$DATE", "$FIL"))
samp
readflowSet()
Read a set of FCS files
Description
Read one or several FCS files: Data File Standard for Flow Cytometry
Usage
read.flowSet(files=NULL, path=".", pattern=NULL, phenoData,
descriptions,name.keyword, alter.names=FALSE,
transformation = "linearize", which.lines=NULL,
column.pattern = NULL, invert.pattern = FALSE, decades=0, sep=" ",
as.is=TRUE, name, ncdf=FALSE, dataset=NULL, min.limit=NULL,
truncate_max_range = TRUE, emptyValue=TRUE,
ignore.text.offset = FALSE, channel_alias = NULL, list())
Arguments
Argument | Description |
---|---|
files | Optional character vector with filenames. |
path | Directory where to look for the files. |
pattern | This argument is passed on to dir , see details. |
phenoData | An object of class AnnotatedDataFrame , character or a list of values to be extracted from the flowFrame object, see details. |
descriptions | Character vector to annotate the object of class flowSet . |
name.keyword | An optional character vector that specifies which FCS keyword to use as the sample names. If this is not set, the GUID of the FCS file is used for sampleNames, and if that is not present (or not unique), then the file names are used. |
alter.names | see read.FCS for details. |
transformation | see read.FCS for details. |
which.lines | see read.FCS for details. |
column.pattern | see read.FCS for details. |
invert.pattern | see read.FCS for details. |
decades | see read.FCS for details. |
sep | Separator character that gets passed on to read.AnnotatedDataFrame . |
as.is | Logical that gets passed on to read.AnnotatedDataFrame . This controls the automatic coercion of characters to factors in the phenoData slot. |
name | An optional character scalar used as name of the object. |
ncdf | Deprecated. Please refer to 'ncdfFlow' package for cdf based storage. |
dataset | see read.FCS for details. |
min.limit | see read.FCS for details. |
truncate_max_range | see read.FCS for details. |
emptyValue | see read.FCS for details. |
ignore.text.offset | see read.FCS for details. |
channel_alias | see read.FCS for details. |
list() | Further arguments that get passed on to read.AnnotatedDataFrame , see details. |
truncate.max.range | see link[flowCore]{read.FCS} for details. |
Details
There are four different ways to specify the file from which data is to be imported:
First, if the argument phenoData
is present and is of class
AnnotatedDataFrame
, then the
file names are obtained from its sample names (i.e. row names of the
underlying data.frame). Also column name
will be generated based on
sample names if it is not there. This column is mainly used by visualization
methods in flowViz. Alternatively, the argument phenoData
can be of
class character
, in which case this function tries to read a
AnnotatedDataFrame
object from the file with that name by calling
read.AnnotatedDataFrame
.
In some cases the file names are not a reasonable selection criterion and the user might want to import files based on some keywords within the file. One or several keyword value pairs can be given as the phenoData argument in form of a named list.
Third, if the argument phenoData
is not present and the argument
files
is not NULL
, then files
is expected to be a
character vector with the file names.
Fourth, if neither the argument phenoData
is present nor files
is not NULL
, then the file names are obtained by calling
dir(path, pattern)
.
Value
An object of class flowSet
.
Author
F. Hahne, N.Le Meur, B. Ellis
Examples
fcs.loc <- system.file("extdata",package="flowCore")
file.location <- paste(fcs.loc, dir(fcs.loc), sep="/")
samp <- read.flowSet(file.location[1:3])
rectangleGate_class()
Class "rectangleGate"
Description
Class and constructor for n-dimensional rectangular filter objects.
Usage
rectangleGate(list(), .gate, filterId="defaultRectangleGate")
Arguments
Argument | Description |
---|---|
filterId | An optional parameter that sets the filterId of this gate. The object can later be identified by this name. |
.gate | A definition of the gate. This can be either a list, or a matrix, as described below. |
list() | You can also directly provide the boundaries of a rectangleGate as additional named arguments, as described below. |
Details
This class describes a rectangular region in n dimensions, which is a
Cartesian product of n
orthogonal intervals in these dimensions.
n=1
corresponds to a range gate, n=2
to a rectangle gate,
n=3
corresponds to a box region and n>3
to a hyper-rectangular
regions. Intervals may be open on one side, in which case the value for the
boundary is supposed to be Inf
or -Inf
, respectively.
rectangleGates
are inclusive, that means that events on the
boundaries are considered to be in the gate.
The constructor is designed to be useful in both direct and programmatic
usage. To use it programmatically, you may either construct a named list or
you may construct a matrix with n
columns and 2
rows. The
first row corresponds to the minimal value for each parameter while the
second row corresponds to the maximal value for each parameter. The names
of the parameters are taken from the column names or from the list names,
respectively. Alternatively, the boundaries of the rectangleGate
can
be given as additional named arguments, where each of these arguments should
be a numeric vector of length 2
; the function tries to collapse these
boundary values into a matrix.
Note that boundaries of rectangleGates
where min > max
are
syntactically valid, however when evaluated they will always be empty.
rectangleGate
objects can also be multiplied using the *
operator, provided that both gates have orthogonal axes. This results in
higher-dimensional rectangleGates
. The inverse operation of
subsetting by parameter name(s) is also available.
Evaluating a rectangleGate
generates an object of class
logicalFilterResult . Accordingly, rectangleGates
can be used to subset and to split flow cytometry data sets.
Value
Returns a rectangleGate
object for use in filtering
flowFrame
s or other flow cytometry objects.
Seealso
flowFrame
, polygonGate
,
ellipsoidGate
, polytopeGate
,
filter
for evaluation of rectangleGates
and
split
and Subset
for splitting and subsetting of
flow cytometry data sets based on that.
Other Gate classes: ellipsoidGate-class
,
polygonGate-class
,
polytopeGate-class
,
quadGate-class
Note
See the documentation in the flowViz
package for details on plotting of rectangleGates
.
Author
F.Hahne, B. Ellis N. Le Meur
Examples
## Loading example data
dat <- read.FCS(system.file("extdata","0877408774.B08",
package="flowCore"))
#Create directly. Most likely from a command line
rectangleGate(filterId="myRectGate", "FSC-H"=c(200, 600), "SSC-H"=c(0, 400))
#To facilitate programmatic construction we also have the following
rg <- rectangleGate(filterId="myRectGate", list("FSC-H"=c(200, 600),
"SSC-H"=c(0, 400)))
mat <- matrix(c(200, 600, 0, 400), ncol=2, dimnames=list(c("min", "max"),
c("FSC-H", "SSC-H")))
rg <- rectangleGate(filterId="myRectGate", .gate=mat)
## Filtering using rectangleGates
fres <- filter(dat, rg)
fres
summary(fres)
## The result of rectangle filtering is a logical subset
Subset(dat, fres)
## We can also split, in which case we get those events in and those
## not in the gate as separate populations
split(dat, fres)
## Multiply rectangle gates
rg1 <- rectangleGate(filterId="FSC-", "FSC-H"=c(-Inf, 50))
rg2 <- rectangleGate(filterId="SSC+", "SSC-H"=c(50, Inf))
rg1 * rg2
## Subset rectangle gates
rg["FSC-H"]
##2d rectangleGate can be coerced to polygonGate
as(rg, "polygonGate")
rotate_gate()
Simplified geometric rotation of gates
Description
Rotate a Gate-type filter object through a specified angle
Usage
list(list("rotate_gate"), list("default"))(obj, deg = NULL, rot_center = NULL, ...)
Arguments
Argument | Description |
---|---|
obj | An ellipsoidGate or polygonGate |
deg | An angle in degrees by which the gate should be rotated in the counter-clockwise direction |
rot_center | A separate 2-dimensional center of rotation for the gate, if desired. By default, this will be the center for ellipsoidGate objects or the centroid for polygonGate objects. The rot_center argument is currently only supported for polygonGate objects. |
list() | Additional arguments not used |
Details
This method allows for 2-dimensional geometric rotation of filter types defined by simple geometric gates
( ellipsoidGate , and polygonGate ). The method is not defined
for rectangleGate
or quadGate
objects, due to their definition as having 1-dimensional boundaries.
Further, keep in mind that the 2-dimensional rotation takes place in the plane where the dimensions
of the two variables are evenly linearly scaled. Displaying a rotated ellipse in a plot where the axes are not scaled
evenly may make it appear that the ellipse has been distorted even though this is not the case.
The angle provided in the deg
argument should be in degrees rather than radians. By default, the rotation
will be performed around the center of an ellipsoidGate
or the centroid of the area encompassed by
a polygonGate
. The rot_center
argument allows for specification of a different center of rotation
for polygonGate
objects (it is not yet implemented for ellipsoidGate
objects) but
it is usually simpler to perform a rotation and a translation individually than to manually specify
the composition as a rotation around a shifted center.
Value
A Gate-type filter
object of the same type as gate
, with the rotation applied
Examples
#' # Rotates the original gate 15 degrees counter-clockwise
rotated_gate <- rotate_gate(original_gate, deg = 15)
# Rotates the original gate 270 degrees counter-clockwise
rotated_gate <- rotate_gate(original_gate, 270)
sampleFilter_class()
Class "sampleFilter"
Description
This non-parameter filter selects a number of events from the primary
flowFrame
.
Usage
sampleFilter(size, filterId="defaultSampleFilter")
Arguments
Argument | Description |
---|---|
filterId | An optional parameter that sets the filterId of this filter . The object can later be identified by this name. |
size | The number of events to select. |
Details
Selects a number of events without replacement from a flowFrame
.
Value
Returns a sampleFilter
object for use in filtering
flowFrame
s or other flow cytometry objects.
Seealso
flowFrame
, filter
for evaluation of
sampleFilters
and split
and Subset
for
splitting and subsetting of flow cytometry data sets based on that.
Author
B. Ellis, F.Hahne
Examples
## Loading example data
dat <- read.FCS(system.file("extdata","0877408774.B08",
package="flowCore"))
#Create the filter
sf <- sampleFilter(filterId="mySampleFilter", size=500)
sf
## Filtering using sampleFilters
fres <- filter(dat, sf)
fres
summary(fres)
## The result of sample filtering is a logical subset
Subset(dat, fres)
## We can also split, in which case we get those events in and those
## not in the gate as separate populations
split(dat, fres)
scaleTransform()
Create the definition of a scale transformation function to be applied on a data set
Description
Create the definition of the scale Transformation that will be applied on
some parameter via the transform
method. The definition of this
function is currently x = (x-a)/(b-a). The transformation would normally be
used to convert to a 0-1 scale. In this case, b would be the maximum
possible value and a would be the minimum possible value.
Usage
scaleTransform(transformationId="defaultScaleTransform", a, b)
Arguments
Argument | Description |
---|---|
transformationId | character string to identify the transformation |
a | double that corresponds to the value that will be transformed to 0 |
b | double that corresponds to the value that will be transformed to 1 |
Value
Returns an object of class transform
.
Seealso
Other Transform functions: arcsinhTransform
,
biexponentialTransform
,
inverseLogicleTransform
,
linearTransform
, lnTransform
,
logTransform
,
logicleTransform
,
quadraticTransform
,
splitScaleTransform
,
truncateTransform
Author
P. Haaland
Examples
samp <- read.FCS(system.file("extdata",
"0877408774.B08", package="flowCore"))
scaleTrans <- scaleTransform(transformationId="Truncate-transformation", a=1, b=10^4)
dataTransform <- transform(samp, transformList('FSC-H', scaleTrans))
scale_gate()
Simplified geometric scaling of gates
Description
Scale a Gate-type filter object in one or more dimensions
Usage
list(list("scale_gate"), list("default"))(obj, scale = NULL, ...)
Arguments
Argument | Description |
---|---|
obj | A Gate-type filter object ( quadGate , rectangleGate , ellipsoidGate , or polygonGate ) |
scale | Either a numeric scalar (for uniform scaling in all dimensions) or numeric vector specifying the factor by which each dimension of the gate should be expanded (absolute value > 1) or contracted (absolute value < 1). Negative values will result in a reflection in that dimension. |
list() | Additional arguments not used |
Details
This method allows uniform or non-uniform geometric scaling of filter types defined by simple geometric gates
( quadGate , rectangleGate , ellipsoidGate , and
polygonGate ) Note that these methods are for manually altering
the geometric definition of a gate. To easily transform the definition of a gate with an accompanyging scale
transformation applied to its underlying data, see rescale_gate
.
The scale
argument passed to scale_gate
should be either a scalar or a vector of the same length
as the number of dimensions of the gate. If it is scalar, all dimensions will be multiplicatively scaled uniformly
by the scalar factor provided. If it is a vector, each dimension will be scaled by its corresponding entry in the vector.
The scaling behavior of scale_gate
depends on the type of gate passed to it. For rectangleGate
and quadGate
objects, this amounts to simply scaling the values of the 1-dimensional boundaries.
For polygonGate
objects, the values of scale
will be used to determine scale factors
in the direction of each of the 2 dimensions of the gate ( scale_gate
is not yet defined
for higher-dimensional polytopeGate
objects). Important: For ellipsoidGate
objects, scale
determines scale factors for the major and minor axes of the ellipse, in that order . Scaling by a negative factor
will result in a reflection in the corresponding dimension.
Value
A Gate-type filter
object of the same type as gate
, with the scaling applied
Examples
# Scales both dimensions by a factor of 5
scaled_gate <- scale_gate(original_gate, 5)
# Shrinks the gate in the first dimension by factor of 1/2
# and expands it in the other dimension by factor of 3
scaled_gate <- scale_gate(original_gate, c(0.5,3))
setOperationFilter_class()
Class "setOperationFilter"
Description
This is a Superclass for the unionFilter, intersectFilter, complementFilter
and subsetFilter classes, which all consist of two or more component filters
| and are constructed using set operators ( &
, |
, !
, and|
%&%
or %subset%
respectively).
Seealso
Other setOperationFilter classes: complementFilter-class
,
intersectFilter-class
,
subsetFilter-class
,
unionFilter-class
Author
B. Ellis
shift_gate()
Simplified geometric translation of gates
Description
Shift a Gate-type filter object in one or more dimensions
Usage
list(list("shift_gate"), list("default"))(obj, dx = NULL, dy = NULL,
center = NULL, ...)
Arguments
Argument | Description |
---|---|
obj | A Gate-type filter object ( quadGate , rectangleGate , ellipsoidGate , or polygonGate ) |
dx | Either a numeric scalar or numeric vector. If it is scalar, this is just the desired shift of the gate in its first dimension. If it is a vector, it specifies both dx and dy as (dx,dy) . This provides an alternate syntax for shifting gates, as well as allowing shifts of ellipsoidGate objects in more than 2 dimensions. |
dy | A numeric scalar specifying the desired shift of the gate in its second dimension. |
center | A numeric vector specifying where the center or centroid should be moved (rather than specifiying dx and/or dy ) |
list() | Additional arguments not used |
Details
This method allows for geometric translation of filter types defined by simple geometric gates
( rectangleGate
, quadGate
, ellipsoidGate , or polygonGate ).
The method provides two approaches to specify a translation. For rectangleGate
objects, this will
shift the min
and max
bounds by the same amount in each specified dimension. For quadGate
objects, this will simply shift the divinding boundary in each dimension. For ellipsoidGate
objects, this
will shift the center (and therefore all points of the ellipse). For polgonGate
objects, this will simply
shift all of the points defining the polygon.
The method allows two different approaches to shifting a gate. Through the dx
and/or dy
arguments,
a direct shift in each dimension can be provided. Alternatively, through the center
argument, the gate
can be directly moved to a new location in relation to the old center of the gate. For quadGate
objects,
this center is the intersection of the two dividing boundaries (so the value of the boundary
slot). For
rectangleGate
objects, this is the center of the rectangle defined by the intersections of the centers
of each interval. For ellipsoidGate
objects, it is the center of the ellipsoid, given by the mean
slot. For polygonGate
objects, the centroid of the old polygon will be calculated and shifted to the new
location provided by center
and all other points on the polygon will be shifted by relation to the centroid.
Value
A Gate-type filter
object of the same type as gate
, with the translation applied
Examples
# Moves the entire gate +500 in its first dimension and 0 in its second dimension
shifted_gate <- shift_gate(original_gate, dx = 500)
#Moves the entire gate +250 in its first dimension and +700 in its second dimension
shifted_gate <- shift_gate(original_gate, dx = 500, dy = 700)
# Same as previous
shifted_gate <- shift_gate(original_gate, c(500,700))
# Move the gate based on shifting its center to (700, 1000)
shifted_gate <- shift_gate(original_gate, center = c(700, 1000))
singleParameterTransform_class()
Class "singleParameterTransform"
Description
A transformation that operates on a single parameter
Author
F Hahne
Examples
showClass("singleParameterTransform")
sinht_class()
Class "sinht"
Description
Hyperbolic sin transform class, which represents a transformation defined by the function:
$$f(parameter,a,b)=sinh(parameter/b)/a$$
This definition is such that it can function as an inverse of asinht using the same definitions of the constants a and b.
Seealso
asinht
Other mathematical transform classes: EHtrans-class
,
asinht-class
,
asinhtGml2-class
,
dg1polynomial-class
,
exponential-class
,
hyperlog-class
,
hyperlogtGml2-class
,
invsplitscale-class
,
lintGml2-class
,
logarithm-class
,
logicletGml2-class
,
logtGml2-class
,
quadratic-class
, ratio-class
,
ratiotGml2-class
,
splitscale-class
,
squareroot-class
,
unitytransform-class
Note
The transformation object can be evaluated using the eval method by passing the data frame as an argument.The transformed parameters are returned as a matrix with a single column.(See example below)
Author
Gopalakrishnan N, F.Hahne
References
Gating-ML Candidate Recommendation for Gating Description in Flow Cytometry V 1.5
Examples
dat <- read.FCS(system.file("extdata","0877408774.B08", package="flowCore"))
sinh1<-sinht(parameters="FSC-H",a=1,b=2000,transformationId="sinH1")
transOut<-eval(sinh1)(exprs(dat))
spillover_flowSet()
Compute a spillover matrix from a flowSet
Description
Spillover information for a particular experiment is often obtained by
running several tubes of beads or cells stained with a single color that can
then be used to determine a spillover matrix for use with
compensate
. list() list()
When matching stain channels in x
with the compensation controls, we
provide a few options. If ordered
, we assume the ordering of the
channels in the flowSet object is the same as the ordering of the
compensation-control samples. If regexpr
, we use a regular expression
to match the channel names with the names of each of the compensation control
flowFrame
s (that is, sampleNames(x)
, which will typically be the
filenames passed to read.FCS
).
By default, we must "guess" based on the largest statistic for the
compensation control (i.e., the row). list() list()
Additionally, matching of channels to compensation control files can
be accomplished using the spillover_match
method, which allows
the matches to be specified using a csv file. The flowSet returned
by the spillover_match
method should then be used as the x
argument
to spillover
with prematched = TRUE
.
Usage
list(list("spillover"), list("flowSet"))(x, unstained = NULL, fsc = "FSC-A",
ssc = "SSC-A", patt = NULL, method = "median",
stain_match = c("intensity", "ordered", "regexpr"),
useNormFilt=FALSE, prematched = FALSE)
Arguments
Argument | Description |
---|---|
x | A flowSet of compensation beads or cells |
unstained | The name or index of the unstained negative control |
fsc | The name or index of the forward scatter parameter |
ssc | The name or index of the side scatter parameter |
patt | An optional regular expression defining which parameters should be considered |
method | The statistic to use for calculation. Traditionally, this has been the median so it is the default. The mean is sometimes more stable. |
stain_match | Determines how the stain channels are matched with the compensation controls. See details. |
useNormFilt | logical Indicating whether to apply a norm2Filter first before computing the spillover |
prematched | a convenience argument specifying if the channels have already been matched by spillover_match. This will override the values of unstained and stain_match with unstained = "unstained" and stain_match = "regexpr". |
Details
The algorithm used is fairly simple. First, using the scatter parameters, we restrict ourselves to the most closely clustered population to reduce the amount of debris. The selected statistic is then calculated on all appropriate parameters and the unstained values swept out of the matrix. Every sample is then normalized to [0,1] with respect to the maximum value of the sample, giving the spillover in terms of a proportion of the primary channel intensity.
Value
A matrix for each of the parameters
Seealso
Author
B. Ellis, J. Wagner
References
C. B. Bagwell & E. G. Adams (1993). Fluorescence spectral overlap compensation for any number of flow cytometry parameters. in: Annals of the New York Academy of Sciences, 677:167-184.
spillover_match_flowSet()
Construct a flowSet
for use with spillover
by matching channel
names to compensation control filenames
Description
Spillover information for a particular experiment is often obtained by
running several tubes of beads or cells stained with a single color that can
then be used to determine a spillover matrix for use with
compensate
. list() list()
This method facilitates construction of a flowSet
of compensation
control flowFrame
s using a simple file linking filenames to channels.
This resulting flowSet
can then be used with spillover
using the option prematched = TRUE
. list() list()
Matching stain channels to compensation controls is done via a csv
file ( matchfile
) with columns 'filename' and 'channel'. The 'channel' entries should
exactly match the channel names in the FCS files. The 'filename' should be
the FCS file name of each compensation control which should also be the
corresponding sample name in the flowSet
. There should also be one unstained
control with the 'channel' entry of 'unstained'. list() list()
The method also allows for x
to be missing if path
is provided,
pointing to a directory containing the control FCS files. list() list()
Usage
list(list("spillover_match"), list("flowSet"))(x, fsc = "FSC-A", ssc = "SSC-A",
matchfile = NULL, path)
list(list("spillover_match"), list("missing"))(x, fsc = "FSC-A", ssc = "SSC-A",
matchfile, path)
Arguments
Argument | Description |
---|---|
x | A flowSet of compensation beads or cells |
fsc | The name or index of the forward scatter parameter |
ssc | The name or index of the side scatter parameter |
matchfile | The name or path of the csv file holding the compensation control file to channel matching information. |
path | The name or path of the directory containing the control FCS files to be matched to channels by matchfile. |
Value
A flowSet
with the sample names of its flowFrames
corresponding to the channels specified by the matchfile.
Seealso
Author
B. Ellis, J. Wagner
splitScaleTransform()
Compute the split-scale transformation describe by FL. Battye
Description
The split scale transformation described by Francis L. Battye [B15] (Figure 13) consists of a logarithmic scale at high values and a linear scale at low values with a fixed transition point chosen so that the slope (first derivative) of the transform is continuous at that point. The scale extends to the negative of the transition value that is reached at the bottom of the display.
Usage
splitScaleTransform(transformationId="defaultSplitscaleTransform",
maxValue=1023, transitionChannel=64, r=192)
Arguments
Argument | Description |
---|---|
transformationId | A name to assign to the transformation. Used by the transform/filter integration routines. |
maxValue | Maximum value the transformation is applied to, e.g., 1023 |
transitionChannel | Where to split the linear versus the logarithmic transformation, e.g., 64 |
r | Range of the logarithm part of the display, ie. it may be expressed as the maxChannel - transitionChannel considering the maxChannel as the maximum value to be obtained after the transformation. |
Value
Returns values giving the inverse of the biexponential within a
certain tolerance. This function should be used with care as numerical
inversion routines often have problems with the inversion process due to the
large range of values that are essentially 0. Do not be surprised if you end
up with population splitting about w
and other odd artifacts.
Seealso
Other Transform functions: arcsinhTransform
,
biexponentialTransform
,
inverseLogicleTransform
,
linearTransform
, lnTransform
,
logTransform
,
logicleTransform
,
quadraticTransform
,
scaleTransform
,
truncateTransform
Author
N. LeMeur
References
Battye F.L. A Mathematically Simple Alternative to the Logarithmic Transform for Flow Cytometric Fluorescence Data Displays. http://www.wehi.edu.au/cytometry/Abstracts/AFCG05B.html.
Examples
data(GvHD)
ssTransform <- splitScaleTransform("mySplitTransform")
after.1 <- transform(GvHD, transformList('FSC-H', ssTransform))
opar = par(mfcol=c(2, 1))
plot(density(exprs(GvHD[[1]])[, 1]), main="Original")
plot(density(exprs(after.1[[1]])[, 1]), main="Split-scale Transform")
split_methods()
Methods to split flowFrames and flowSets according to filters
Description
Divide a flow cytometry data set into several subset according to the results of a filtering operation. There are also methods available to split according to a factor variable.
Details
The splitting operation in the context of flowFrame s and flowSet s is the logical extension of subsetting. While the latter only returns the events contained within a gate, the former splits the data into the groups of events contained within and those not contained within a particular gate. This concept is extremely useful in applications where gates describe the distinction between positivity and negativity for a particular marker.
The flow data structures in flowCore
can be split into subsets on
various levels:
flowFrame : row-wise splitting of the raw data. In most cases, this will be done according to the outcome of a filtering operation, either using a filter that identifiers more than one sub-population or by a logical filter, in which case the data is split into two populations: "in the filter" and "not in the filter". In addition, the data can be split according to a factor (or a numeric or character vector that can be coerced into a factor).
flowSet : can be either split into subsets of flowFrame s according to a factor or a vector that can be coerced into a factor, or each individual flowFrame into subpopulations based on the filter s or filterResult s provided as a list of equal length.
Splitting has a special meaning for filters that result in
multipleFilterResult s or
manyFilterResult s, in which case simple subsetting
doesn't make much sense (there are multiple populations that are defined by
the gate and it is not clear which of those should be used for the
subsetting operation). Accordingly, splitting of multipleFilterResults
creates multiple subsets. The argument population
can be used to
limit the output to only one or some of the resulting subsets. It takes as
values a character vector of names of the populations of interest. See the
documentation of the different filter classes on how population names can be
defined and the respective default values. For splitting of
logicalFilterResult s, the population
argument
can be used to set the population names since there is no reasonable default
other than the name of the gate. The content of the argument prefix
will be prepended to the population names and '+' or '-' are finally
appended allowing for more flexible naming schemes.
The default return value for any of the split
methods is a list, but
the optional logical argument flowSet
can be used to return a
flowSet instead. This only applies when splitting
flowFrame s, splitting of flowSet s
always results in lists of flowSet objects.
Author
F Hahne, B. Ellis, N. Le Meur
Examples
data(GvHD)
qGate <- quadGate(filterId="qg", "FSC-H"=200, "SSC-H"=400)
## split a flowFrame by a filter that creates
## a multipleFilterResult
samp <- GvHD[[1]]
fres <- filter(samp, qGate)
split(samp, qGate)
## return a flowSet rather than a list
split(samp, fres, flowSet=TRUE)
## only keep one population
names(fres)
##split(samp, fres, population="FSC-Height+SSC-Height+")
## split the whole set, only keep two populations
##split(GvHD, qGate, population=c("FSC-Height+SSC-Height+",
##"FSC-Height-SSC-Height+"))
## now split the flowSet according to a factor
split(GvHD, pData(GvHD)$Patient)
splitscale_class()
Class "splitscale"
Description
The split scale transformation class defines a transformation that has a logarithmic scale at high values and a linear scale at low values. The transition points are chosen so that the slope of the transformation is continuous at the transition points.
Details
The split scale transformation is defined by the function
$$f(parameter,r,maxValue,transitionChannel) = a*parameter+ b, parameter<=t$$
$$(parameter,r,maxValue,transitionChannel) = log_{10}(cparameter)rac{r}{d}, parameter > t$$ where,
$$b=rac{transitionChannel}{2}$$
$$d=rac{2log_{10}(e)r}{transitionChannel} + log_{10}(maxValue)$$
$$t=10^{log_{10}t}$$
$$a= rac{transitionChannel}{2*t}$$
$$log_{10}ct=rac{(at+b)d}{r}$$
$$c=10^{log_{10}ct}$$
Seealso
invsplitscale
Other mathematical transform classes: EHtrans-class
,
asinht-class
,
asinhtGml2-class
,
dg1polynomial-class
,
exponential-class
,
hyperlog-class
,
hyperlogtGml2-class
,
invsplitscale-class
,
lintGml2-class
,
logarithm-class
,
logicletGml2-class
,
logtGml2-class
,
quadratic-class
, ratio-class
,
ratiotGml2-class
,
sinht-class
,
squareroot-class
,
unitytransform-class
Note
The transformation object can be evaluated using the eval method by passing the data frame as an argument.The transformed parameters are returned as a matrix with a single column. (See example below)
Author
Gopalakrishnan N, F.Hahne
References
Gating-ML Candidate Recommendation for Gating Description in Flow Cytometry
Examples
dat <- read.FCS(system.file("extdata","0877408774.B08",package="flowCore"))
sp1<-splitscale("FSC-H",r=768,maxValue=10000,transitionChannel=256)
transOut<-eval(sp1)(exprs(dat))
squareroot_class()
Class "squareroot"
Description
Square root transform class, which represents a transformation defined by the function |$$f(parameter,a)= qrt{ |{rac{parameter}{a}|}}$$|
Seealso
dg1polynomial, ratio, quadratic
Other mathematical transform classes: EHtrans-class
,
asinht-class
,
asinhtGml2-class
,
dg1polynomial-class
,
exponential-class
,
hyperlog-class
,
hyperlogtGml2-class
,
invsplitscale-class
,
lintGml2-class
,
logarithm-class
,
logicletGml2-class
,
logtGml2-class
,
quadratic-class
, ratio-class
,
ratiotGml2-class
,
sinht-class
,
splitscale-class
,
unitytransform-class
Note
The squareroot transformation object can be evaluated using the eval method by passing the data frame as an argument.The transformed parameters are returned as a column vector. (See example below)
Author
Gopalakrishnan N, F.Hahne
References
Gating-ML Candidate Recommendation for Gating Description in Flow Cytometry
Examples
dat <- read.FCS(system.file("extdata","0877408774.B08",
package="flowCore"))
sqrt1<-squareroot(parameters="FSC-H",a=2,transformationId="sqrt1")
transOut<-eval(sqrt1)(exprs(dat))
subsetFilter_class()
Class subsetFilter
Description
This class represents the action of applying a filter on the subset of data resulting from another filter. This is itself a filter that can be incorporated in to further set operations. This is similar to an intersectFilter, with behavior only differing if the component filters are data-driven.
Details
subsetFilter
s are constructed using the equivalent binary set operators
"%&%"
or "%subset%"
. The operator is not symmetric, as the
filter on the right-hand side will take the subset of the filter on the
left-hand side as input. Left-hand side operands can be a filter or list of
filters, while the right-hand side operand must be a single
filter.
Seealso
filter
, setOperationFilter
Other setOperationFilter classes: complementFilter-class
,
intersectFilter-class
,
setOperationFilter-class
,
unionFilter-class
Author
B. Ellis
summarizeFilter_methods()
Methods for function summarizeFilter
Description
Internal methods to populate the filterDetails
slot of a
filterResult
object.
Usage
summarizeFilter(result, filter)
Arguments
Argument | Description |
---|---|
result | A filterResult (or one of its derived classes) representing the result of a filtering operation in whose filterDetails slot the information will be stored. |
filter | The corresponding filter (or one of its derived classes). |
timeFilter_class()
Class "timeFilter"
Description
Define a filter
that removes stretches of unusual data
distribution within a single parameter over time. This can be used to
correct for problems during data acquisition like air bubbles or clods.
Usage
timeFilter(..., bandwidth=0.75, binSize, timeParameter,
filterId="defaultTimeFilter")
Arguments
Argument | Description |
---|---|
list() | The names of the parameters on which the filter is supposed to work on. Names can either be given as individual arguments, or as a list or a character vector. |
filterId | An optional parameter that sets the filterId slot of this gate. The object can later be identified by this name. |
bandwidth, binSize | Numerics used to set the bandwidth and binSize slots of the object. |
timeParameter | Character used to set the timeParameter slot of the object. |
Details
Clods and disturbances in the laminar flow of a FACS instrument can cause
temporal aberrations in the data acquisition that lead to artifactual
values. timeFilters
try to identify such stretches of disturbance by
computing local variance and location estimates and to remove them from the
data.
Value
Returns a timeFilter object for use in filtering
flowFrame
s or other flow cytometry objects.
Seealso
flowFrame
, filter
for
evaluation of timeFilters
and split
and
Subset
for splitting and subsetting of flow cytometry data sets
based on that.
Note
See the documentation of timeLinePlot
in
the flowViz
package for details on
visualizing temporal problems in flow cytometry data.
Author
Florian Hahne
Examples
## Loading example data
data(GvHD)
dat <- GvHD[1:10]
## create the filter
tf <- timeFilter("SSC-H", bandwidth=1, filterId="myTimeFilter")
tf
## Visualize problems
library(flowViz)
timeLinePlot(dat, "SSC-H")
## Filtering using timeFilters
fres <- filter(dat, tf)
fres[[1]]
summary(fres[[1]])
summary(fres[[7]])
## The result of rectangle filtering is a logical subset
cleanDat <- Subset(dat, fres)
## Visualizing after cleaning up
timeLinePlot(cleanDat, "SSC-H")
## We can also split, in which case we get those events in and those
## not in the gate as separate populations
allDat <- split(dat[[7]], fres[[7]])
par(mfcol=c(1,3))
plot(exprs(dat[[7]])[, "SSC-H"], pch=".")
plot(exprs(cleanDat[[7]])[, "SSC-H"], pch=".")
plot(exprs(allDat[[2]])[, "SSC-H"], pch=".")
transformFilter_class()
A class for encapsulating a filter to be performed on transformed parameters
Description
The transformFilter
class is a mechanism for including one or more
variable transformations into the filtering process. Using a special case of
transform
we can introduce
transformations inline with the filtering process eliminating the need to
process flowFrame
objects before
applying a filter.
Seealso
"
, "
,
transform
Author
B. Ellis
Examples
samp <- read.FCS(system.file("extdata", "0877408774.B08", package="flowCore"))
## Gate this object after log transforming the forward and side
## scatter variables
filter(samp, norm2Filter("FSC-H", "SSC-H", scale.factor=2)
%on% transform("FSC-H"=log,"SSC-H"=log))
transformList_class()
Class "transformList"
Description
A list of transformMaps to be applied to a list of parameters.
Usage
transformList(from, tfun, to=from, transformationId =
"defaultTransformation")
Arguments
Argument | Description |
---|---|
from, to | Characters giving the names of the measurement parameter on which to transform on and into which the result is supposed to be stored. If both are equal, the existing parameters will be overwritten. |
tfun | A list if functions or a character vector of the names of the functions used to transform the data. R's recycling rules apply, so a single function can be given to be used on all parameters. |
transformationId | The identifier for the object. |
Seealso
Author
B. Ellis, F. Hahne
Examples
tl <- transformList(c("FSC-H", "SSC-H"), list(log, asinh))
colnames(tl)
c(tl, transformList("FL1-H", "linearTransform"))
data(GvHD)
transform(GvHD[[1]], tl)
transformMap_class()
A class for mapping transforms between parameters
Description
This class provides a mapping between parameters and transformed parameters via a function.
Seealso
Author
B. Ellis, F. Hahne
Examples
new("transformMap", input="FSC-H", output="FSC-H", f=log)
transformReference_class()
Class "transformReference"
Description
Class allowing for reference of transforms, for instance as parameters.
Author
N. Gopalakrishnan
transform_class()
'transform': a class for transforming flow-cytometry data by applying scale factors.
Description
Transform objects are simply functions that have been extended to allow for
specialized dispatch. All of the `...Transform'' constructors return functions of this type for use in one of the transformation modalities. ## Seealso [
linearTransform](#lineartransform) , [
lnTransform](#lntransform) , [
logicleTransform](#logicletransform) , [
biexponentialTransform](#biexponentialtransform) , [
arcsinhTransform](#arcsinhtransform) , [
quadraticTransform](#quadratictransform) , [
logTransform`](#logtransform)
## Author
N LeMeur
## Examples
r cosTransform <- function(transformId, a=1, b=1){ t = new("transform", .Data = function(x) cos(a*x+b)) t@transformationId = transformId t } cosT <- cosTransform(transformId="CosT",a=2,b=1) summary(cosT)
transform_gate()
Simplified geometric transformation of gates
Description
Perform geometric transformations of Gate-type filter objects
Usage
list(list("transform_gate"), list("default"))(obj, scale = NULL, deg = NULL,
rot_center = NULL, dx = NULL, dy = NULL, center = NULL, ...)
Arguments
Argument | Description |
---|---|
obj | A Gate-type filter object ( quadGate , rectangleGate , ellipsoidGate , or polygonGate ) |
scale | Either a numeric scalar (for uniform scaling in all dimensions) or numeric vector specifying the factor by which each dimension of the gate should be expanded (absolute value > 1) or contracted (absolute value < 1). Negative values will result in a reflection in that dimension. For rectangleGate and quadGate objects, this amounts to simply scaling the values of the 1-dimensional boundaries. For polygonGate objects, the values of scale will be used to determine scale factors in the direction of each of the 2 dimensions of the gate ( scale_gate is not yet defined for higher-dimensional polytopeGate objects). Important: For ellipsoidGate objects, scale determines scale factors for the major and minor axes of the ellipse, in that order. |
deg | An angle in degrees by which the gate should be rotated in the counter-clockwise direction. |
rot_center | A separate 2-dimensional center of rotation for the gate, if desired. By default, this will be the center for ellipsoidGate objects or the centroid for polygonGate objects. The rot_center argument is currently only supported for polygonGate objects. It is also usually simpler to perform a rotation and a translation individually than to manually specify the composition as a rotation around a shifted center. |
dx | Either a numeric scalar or numeric vector. If it is scalar, this is just the desired shift of the gate in its first dimension. If it is a vector, it specifies both dx and dy as (dx,dy) . This provides an alternate syntax for shifting gates, as well as allowing shifts of ellipsoidGate objects in more than 2 dimensions. |
dy | A numeric scalar specifying the desired shift of the gate in its second dimension. |
center | A numeric vector specifying where the center or centroid should be moved (rather than specifiying dx and/or dy ) |
list() | Assignments made to the slots of the particular Gate-type filter object in the form " |
Details
This method allows changes to the four filter types defined by simple geometric gates ( quadGate ,
rectangleGate , ellipsoidGate , and polygonGate ) using
equally simple geometric transformations (shifting/translation, scaling/dilation, and rotation). The method also
allows for directly re-setting the slots of each Gate-type object. Note that these methods are for manually altering
the geometric definition of a gate. To easily transform the definition of a gate with an accompanyging scale
transformation applied to its underlying data, see rescale_gate
.
First, transform_gate
will apply any direct alterations to the slots of the supplied Gate-type filter object.
For example, if " mean = c(1,3)
" is present in the argument list when transform_gate
is called on a
ellipsoidGate
object, the first change applied will be to shift the mean
slot to (1,3)
. The method
will carry over the dimension names from the gate, so there is no need to provide column or row names with arguments
such as mean
or cov
for ellipsoidGate
or boundaries
for polygonGate
.
transform_gate
then passes the geometric arguments ( dx
, dy
, deg
, rot_center
, scale
,
and center
) to the methods which perform each respective type of transformation:
shift_gate
, scale_gate
, or rotate_gate
. The order of operations is to first
scale, then rotate, then shift. The default behavior of each operation follows that of its corresponding method but for
the most part these are what the user would expect. A few quick notes:
rotate_gate
is not defined forrectangleGate
orquadGate
objects, due to their definition as having 1-dimensional boundaries.The default center for both rotation and scaling of a
polygonGate
is the centroid of the polygon. This results in the sort of scaling most users expect, with a uniform scale factor not distorting the shape of the original polygon.
Value
A Gate-type filter
object of the same type as gate
, with the geometric transformations applied
Examples
# Scale the original gate non-uniformly, rotate it 15 degrees, and shift it
transformed_gate <- transform_gate(original_gate, scale = c(2,3), deg = 15, dx = 500, dy = -700)
# Scale the original gate (in this case an ellipsoidGate) after moving its center to (1500, 2000)
transformed_gate <- transform_gate(original_gate, scale = c(2,3), mean = c(1500, 2000))
transformation_class()
Class "transformation"
Description
A virtual class to abstract transformations.
Author
N. Gopalakrishnan
truncateTransform()
Create the definition of a truncate transformation function to be applied on a data set
Description
Create the definition of the truncate Transformation that will be applied on
some parameter via the transform
method. The definition of this
function is currently x[x<a] <- a. Hence, all values less than a are
replaced by a. The typical use would be to replace all values less than 1 by
1.
Usage
truncateTransform(transformationId="defaultTruncateTransform", a=1)
Arguments
Argument | Description |
---|---|
transformationId | character string to identify the transformation |
a | double that corresponds to the value at which to truncate |
Value
Returns an object of class transform
.
Seealso
Other Transform functions: arcsinhTransform
,
biexponentialTransform
,
inverseLogicleTransform
,
linearTransform
, lnTransform
,
logTransform
,
logicleTransform
,
quadraticTransform
,
scaleTransform
,
splitScaleTransform
Author
P. Haaland
Examples
samp <- read.FCS(system.file("extdata",
"0877408774.B08", package="flowCore"))
truncateTrans <- truncateTransform(transformationId="Truncate-transformation", a=5)
dataTransform <- transform(samp,transformList('FSC-H', truncateTrans))
unionFilter_class()
Class unionFilter
Description
This class represents the union of two filters, which is itself a filter
that can be incorporated in to further set operations. unionFilter
s
| are constructed using the binary set operator "|"
with operands|
consisting of a single filter
or list of filters
.
Seealso
filter
, setOperationFilter
Other setOperationFilter classes: complementFilter-class
,
intersectFilter-class
,
setOperationFilter-class
,
subsetFilter-class
Author
B. Ellis
unitytransform_class()
Class "unitytransform"
Description
Unity transform class transforms parameters names provided as characters into unity transform objects which can be evaluated to retrieve the corresponding columns from the data frame
Seealso
dg1polynomial, ratio
Other mathematical transform classes: EHtrans-class
,
asinht-class
,
asinhtGml2-class
,
dg1polynomial-class
,
exponential-class
,
hyperlog-class
,
hyperlogtGml2-class
,
invsplitscale-class
,
lintGml2-class
,
logarithm-class
,
logicletGml2-class
,
logtGml2-class
,
quadratic-class
, ratio-class
,
ratiotGml2-class
,
sinht-class
,
splitscale-class
,
squareroot-class
Author
Gopalakrishnan N, F.Hahne
Examples
dat <- read.FCS(system.file("extdata","0877408774.B08",
package="flowCore"))
un1<-unitytransform(c("FSC-H","SSC-H"),transformationId="un1")
transOut<-eval(un1)(exprs(dat))
updateTransformKeywords()
modify description to reflect the transformation Involve inserting/updating 'transformation' and flowCore_$PnRmax keywords
Description
modify description to reflect the transformation Involve inserting/updating 'transformation' and flowCore_$PnRmax keywords
Usage
updateTransformKeywords(fr)
Arguments
Argument | Description |
---|---|
fr | flowFrame |
Value
updated description slot
validFilters()
Check if all filters in a filters matches same paramters
Description
Check if all filters in a filters matches same paramters
Usage
validFilters(flist)
Arguments
Argument | Description |
---|---|
flist | a filters object |
Value
TRUE or FALSE
writeFCS()
Write an FCS file
Description
Write FCS file from a flowFrame
Usage
|write.FCS(x, filename, what="numeric", delimiter = "|", endian="big")|
Arguments
Argument | Description |
---|---|
x | A flowFrame . |
filename | A character scalar giving the output file name. |
what | A character scalar defining the output data type. One in integer , numeric , double . Note that forcing the data type to integer may result in considerable loss of precision if the data has been transformed. We recommend using the default data type unless disc space is an issue. |
|delimiter
| a single character to separate the FCS keyword/value pairs. Default is : "|"|
|endian
| a character, either "little" or "big" (default), specifying the most significant or least significant byte is stored first in a 32 bit word.|
Details
The function write.FCS
creates FCS 3.0 standard file from an object
of class flowFrame
.
For specifications of FCS 3.0 see http://www.isac-net.org and the file
../doc/fcs3.html in the doc
directory of the package.
Value
A character vector of the file name.
Seealso
link[flowCore]{write.flowSet}
Author
F. Hahne
Examples
## a sample file
inFile <- system.file("extdata", "0877408774.B08", package="flowCore")
foo <- read.FCS(inFile, transform=FALSE)
outFile <- file.path(tempdir(), "foo.fcs")
## now write out into a file
write.FCS(foo, outFile)
bar <- read.FCS(outFile, transform=FALSE)
all(exprs(foo) == exprs(bar))
writeflowSet()
Write an FCS file
Description
Write FCS file for each flowFrame in a flowSet
Usage
write.flowSet(x, outdir=identifier(x), filename, list())
Arguments
Argument | Description |
---|---|
x | A flowSet . |
outdir | A character scalar giving the output directory. As the default, the output of identifier(x) is used. |
filename | A character scalar or vector giving the output file names. By default, the function will use the identifiers of the individual flowFrames as the file name, potentially adding the .fcs suffix unless a file extension is already present. Alternatively, one can supply either a character scalar, in which case the prefix i_ is appended ( i being an integer in seq_len(length(x)) ), or a character vector of the same length as the flowSet x . |
list() | Further arguments that are passed on to write.FCS . |
Details
The function write.flowSet
creates FCS 3.0 standard file for all
flowFrames
in an object of class flowSet
. In addition, it will
write the content of the phenoData
slot in the ASCII file
"annotation.txt"
. This file can subsequently be used to reconstruct
the whole flowSet
using the read.flowSet
function, e.g.:
read.flowSet(path=outdir, phenoData="annotation.txt"
The function uses write.FCS
for the actual writing
of the FCS files.
Value
A character vector of the output directory.
Seealso
link[flowCore]{write.FCS}
Author
F. Hahne
Examples
## sample data
data(GvHD)
foo <- GvHD[1:5]
outDir <- file.path(tempdir(), "foo")
## now write out into files
write.flowSet(foo, outDir)
dir(outDir)
## and read back in
bar <- read.flowSet(path=outDir, phenoData="annotation.txt")