When 'data' is a gate (or flowCore filter) or a list of gates or a filterList object.
When it is used directly with 'ggplot', pdata of the flow data must be supplied through 'pd' argument explicitly in order for
the gates to be dispatched to each panel.
However It is not necessary when used with 'ggcyto' wrapper since the latter will attach pData automatically.
Usage
geom_gate(data, ...)
## Default S3 method:
geom_gate(data, ...)
## S3 method for class 'list'
geom_gate(data, ...)
## S3 method for class 'filterList'
geom_gate(data, ...)
## S3 method for class 'polygonGate'
geom_gate(data, ...)
## S3 method for class 'rectangleGate'
geom_gate(data, ...)
## S3 method for class 'ellipsoidGate'
geom_gate(data, ...)
## S3 method for class 'character'
geom_gate(data, ...)
## S3 method for class 'logicalFilterResult'
geom_gate(data, ...)
## S3 method for class 'logical'
geom_gate(data, ...)
Arguments
data
a filter (Currently only rectangleGate (1d or 2d), polygonGate, ellipsoidGate are supported.)
or a list of these gates
or filterList
or character specifying a gated cell population in the GatingSet
...
other arguments
mapping, The mapping aesthetic mapping
data a polygonGate
fill polygonGate is not filled by default
colour default is red
pd pData (data.frame) that has rownames represents the sample names used as key to be merged with filterList
Details
When 'data' is a character, it construct an abstract geom layer for a character that represents nodes in a Gating tree
and will be instanatiated later as a specific geom_gate layer or layers based on the gates extracted from the given GatingSet object.
Value
a geom_gate layer
Examples
data(GvHD)
fs <- GvHD[subset(pData(GvHD), Patient %in%5:7 & Visit %in% c(5:6))[["name"]]]
p <- ggcyto(fs, aes(x = `FSC-H`, y = `SSC-H`))
p <- p + geom_hex(bins = 128)
rect.g <- rectangleGate(list("FSC-H" = c(300,500), "SSC-H" = c(50,200)))
#constuctor for a list of filters
rect.gates <- sapply(sampleNames(fs), function(sn)rect.g)
p + geom_gate(rect.gates)
dataDir <- system.file("extdata",package="flowWorkspaceData")
gs <- load_gs(list.files(dataDir, pattern = "gs_manual",full = TRUE))
p <- ggcyto(gs, aes(x = CD4, y = CD8), subset = "CD3+") + geom_hex(bins = 64)
# add gate layer by gate name
p + geom_gate("CD4")
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/geom_gate.Rd_%03d_medium.png", width=480, height=480)
> ### Name: geom_gate
> ### Title: add a flowCore gate layer
> ### Aliases: geom_gate geom_gate.character geom_gate.default
> ### geom_gate.ellipsoidGate geom_gate.filterList geom_gate.list
> ### geom_gate.logical geom_gate.logicalFilterResult geom_gate.polygonGate
> ### geom_gate.rectangleGate
>
> ### ** Examples
>
> data(GvHD)
> fs <- GvHD[subset(pData(GvHD), Patient %in%5:7 & Visit %in% c(5:6))[["name"]]]
> p <- ggcyto(fs, aes(x = `FSC-H`, y = `SSC-H`))
> p <- p + geom_hex(bins = 128)
> rect.g <- rectangleGate(list("FSC-H" = c(300,500), "SSC-H" = c(50,200)))
> #constuctor for a list of filters
> rect.gates <- sapply(sampleNames(fs), function(sn)rect.g)
> p + geom_gate(rect.gates)
Warning message:
Removed 257 rows containing missing values (geom_hex).
>
> dataDir <- system.file("extdata",package="flowWorkspaceData")
> gs <- load_gs(list.files(dataDir, pattern = "gs_manual",full = TRUE))
loading R object...
loading tree object...
Done
> p <- ggcyto(gs, aes(x = CD4, y = CD8), subset = "CD3+") + geom_hex(bins = 64)
> # add gate layer by gate name
> p + geom_gate("CD4")
Warning message:
Removed 4 rows containing missing values (geom_hex).
>
>
>
>
>
> dev.off()
null device
1
>