Skip to contents

Function to guess the gate cutoff values

Usage

Coereba_GateCutoffs(
  gs,
  subset,
  sample.name,
  desiredCols = NULL,
  returnTemplate = FALSE,
  outpath = NULL,
  GatingTemplate = NULL,
  returnPlots = FALSE,
  InternalCheck = FALSE
)

Arguments

gs

A GatingSet object

subset

Gate node of interest

sample.name

The keyword where specimens name is stored

desiredCols

Column names of fluorophores you want to gate

returnTemplate

Default FALSE, when set to TRUE returns a .csv of Gating Template that can be modified and provisioned by the GatingTemplate argument

outpath

Default NULL, provides file path to desired folder to store returnTemplate

GatingTemplate

A file.path to the GatingTemplate .csv you want to swap in

returnPlots

Development, when TRUE and Internal Check TRUE, returns troubleshooting plots

InternalCheck

Development, default is FALSE

Value

A data.frame with estimated gate cutoffs for every marker for every specimen

Examples


library(flowCore)
library(flowWorkspace)
library(openCyto)
library(data.table)

File_Location <- system.file("extdata", package = "Coereba")
FCS_Files <- list.files(path = File_Location, pattern = ".fcs", full.names = TRUE)
UnmixedFCSFiles <- FCS_Files[1]
UnmixedCytoSet <- load_cytoset_from_fcs(UnmixedFCSFiles,
 truncate_max_range = FALSE, transformation = FALSE)
UnmixedGatingSet <- GatingSet(UnmixedCytoSet)
Markers <- colnames(UnmixedCytoSet)
KeptMarkers <- Markers[-grep("Time|FS|SC|SS|Original|-W$|-H$|AF", Markers)]
biex_transform <- flowjo_biexp_trans(channelRange = 256, maxValue = 1000000,
 pos = 4.5, neg = 0, widthBasis = -1000)
TransformList <- transformerList(KeptMarkers, biex_transform)
flowWorkspace::transform(UnmixedGatingSet, TransformList)
#> A GatingSet with 1 samples
UnmixedGates <- fread(file.path(path = File_Location,
 pattern = 'GatesUnmixed.csv'))
UnmixedGating <- gatingTemplate(UnmixedGates)
#> Adding population:singletsFSC
#> Adding population:singletsSSC
#> Adding population:singletsSSCB
#> Adding population:nonDebris
#> Adding population:lymphocytes
#> Adding population:live
gt_gating(UnmixedGating, UnmixedGatingSet)
#> Gating for 'singletsFSC'
#> done!
#> done.
#> Gating for 'singletsSSC'
#> done!
#> done.
#> Gating for 'singletsSSCB'
#> done!
#> done.
#> Gating for 'nonDebris'
#> done!
#> done.
#> Gating for 'lymphocytes'
#> The prior specification has no effect when usePrior=no
#> Using the serial version of flowClust
#> done!
#> done.
#> Gating for 'live'
#> done!
#> done.
#> finished.

TheGateCutoffs <- Coereba_GateCutoffs(gs=UnmixedGatingSet[1],
 subset="live", sample.name="GROUPNAME")