vignettes/CytoRSuite-Gating-Functions.Rmd
CytoRSuite-Gating-Functions.Rmd
CytoRSuite provides a variety of useful gating functions to interactively draw gates around populations for the analysis of flow cytometry data. Here we will demonstrate the use of these functions to return flowCore
gate objects for downstream analyses. Below we outline the gating functions currently supported by CytoRSuite as well as their required inputs:
gate_polygon_draw
- constructs polygonGate(s) based on selection of a minimum of 3 points. Polygon gates are sealed by right clicking and selecting “stop”.gate_rectangle_draw
- constructs rectangleGate(s) based on selection of 2 diagonal points defining the limits of the gate.gate_boundary_draw
- constructs a lower open-ended rectangleGate based on selection of 1 point indicating the upper bound of the population. Boundary gates are supported in both 1 and 2 dimensions.gate_threshold_draw
- constructs an upper open-ended rectangleGate based on selection of 1 point indicating the lower bound of the population. Threshold gates are supported in both 1 and 2 dimensions.gate_interval_draw
- constructs rectangleGate(s) based on selection of 2 points indicating the lower and upper bounds of the population. Interval gates are supported in both 1 and 2 dimensions.gate_ellipse_draw
- constructs ellipsoidGate(s) based on selection of 4 points indicating the lower and upper bounds of the population in 2 dimensions.gate_quadrant_draw
- constructs 4 open-ended rectangleGates based on selection of 1 point indicating the center of the crosshair between 4 populations.gate_web_draw
- constructs any number of polygonGates based on selection of a center point and surrounding separating points. See below for demonstration.gate_draw
is a wrapper for all of these gating functions which takes on an argument type
to indicate that type of gate to draw and construct.All gating functions have the same format with minor variations as detailed below:
gate_draw(fr, channels, alias = NULL, display = 1, plot = TRUE, label = TRUE, …)
flowFrame
to be gated. For objects of classes flowSet
and GatingSet
refer to the more versatile gate_draw
function.flowFrame
, all events will be plotted.To demonstrate the use of CytoRSuite’s gating functions we will use the “Activation” flowSet shipped with CytoRSuiteData. This flowSet contains 4 samples from an in vitro activation assay where activated dendritic cells pulsed with ovalbumin were used to stimulate OT-I (CD8+) and OT-II (CD4+) transgenic T cells. For more information about this flowSet
see ?Activation.
# Load in required packages
library(CytoRSuite)
library(CytoRSuiteData)
# Load in Activation dataset
fs <- Activation
# Extract spillover matrix from flowFrame description slot - see ?computeSpillover ?editSpillover
spill <- fs[[1]]@description$SPILL
# Apply compensation to samples & save to object fs
fs <- compensate(fs, spill)
# Apply logicle transformation to all fluorescent channels
trans <- estimateLogicle(fs[[1]], colnames(spill))
fs <- transform(fs, trans)
# We will use the pooled samples for gating - for large datasets use display to limit events for plotting
fr <- as(fs, "flowFrame")
gate_polygon_draw
gate_rectangle_draw
gate_boundary_draw
gate_interval_draw
gate_web_draw
# Gate CD4 & CD8 T cells using mixed gates - gates not applied
# Gating functions can be mixed by setting plot = FALSE for subsequent gates & keep plotting window open
gate_rectangle_draw(Va2, alias = "CD4 T Cells", channels = c("Alexa Fluor 700-A","Alexa Fluor 488-A"))
gate_ellipse_draw(Va2, alias = "CD8 T Cells", channels = c("Alexa Fluor 700-A","Alexa Fluor 488-A"), plot = FALSE)
For more information on these gating functions refer to the documentation for these functions in the Reference. To learn more about how to edit and remove gates refer to Gate Manipulation vignette.