This function plots a two-dimensional flow cytometry data highlighting the gated regions and calculates quadrant statistics. It handles data preprocessing to manage outliers by replacing extreme negative values with values from a normal distribution within specified gates. The function is ideal for analyzing and visualizing flow cytometry data, providing insights into the distribution of cell populations across specified markers.
Usage
PlotFlow2D(
x,
graphics = FALSE,
output = "output",
markers = NULL,
states = NULL,
gating = TRUE,
split_group = TRUE,
max_cells_displayed = 30000
)
Arguments
- x
A FlowObject that has already been processed using DefineNegative and NormAF.
- graphics
Logical, if TRUE, enables graphical selection of markers and gating thresholds via a GUI; otherwise, selections must be input manually. Defaults to FALSE.
- output
The directory path where the output plots and data summaries will be saved.
- markers
Optionally, a vector of marker names to be used for gating; if NULL, the function prompts for selection.
- states
A vector indicating the gating state ('positive' or 'negative') for each marker; if NULL, the function prompts for selection.
- gating
Logical, if TRUE, applies gating based on the markers and states provided; defaults to TRUE.
- split_group
Logical, if TRUE, splits the data by 'group' variable within the dataset for separate analysis and plotting; defaults to TRUE.
- max_cells_displayed
The maximum number of cells to display in the plots, which can help manage performance and clarity in visualizing dense datasets.