It simply constructs an boundaryFilter that removes the marginal events.
It can be passed directly to ggcyto constructor. See the examples for details.
Usage
marginalFilter(fs, dims, ...)
Arguments
fs
flowSet (not used.)
dims
the channels involved
...
arguments passed to boundaryFilter
Value
an boundaryFilter
Examples
data(GvHD)
fs <- GvHD[1]
chnls <- c("FSC-H", "SSC-H")
#before removign marginal events
summary(fs[, chnls])
# create merginal filter
g <- marginalFilter(fs, chnls)
g
#after remove marginal events
fs.clean <- Subset(fs, g)
summary(fs.clean[, chnls])
#pass the function directly to ggcyto
dataDir <- system.file("extdata",package="flowWorkspaceData")
gs <- load_gs(list.files(dataDir, pattern = "gs_manual",full = TRUE))
# with marginal events
ggcyto(gs, aes(x = CD4, y = CD8), subset = "CD3+") + geom_hex(bins = 64)
# using marginalFilter to remove these events
ggcyto(gs, aes(x = CD4, y = CD8), subset = "CD3+", filter = marginalFilter) + geom_hex(bins = 64)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(ggcyto)
Loading required package: ggplot2
Loading required package: flowCore
Loading required package: ncdfFlow
Loading required package: flowViz
Loading required package: lattice
Loading required package: RcppArmadillo
Loading required package: BH
Loading required package: flowWorkspace
Loading required package: gridExtra
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/ggcyto/marginalFilter.Rd_%03d_medium.png", width=480, height=480)
> ### Name: marginalFilter
> ### Title: Generate a marginal gate.
> ### Aliases: marginalFilter
>
> ### ** Examples
>
> data(GvHD)
> fs <- GvHD[1]
> chnls <- c("FSC-H", "SSC-H")
> #before removign marginal events
> summary(fs[, chnls])
$s5a01
FSC-H SSC-H
Min. 59.0 6.0
1st Qu. 115.0 82.0
Median 197.0 145.5
Mean 245.2 202.9
3rd Qu. 338.0 237.0
Max. 1023.0 1023.0
>
> # create merginal filter
> g <- marginalFilter(fs, chnls)
> g
boundaryFilter 'defaultBoundaryFilter' operating on channels:
FSC-H (tolerance=2.22e-16, boundary=both)
SSC-H (tolerance=2.22e-16, boundary=both)
>
> #after remove marginal events
> fs.clean <- Subset(fs, g)
> summary(fs.clean[, chnls])
$s5a01
FSC-H SSC-H
Min. 59.0 6.0
1st Qu. 114.0 80.0
Median 193.0 142.0
Mean 236.7 185.7
3rd Qu. 331.0 228.0
Max. 943.0 1009.0
>
> #pass the function directly to ggcyto
> dataDir <- system.file("extdata",package="flowWorkspaceData")
> gs <- load_gs(list.files(dataDir, pattern = "gs_manual",full = TRUE))
loading R object...
loading tree object...
Done
> # with marginal events
> ggcyto(gs, aes(x = CD4, y = CD8), subset = "CD3+") + geom_hex(bins = 64)
Warning message:
Removed 4 rows containing missing values (geom_hex).
>
> # using marginalFilter to remove these events
> ggcyto(gs, aes(x = CD4, y = CD8), subset = "CD3+", filter = marginalFilter) + geom_hex(bins = 64)
Warning message:
Removed 15 rows containing missing values (geom_hex).
>
>
>
>
>
> dev.off()
null device
1
>