Skip to contents

Check gate placement for individual .fcs files in a GatingSet

Usage

Utility_GatingPlots(
  x,
  sample.name,
  removestrings,
  subset = "root",
  gtFile,
  DesiredGates = NULL,
  outpath = NULL,
  export = TRUE,
  bins = 270,
  therows = 2,
  thecolumns = 2,
  width = 7,
  height = 9,
  clearance = 0.2,
  ...
)

Arguments

x

A GatingSet object

sample.name

The .fcs keyword that contains an unique name for that sample

removestrings

A string of character values to remove from the sample.name

subset

The GatingSet subset that you want to visualize for data plotting, "root" is the default.

gtFile

The data.table imported .csv file containing the gating template.

DesiredGates

A vector of gates that you want plotted, for example Desired <- c("nonDebris, "lymphocytes")

outpath

Location to store the generated .pdf file

export

Whether to return as a .pdf file or as individual patchwork ggplot objects.

bins

Argument to geom_hex for number of bins to visualize the plotted data density.

therows

Number of desired rows for the .pdf file

thecolumns

Number of desired columns for the .pdf file

width

Desired page width

height

Desired page height

clearance

A buffer area around the plot edge

...

Additional Arguments to NameForSample to derive filename.

Value

Additional information to be added

Examples


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

File_Location <- system.file("extdata", package = "Luciernaga")
FCS_Files <- list.files(path = File_Location, pattern = ".fcs",
  full.names = TRUE)
UnstainedFCSFiles <- FCS_Files[grep("Unstained", FCS_Files)]
UnstainedCells <- UnstainedFCSFiles[-grep("Beads", UnstainedFCSFiles)]
MyCytoSet <- load_cytoset_from_fcs(UnstainedCells[1],
  truncate_max_range = FALSE,transformation = FALSE)
MyGatingSet <- GatingSet(MyCytoSet)
MyGates <- fread(file.path(path = File_Location, pattern = 'Gates.csv'))
MyGatingTemplate <- gatingTemplate(MyGates)
#> Adding population:singletsFSC
#> Adding population:singletsSSC
#> Adding population:singletsSSCB
#> Adding population:nonDebris
#> Adding population:lymphocytes
gt_gating(MyGatingTemplate, MyGatingSet)
#> 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.
#> finished.
removestrings <-  c("DR_", "Cells", ".fcs", "-", " ")
StorageLocation <- file.path("C:", "Users", "JohnDoe", "Desktop")

IndividualPlot <- Utility_GatingPlots(x=MyGatingSet[[1]],
  sample.name = "GUID",removestrings = removestrings,
  gtFile = MyGates, DesiredGates = NULL,
  outpath = StorageLocation, export = FALSE)