gate_singlet_cells | R Documentation |
Detects outliers in the selected channel(s) using MAD (mean absolute deviation).
gate_singlet_cells( flow_frame, file_name = NULL, channels = "Event_length", arcsine_transform = TRUE, save_gated_flow_frame = NULL, suffix = "_singlets_gated", n_mad = 2, out_dir = NULL, ... )
flow_frame |
A flowframe that contains cytometry data. |
file_name |
Character, the file name used for saving the flow frame (if save_gated_flow_frame = TRUE) and for plotting, if NULL (default) the file name stored in keyword FIL will be used. |
channels |
character, channels name to be used for gating, default is to Event_length. |
arcsine_transform |
Logical, if the data should be transformed with arcsine transformation and cofactor 5. If FALSE the data won't be transformed, thus transformed flow frame should be used if needed. Default TRUE. |
save_gated_flow_frame |
Logical, if gated flow frame should be saved. Only cells falling into intact cell region will be saved. Default set to FALSE. |
suffix |
Character, suffix placed in the name of saved fcs file, only if save_gated_flow_frame = TRUE. Default is "_singlets_gated". |
n_mad |
Numeric, number of MADs to detect outliers.Default set to 2. |
out_dir |
Character, pathway to where the files should be saved, if NULL (default) files will be saved to file.path(getwd(), Gated). |
... |
Additional arguments to pass to flowDensity::plotDens(). |
An untransformed flow frame with singlets only
#' # Set input directory aggregate_dir <- file.path(dir, "Aggregated") # List files for gating files <- list.files(path = aggregate_dir, pattern = ".fcs$", full.names = TRUE) # Create directory to store plot gate_dir <- file.path(getwd(), "Gated") if(!dir.exists(gate_dir)){dir.create(gate_dir)} # Gate the files and plot the gating strategy for each file n_plots <- 1 png(file.path(gate_dir, paste0("gating.png")), width = n_plots * 300, height = length(files) * 300) layout(matrix(1:(length(files) * n_plots), ncol = n_plots, byrow = TRUE)) for (file in files){ ff <- flowCore::read.FCS(filename = file, transformation = FALSE) ff <- gate_singlet_cells(flow_frame = ff, channels = "Event_length", file_name = basename(file), save_gated_flow_frame = TRUE) } dev.off()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.