gate_intact_cells: Gate intact cells

View source: R/files_gating.R

gate_intact_cellsR Documentation

Gate intact cells

Description

Performs gating of intact cells using flowDensity package and deGate function.

Usage

gate_intact_cells(
  flow_frame,
  file_name = NULL,
  tinypeak_removal_head = 0.8,
  tinypeak_removal_tail = 0.8,
  alpha_head = 0.05,
  alpha_tail = 0.1,
  arcsine_transform = TRUE,
  save_gated_flow_frame = FALSE,
  out_dir = NULL,
  suffix = "_intact_gated",
  ...
)

Arguments

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.

tinypeak_removal_head

Numeric from 0-1, as in deGate to exclude/include tiny peaks in the head of the density distribution curve for both Iridium channels. Default set to 0.8.

tinypeak_removal_tail

The same as tinypeak_removal1 but for the tail in the density distribution curve.Default set to 0.8.

alpha_head

Numeric, 0-1, as in deGate specify the significance of change in the slope being detected at the head of the density distribution curve. Default 0.05.

alpha_tail

The same as in alpha_head but for the tail of the density distribution curve.Default 0.1.

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.

out_dir

Character, pathway to where the files should be saved, if NULL (default) files will be saved to file.path(getwd(), Gated).

suffix

Character, suffix placed in the name of saved fcs file, only if save_gated_flow_frame = TRUE.Defult is "_intact_gated".

...

Additional parameters to pass to flowDensity::deGate()

Value

An untransformed flow frame with intact cells only

Examples

# 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_intact_cells(flow_frame = ff,
                         file_name = basename(file), save_gated_flow_frame = TRUE)
}

dev.off()


prybakowska/CytoQP documentation built on June 28, 2022, 12:36 a.m.