Skip to contents

Initializes and populates a gating tree based on user-defined criteria, handling decision-making through multiple layers of a gating hierarchy. This function integrates gating rules, applies negative gating definitions, and assesses cell population statistics to manage the flow cytometry data analysis process.

Usage

createGatingTreeObject(
  x,
  select_markers = FALSE,
  graphics = FALSE,
  markers = NULL,
  maxDepth = 3,
  min_cell_num = 25,
  expr_group = NULL,
  ctrl_group = NULL,
  verbose = TRUE
)

Arguments

x

An object, expected to be of class 'FlowObject', containing the initial data and parameters for gating.

select_markers

Logical; if TRUE, allows the user to select markers interactively.

graphics

Logical; if TRUE, enables graphical selection of markers.

markers

Optional; a vector of markers to be included if not choosing interactively.

maxDepth

Integer; the maximum depth of the gating tree, controlling how many levels of decision nodes can be created.

min_cell_num

The minimal number of cells allowed in nodes.

expr_group

Optional; a character to specify the experimental group. If NULL, this is determined interactively.

ctrl_group

Optional; a character to specify the control group. If NULL, this is determined interactively.

verbose

Logical indicating whether to print progress messages and outputs. Default is TRUE.

Value

Modifies the input object by adding a 'GatingTreeObject' that contains the entire structure of gating decisions and nodes.

Details

The function first checks for the type of the input object to ensure it matches expected classes. It then extracts necessary data and parameters from the object, such as negative gating thresholds and sample definitions. Depending on the options, it may allow interactive selection of markers. The function constructs a hierarchical tree where each node represents a gating decision based on statistical calculations like entropy and enrichment, which are used to determine the next steps in the gating process or to terminate the process.

The gating process involves: - Merging data with sample definitions. - Calculating initial gating statistics. - Recursively creating child nodes based on gating outcomes and thresholds. - Dynamically managing markers and gating paths based on user-defined depth and available data.

Examples

if (FALSE) { # \dontrun{
# Assuming 'x' is properly instantiated and contains necessary gating setups:
x <- createGatingTreeObject(x, select_markers = TRUE, graphics = FALSE, maxDepth = 3)
} # }