cyto_gate_draw allows to users to interactive draw gates around populations which are returned as flowCore gate objects. The flowFrame and flowSet methods simply return the constructed gates as a list of flowCore-compatible gate objects, whilst the GatingSet method automatically applies the constructed gates to the GatingSet and saves the constructed gates in an openCyto gatingTemplate for future use. See cyto_gate_edit, cyto_gate_remove and cyto_gate_rename to manipulate constructed gates and modify their entries in the gatingTemplate.

# S3 method for GatingSet
cyto_gate_draw(
  x,
  parent = "root",
  alias = NULL,
  channels = NULL,
  type = NULL,
  gatingTemplate = NULL,
  overlay = NA,
  group_by = "all",
  select = NULL,
  negate = FALSE,
  display = 25000,
  axis = "x",
  label = TRUE,
  plot = TRUE,
  popup = TRUE,
  axes_limits = "machine",
  gate_point_shape = 16,
  gate_point_size = 1,
  gate_point_col = "red",
  gate_point_col_alpha = 1,
  gate_line_type = 1,
  gate_line_width = 2.5,
  gate_line_col = "red",
  gate_line_col_alpha = 1,
  ...
)

# S3 method for flowSet
cyto_gate_draw(
  x,
  alias = NULL,
  channels = NULL,
  type = NULL,
  overlay = NA,
  group_by = "all",
  select = NULL,
  negate = FALSE,
  display = 25000,
  axis = "x",
  label = TRUE,
  plot = TRUE,
  popup = TRUE,
  axes_limits = "machine",
  gate_point_shape = 16,
  gate_point_size = 1,
  gate_point_col = "red",
  gate_point_col_alpha = 1,
  gate_line_type = 1,
  gate_line_width = 2.5,
  gate_line_col = "red",
  gate_line_col_alpha = 1,
  ...
)

# S3 method for flowFrame
cyto_gate_draw(
  x,
  alias = NULL,
  channels = NULL,
  type = NULL,
  overlay = NA,
  negate = FALSE,
  display = 25000,
  axis = "x",
  label = TRUE,
  plot = TRUE,
  popup = TRUE,
  axes_limits = "machine",
  gate_point_shape = 16,
  gate_point_size = 1,
  gate_point_col = "red",
  gate_point_col_alpha = 1,
  gate_line_type = 1,
  gate_line_width = 2.5,
  gate_line_col = "red",
  gate_line_col_alpha = 1,
  ...
)

Arguments

x

object of class flowFrame, flowSet or GatingSet.

parent

name of the parent population to extract for gating when a GatingSet object is supplied.

alias

the name(s) of the populations to be gated. If multiple population names are supplied (e.g. c("CD3,"CD4)) multiple gates will be returned. alias is NULL by default which will halt the gating routine.

channels

vector of channel names to use for plotting, can be of length 1 for 1-D density histogram or length 2 for 2-D scatter plot.

type

vector of gate type names used to construct the gates. Multiple gate types are supported but should be accompanied with an alias argument of the same length (i.e. one type per alias). Supported gate types are polygon, rectangle, ellipse, threshold, boundary, interval, quadrant and web which can be abbreviated as upper or lower case first letters as well. Default type is "interval" for 1D gates and "polygon" for 2D gates.

gatingTemplate

name of gatingTemplate csv file to which the gatingTemplate entries for the GatingSet method should be saved.

overlay

name(s) of the populations to overlay or a flowFrame, flowSet, list of flowFrames or list of flowSets containing populations to be overlaid onto the plot(s).

group_by

vector of cyto_details column names (e.g. c("Treatment","Concentration") indicating how the samples should be grouped prior to gating, set to the length of x by default to construct a single gate for all samples. If group_by is supplied a different gate will be constructed for each group. This argument only applies to flowSet or GatingSet objects.

select

designates which samples will be plotted and used for determining the best location to set the drawn gate(s). Filtering steps should be comma separated and wrapped in a list. Refer to cyto_select.

negate

logical indicating whether a gatingTemplate entry should be made for the negated population (i.e. all events outside the constructed gates), set to FALSE by default. If negate is set to TRUE, a name for the negated population MUST be supplied at the end of the alias argument.

display

fraction or number of events to display in the plot during the gating process, set to 25 000 events by default.

axis

indicates whether the "x" or "y" axis should be gated for 2-D interval gates.

label

logical indicating whether to include cyto_plot_label for the gated population(s), TRUE by default.

plot

logical indicating whether a plot should be drawn, set to TRUE by default.

popup

logical indicating whether the plot should be constructed in a pop-up window, set to TRUE by default.

axes_limits

options include "auto", "data" or "machine" to use optimised, data or machine limits respectively. Set to "machine" by default to use entire axes ranges. Fine control over axes limits can be obtained by altering the xlim and ylim arguments.

gate_point_shape

shape to use for selected gate points, set to 16 by default to use filled circles. See pch for alternatives.

gate_point_size

numeric to control the size of the selected gate points, set to 1 by default.

gate_point_col

colour to use for the selected gate points, set to "red" by default.

gate_point_col_alpha

numeric [0,1] to control the transparency of the selected gate points, set to 1 by default to use solid colours.

gate_line_type

integer [0,6] to control the line type of gates, set to 1 to draw solid lines by default. See lty for alternatives.

gate_line_width

numeric to control the line width(s) of gates, set to 2.5 by default.

gate_line_col

colour to use for gates, set to "red" by default.

gate_line_col_alpha

numeric [0,1] to control the transparency of the selected gate lines, set to 1 by default to use solid colours.

...

additional arguments for cyto_plot.

Value

flowFrame and flowSet methods return a list of flowCore gate objects per group in group_by, whilst the GatingSet applies the constructed gates directly to the GatingSet and adds appropriate entries into the specified gatingTemplate. The GatingSet method does not return the constructed gates but instead invisibly returns the gatingTemplate entries.

See also

Author

Dillon Hammill, Dillon.Hammill@anu.edu.au

Examples

if (FALSE) { # Gate drawing requires an interactive R session library(CytoExploreRData) # Load in samples fs <- Activation gs <- GatingSet(fs) # Apply compensation gs <- compensate(gs, fs[[1]]@description$SPILL) # Transform fluorescent channels trans <- estimateLogicle(gs[[4]], cyto_fluor_channels(fs)) gs <- transform(gs, trans) # Gate using cyto_gate_draw gt_gating(Activation_gatingTemplate, gs) # draw gates using cyto_gate_draw cyto_gate_draw(gs, parent = "Dendritic Cells", channels = c("Alexa Fluor 488-A", "Alexa Fluor 700-A"), alias = c("CD8+ DC", "CD4+ DC"), gatingTemplate = "Example-gatingTemplate.csv", type = "rectangle", contour_lines = 15 ) # Constructed gate applied directly to GatingSet cyto_nodes(gs) }