1. Introduction

Manipulation of gates saved to the gatingTemplate is possible through the gate_remove and gate_edit functions. As their names suggest gate_remove will remove the gate from the GatingSet and the gatingTemplate, whilst gate_edit allows the user to update an existing gate and update the GatingSet and gatingTemplate accordingly. This vignette aims to demonstrate the appropriate use of these functions for manipulating gates using CytoRSuite.

2. Gate Manipulation in CytoRSuite

To demonstrate gate_edit and gate_remove we will use the “Activation” flowSet shipped with CytoRSuiteData. For more details refer to ?Activation.

3. gate_edit

gate_edit provides a simple way to modify existing gates applied to the GatingSet and saved to the gatingTemplate csv file. Key features of gate_edit include:

  • Re-plots the data with the existing gate(s) in pink.
  • Determines which gate_draw gate type was used to construct the gate(s).
  • Makes the appropriate call to CytoRSuite gating function(s) to allow the user to re-draw the gate(s) in red.
  • Applies the new gate(s) to the GatingSet.
  • Updates the relevant entries in the gatingTemplate.

The type argument is not necessary if the type of the new gate is to be the same as the old one. This argument allows users to change the type of the existing gate(s) if necessary. We will demonstrate its use below:

Since no type is supplied the new gate will have the same type as the existing gate:

Let’s update the Single Cells gate as well:

Changing the type argument will alter the gate type of the existing gate. for example type = “ellipse” will change the existing rectangle gate to an ellipsoid gate:

Users can edit any gates with gate_edit including 1-D interval gates:

Users can also pass cyto_plot arguments to gate_edit. For example we can add some 2-D contour lines to help determine where the gate should be drawn:

Back-gating is also fully supported in gate_edit through cyto_plot’s overlay argument. For example if we would like to see where the T Cells population falls on FSC-A and SSC-A:

Visualise the new gating strategy using cyto_plot_gating_scheme (result not shown).

4. gate_remove

gate_remove simply removes the selected gate(s) and associated descendant populations from the GatingSet and the gatingTemplate. Removal of multiple populations in a single call is supported as long as these populations share the same parent. gate_remove features:

  • Remove gate(s) from GatingSet.
  • Remove gate(s) entries from the gatingTemplate.

For example to remove the T Cells gate:

T Cells node no longer exists in the GatingSet:

## [1] "root"                           "/Cells"                        
## [3] "/Cells/Single Cells"            "/Cells/Single Cells/Live Cells"

T Cells node no longer exists in the gatingTemplate:

## Adding population:Cells
## Adding population:Single Cells
## Adding population:Live Cells
## --- Gating Template: default
##  with  4  populations defined

5. More information

For more information on these gate manipulation functions refer to the documentation for these functions in the Reference. To learn more about how to visualise the data refer to Visualisation Using cyto_plot vignette.