expressionFilter-class: Class "expressionFilter"

expressionFilter-classR Documentation

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

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.

...

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 flowFrames or other flow cytometry objects.

Slots

expr

The expression that will be evaluated in the context of the flow cytometry values.

args

An environment providing additional parameters.

deparse

A character scalar of the deparsed expression.

filterId

The identifier of the filter.

Extends

Class "concreteFilter", directly.

Class "filter", by class concreteFilter, distance 2.

Objects from the Class

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.

Methods

%in%

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.

show

signature(object = "expressionFilter"): Print information about the gate.

Author(s)

F. Hahne, B. Ellis

See Also

flowFrame, filter for evaluation of sampleFilters and split and Subsetfor splitting and subsetting of flow cytometry data sets based on that.

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)



RGLab/flowCore documentation built on Aug. 26, 2024, 8:52 a.m.