filter-methods.RdThese 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.
filter(x, filter, method = c("convolution", "recursive"), sides = 2L, circular = FALSE, init = NULL)
| x | |
|---|---|
| filter | An object of class |
| method, sides, circular, init | These arguments are not used. |
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.
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.
## 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)#> [1] "logicalFilterResult" #> attr(,"package") #> [1] "flowCore"summary(fr)#> nonDebris+: 9470 of 10000 events (94.70%)#> [1] "filterResultList" #> attr(,"package") #> [1] "flowCore"summary(fr2)#> filter summary for frame 's5a01' #> nonDebris+: 1695 of 3420 events (49.56%) #> #> filter summary for frame 's5a02' #> nonDebris+: 1295 of 3405 events (38.03%) #> #> filter summary for frame 's5a03' #> nonDebris+: 2281 of 3435 events (66.40%) #>## 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)