1. Introduction

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.

2. Gating Arguments

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, …)

  • type of gate to be drawn, possible options include “rectangle”, “polygon”, “threshold”, “boundary”, “interval”, “ellipse”, “quadrant” and “web”.
  • fr an object of class flowFrame to be gated. For objects of classes flowSet and GatingSet refer to the more versatile gate_draw function.
  • channels vector indicating the name(s) of the channel(s) to be used for gating.
  • alias vector indicating the names of the population(s) to be gated. The length of the alias argument dictates the number of gates to construct. This argument MUST be supplied in order to construct the gates.
  • axis used by drawInterval to specify whether the “x” or “y” axis should be used when constructing 2-D interval gates.
  • display numeric [0,1] indicating the percentage of events to display when plotting, set to all events by default. If the supplied value is greater than the total number of events in the flowFrame, all events will be plotted.
  • plot logical indicating whether a plot should be constructed, set to TRUE by default. This argument can be used to turn off plotting when mixing gating functions as detailed later.
  • label logical indicating whether population names and statistics should be added to the plot after gating, set to TRUE by default.
  • additional arguments passed to cyto_plot for plotting.

3. Demonstration of Gating Functions

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.

3.4 gate_boundary_draw

3.4.1 1-Dimensional Boundary Gate

3.5 gate_threshold_draw

3.5.1 1-Dimensional Threshold Gate

3.6 gate_interval_draw

3.6.1 1-Dimensional Interval Gate

3.7 gate_ellipse_draw

# Gate CD8+ T cells using ellipsoid gate - gate not applied to demonstrate quadrant and web gates
gate_ellipse_draw(Va2, alias = "CD8 T Cells", channels = c("Alexa Fluor 700-A","Alexa Fluor 488-A"))

3.8 gate_quadrant_draw

# Gate CD4 & CD8 T cells using quadrant gates - gates not applied to demonstrate web gates
# Quadrant gates are named from bottom left anticlockwise to top left
gate_quadrant_draw(Va2, alias = c("CD4- CD8-","CD4+ CD8-","CD4+ CD8+","CD4+ CD8+"), channels = c("Alexa Fluor 700-A","Alexa Fluor 488-A"))

5. Mixed Gates

# 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)

3. More information

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.