Skip to contents

Load the predefined gating strategy (as .csv or .xlsx file) and apply the gates as defined in the file.

Usage

addGates(
  gs,
  gateStrat = ".",
  foN.gateStrat = ".",
  type.gateStrat = ".",
  verbose = "."
)

Arguments

gs

A gating set as produced by makeGatingSet.

gateStrat

Character length one. The name of the file defining the gating strategy. If left at the default '.', the name as defined in the settings file (key: 'fiN_gateStrat') will be used.

foN.gateStrat

Character length one. The name of the folder where the file defining the gating strategy and the gate definitions reside. If left at the default '.', the name as defined in the settings file (key: 'foN_gating') will be used.

type.gateStrat

Character length one, can be either 'csv' or 'xlsx'. The type of file defining the gating strategy. Currently, csv and xlsx files are supported. If left at the default '.', the filetype as defined in the settings (key: 'dV_gateStratInputType') file will be used.

verbose

Logical. If status messages should be displayed. If left at the default '.', the value as defined in the settings file (key 'dV_verbose') will be used.

Value

An object of class-GatingSet_fd.

Details

The gating strategy file can hold one or more gates. One row in the files represents one gate. In order to see a schematic representation of 'parent' and 'child' gates, simply use 'plot'.

See also

Other Extraction functions: makeAddGatingSet(), makeGatingSet(), makefdmat()

Examples

td <- tempdir()
data_source <- "https://github.com/bpollner/data/raw/main/flowdex_examples/flowdex_examples.zip"
check_download_data(td, data_source)
#> Download ok
exp_home <- paste0(td, "/flowdex_examples")
old_wd <- getwd()
setwd(exp_home)
#
assign("get_settings_from_flowdex_package_root", TRUE, pos=.GlobalEnv)
# only required to make the examples run automatically
# you should not call 'assign' if you run the examples manually
# the effect of setting 'get_settings_from_flowdex_package_root' to TRUE
# is that the file 'flowdex_settings.R' in 'root' of the installed package
# 'flowdex' will be sourced instead of the one in the user-defined location.
#
gs <- makeGatingSet()
#> Reading in fcs files... ok. 
#> Producing gating set... Applying fjbiexp transformation... ok. 
gs
#> A GatingSet of class 'GatingSet' with 12 samples:
#> 
#>    Index             SampleNames
#> 1      1 N_na_GNeg_T4_th1_b1.fcs
#> 2      2 N_na_GNeg_T4_th1_b2.fcs
#> 3      3 N_na_GNeg_T4_th1_b3.fcs
#> 4      4 N_na_GNeg_T5_th1_b1.fcs
#> 5      5 N_na_GNeg_T5_th1_b2.fcs
#> 6      6 N_na_GNeg_T5_th1_b3.fcs
#> 7      7 N_na_GPos_T4_th1_b1.fcs
#> 8      8 N_na_GPos_T4_th1_b2.fcs
#> 9      9 N_na_GPos_T4_th1_b3.fcs
#> 10    10 N_na_GPos_T5_th1_b1.fcs
#> 11    11 N_na_GPos_T5_th1_b2.fcs
#> 12    12 N_na_GPos_T5_th1_b3.fcs
#> 
#> 
#> The following 10 channels are available:
#> FSC.A    SSC.A    FITC.A    PE.A    PerCP.A    PE.Cy7.A    APC.A    APC.Cy7.A    V450.A    V500.A
gs <- addGates(gs)
#> Gating: (1 gate) 
#> done!
gs
#> A GatingSet of class 'GatingSet_fd' with 12 samples:
#> 
#>    Index             SampleNames
#> 1      1 N_na_GNeg_T4_th1_b1.fcs
#> 2      2 N_na_GNeg_T4_th1_b2.fcs
#> 3      3 N_na_GNeg_T4_th1_b3.fcs
#> 4      4 N_na_GNeg_T5_th1_b1.fcs
#> 5      5 N_na_GNeg_T5_th1_b2.fcs
#> 6      6 N_na_GNeg_T5_th1_b3.fcs
#> 7      7 N_na_GPos_T4_th1_b1.fcs
#> 8      8 N_na_GPos_T4_th1_b2.fcs
#> 9      9 N_na_GPos_T4_th1_b3.fcs
#> 10    10 N_na_GPos_T5_th1_b1.fcs
#> 11    11 N_na_GPos_T5_th1_b2.fcs
#> 12    12 N_na_GPos_T5_th1_b3.fcs
#> 
#> 
#> The following 10 channels are available:
#> FSC.A    SSC.A    FITC.A    PE.A    PerCP.A    PE.Cy7.A    APC.A    APC.Cy7.A    V450.A    V500.A
#> 
#> The following gating strategy derived from file 'gateStrat.xlsx' has been applied:
#>   GateName Parent GateOnX GateOnY GateDefinition extractOn minRange maxRange
#> 1     DNA+   root  FITC.A PerCP.A    BactStainV1    FITC.A     1250     4000
#>   keepData
#> 1     TRUE
#
setwd(old_wd)