geom_gate: Add a gate layer to a ggcyto plot.

Description Usage Arguments Details Value Examples

View source: R/geom_gate.R

Description

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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 'filter'
geom_gate(data, mapping = NULL, fill = "transparent",
  colour = "red", nPoints = 100, ...)

## S3 method for class 'quadGate'
geom_gate(data, ...)

## S3 method for class 'character'
geom_gate(data, ...)

## S3 method for class 'filters'
geom_gate(data, ...)

## S3 method for class 'filtersList'
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 pd pData (data.frame) that has rownames represents the sample names used as key to be merged with filterList

mapping,

The mapping aesthetic mapping

fill

polygonGate is not filled by default

colour

default is red

nPoints

used for interpolating polygonGates to prevent it from losing shape when truncated by axis limits

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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")

ggcyto documentation built on Jan. 15, 2019, 6:01 p.m.