gs_create: Create a GatingSet from a directory of fcs files

View source: R/gs_create.R

gs_createR Documentation

Create a GatingSet from a directory of fcs files

Description

This function takes a directory (or directories recursively) containing some fcs files and reads them into the GatingSet format from flowWorkspace so that they can be subsequentially gated on. The function can optionally read the data in as ncdf files to save memory, can apply a compensation matrix from an acquisition-defined slot or a provided matrix in .csv format, and can apply a biexponential or arcsinh transform.

Usage

gs_create(
  FCSDirectory,
  pattern = ".fcs$",
  autoqc = FALSE,
  qcreport = FALSE,
  recursive = FALSE,
  ncdf = FALSE,
  comp = "acquisition",
  transform = FALSE,
  arcsinh_coeff = 150,
  linearChannels = 2
)

Arguments

FCSDirectory

The parent directory containing the fcs files.

pattern

a string/regexp that selects the files to read in. Defaults to all fcs files with ".fcs$".

autoqc

Pass one of the remove_from strings for flowAI to run automatic qc with that string as the remove_from value ("all", "FR_FS", "FM", etc). Defaults to FALSE (no qc).

qcreport

Boolean whether to generate an html and mini report in the current wd for autoqc. Defaults to FALSE.

recursive

Boolean specifying whether the fcs files should be searched for within FCSDirectory recursively (i.e. are there subfolders?).

ncdf

Boolean specifying whether the fcs files should be read in as ncdf files.

comp

Either "acquisition" or the filepath to a comp matrix saved as a .csv file. Specify FALSE if you want no comp applied.

transform

Either "biex" or "arcsinh" to apply the appropriate transform function to all channels not defined as linear (see below). Keep FALSE to apply no transformation (default, since I'm starting to move to scale_._transform instead of raw data transforms)

arcsinh_coeff

passed to the arcsinh function - defaults to 150, which is considered appropriate for fluorescent cytometry data (use coefficient 1 if you have cytof data instead).

linearChannels

Either a number specifying how many FSC and SSC channels you have (don't include TIME as linear even though it is - this is taken care of already), or a character vector naming all of the channels you don't want transformed (i.e. the linear channels).

Value

a GatingSet object with the comp and transformation applied as specified.

Examples


path_to_fcs <- system.file("extdata", package = "flowHelpers")
gs <- gs_create(FCSDirectory = path_to_fcs,
pattern = ".fcs$",
recursive = FALSE,
ncdf = FALSE,
comp = "acquisition",
transform = "biex",
linearChannels = 6)



NKInstinct/flowHelpers documentation built on March 17, 2023, 1:42 a.m.