Edit Existing Gate(s).

cyto_gate_edit(
  x,
  parent = NULL,
  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,
  ...
)

Arguments

x

an object of class GatingSet.

parent

name of the parental population.

alias

name(s) of the gate to edit (e.g. "Single Cells").

channels

name(s) of the channel(s) used to construct the gate(s). This argument is not necessary but is included to allow conversion of cyto_gate_draw code to cyto_gate_remove code by simply changing "draw" to "remove".

type

vector of gate type names used to construct the gates. Multiple 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 "polygon".

gatingTemplate

name of the gatingTemplate csv file (e.g. "gatingTemplate.csv") where the gate is 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). Only overlaid flowSet objects are subjected to sampling by display.

group_by

vector of pData 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.

select

vector containing the indices of samples within gs to use for plotting.

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.flowFrame.

Value

an object of class GatingSet with edited gate applied, as well as gatingTemplate file with edited gate saved.

Author

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

Examples

if (FALSE) { library(CytoExploreRData) # Load in samples fs <- Activation gs <- GatingSet(fs) # Apply compensation gs <- cyto_compensate(gs) # Transform fluorescent channels gs <- cyto_transform(gs) # Gate using cyto_gate_draw gt <- Activation_gatingTemplate gt_gating(gt, gs) # Edit CD4 T Cells Gate - replace gatingTemplate name cyto_gate_edit(gs, parent = "T Cells", alias = "CD4 T Cells", gatingTemplate = "gatingTemplate.csv" ) }