expressionFilter-class.RdA filter holding an expression that can be evaluated to a
logical vector or a vector of factors.
expressionFilter(expr, ..., filterId="defaultExpressionFilter") char2ExpressionFilter(expr, ..., filterId="defaultExpressionFilter")
| filterId | An optional parameter that sets the |
|---|---|
| expr | A valid R expression or a character vector that can be parsed into an expression. |
| ... | Additional arguments that are passed to the evaluation environment of the expression. |
Returns a expressionFilter object for use in filtering
flowFrames or other flow cytometry objects.
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.
exprThe expression that will be evaluated in the context of the flow cytometry values.
argsAn environment providing additional parameters.
deparseA character scalar of the deparsed expression.
filterIdThe identifier of the filter.
Class "concreteFilter", directly.
Class "filter", by class concreteFilter,
distance 2.
Objects can be created by calls of the form
new("expressionFilter", ...), using the
expressionFilter constructor or, programmatically, from a
character string using the char2ExpressionFilter function.
signature(x = "flowFrame", table =
"expressionFilter"): The workhorse used to evaluate the gate on
data. This is usually not called directly by the user, but
internally by calls to the filter methods.
signature(object = "expressionFilter"): Print
information about the gate.
flowFrame, filter for evaluation of
sampleFilters and split and Subsetfor
splitting and subsetting of flow cytometry data sets based on that.
## Loading example data dat <- read.FCS(system.file("extdata","0877408774.B08", package="flowCore")) #Create the filter ef <- expressionFilter(`FSC-H` > 200, filterId="myExpressionFilter") ef#> expression filter 'myExpressionFilter' evaluating the expression: #> `FSC-H` > 200#> A filterResult produced by the filter named 'myExpressionFilter'summary(fres)#> myExpressionFilter+: 9465 of 10000 events (94.65%)## The result of sample filtering is a logical subset newDat <- Subset(dat, fres) all(exprs(newDat)[,"FSC-H"] > 200)#> [1] TRUE## We can also split, in which case we get those events in and those ## not in the gate as separate populations split(dat, fres)#> $`myExpressionFilter+` #> flowFrame object '0877408774.B08 (myExpressionFilter+)' #> with 9465 cells and 8 observables: #> name desc range minRange maxRange #> $P1 FSC-H FSC-H 1024 0.000000 1023 #> $P2 SSC-H SSC-H 1024 0.000000 1023 #> $P3 FL1-H <NA> 1024 1.009044 10000 #> $P4 FL2-H <NA> 1024 1.009044 10000 #> $P5 FL3-H <NA> 1024 1.009044 10000 #> $P6 FL1-A <NA> 1024 0.000000 1023 #> $P7 FL4-H <NA> 1024 1.009044 10000 #> $P8 Time Time (51.20 sec.) 1024 0.000000 1023 #> 164 keywords are stored in the 'description' slot #> #> $`myExpressionFilter-` #> flowFrame object '0877408774.B08 (myExpressionFilter-)' #> with 535 cells and 8 observables: #> name desc range minRange maxRange #> $P1 FSC-H FSC-H 1024 0.000000 1023 #> $P2 SSC-H SSC-H 1024 0.000000 1023 #> $P3 FL1-H <NA> 1024 1.009044 10000 #> $P4 FL2-H <NA> 1024 1.009044 10000 #> $P5 FL3-H <NA> 1024 1.009044 10000 #> $P6 FL1-A <NA> 1024 0.000000 1023 #> $P7 FL4-H <NA> 1024 1.009044 10000 #> $P8 Time Time (51.20 sec.) 1024 0.000000 1023 #> 164 keywords are stored in the 'description' slot #>## 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#> expression filter 'myExpressionFilter' evaluating the expression: #> `FSC-H` > 0 & `FSC-H` < 1023 & `SSC-H` > 0 & `SSC-H` < 1023 & `FL1-H` > 1.00904391657007 & `FL1-H` < 10000 & `FL2-H` > 1.00904391657007 & `FL2-H` < 10000 & `FL3-H` > 1.00904391657007 & `FL3-H` < 10000 & `FL1-A` > 0 & `FL1-A` < 1023 & `FL4-H` > 1.00904391657007 & `FL4-H` < 10000#> A filterResult produced by the filter named 'myExpressionFilter'summary(fres2)#> myExpressionFilter+: 4224 of 10000 events (42.24%)