generate_gate_template: Store gates from a GatingSet in a gatingTemplate for...

View source: R/template_gating.R

generate_gate_templateR Documentation

Store gates from a GatingSet in a gatingTemplate for templated gating

Description

generate_gate_template() iterates through samples groups in a GatingSet to extract and store existing gates into an openCyto gatingTemplate that can be easily applied to new GatingSets using gt_gating().

Usage

generate_gate_template(
  x,
  groupBy = NA,
  nodes = NULL,
  gatingTemplate = FALSE,
  save_as = NULL,
  ...
)

Arguments

x

a GatingHierarchy or GatingSet object.

groupBy

a vector of variable names that exist in colnames(pData(x)) to split samples into groups before extracting the gates specified by nodes, set to NA by default to produce consensus gates across all samples.

nodes

a vector of full node paths that exist in x for which templated gating entries are required, set to all nodes in x by default.

gatingTemplate

logical to indicate whether a gatingTemplate object should be returned, set to FALSE by default. gatingTemplate objects can only be created when all nodes in x are specified.

save_as

name of the CSV file to which the gatingTemplate entries should be written, set to NULL to prevent the gatingTemplate from being written to a CSV file.

...

additional arguments passed to gatingTemplate-class.

Value

either a data.table or gatingTemplate object containing the requested gatingTemplate entries for downstream templated gating using gt_gating().

Author(s)

Dillon Hammill, Dillon.Hammill@ozette.com

Examples

## Not run: 
# gs contains variable BioSampleType
pData(gs)$BioSampleType <- rep(c("cells", "beads"), each = 4)
# create gatingTemplate object
gt <- generate_gate_template(
  gs,
  groupBy = "BioSampleType",
  gatingTemplate = TRUE,
  save_as = "gatingTemplate.csv"
)
# gt is a gatingTemplate object
gt
# apply gt to a new GatingSet
gt_gating(
  gt,
  gs_new
)

## End(Not run)


RGLab/openCyto documentation built on March 29, 2025, 9:43 p.m.