Manually draw gates around populations for analysis of flow cytometry data.
# S4 method for GatingSet gate_draw(x, group_by = NULL, select = NULL, parent = "root", alias = NULL, channels = NULL, type = "polygon", gatingTemplate = NULL, display = NULL, axis = "x", density_smooth = 1.5, label = TRUE, plot = TRUE, ...)
x | object of class
|
---|---|
group_by | vector of pData column names (e.g. c("Treatment","Concentration") indicating how the samples should be grouped prior to gating, set to the length of x by default to construct a single gate for all samples. If group_by is supplied a different gate will be constructed for each group. |
select | vector containing the indices of samples within each group to use for plotting. |
parent | name of the |
alias | the name(s) of the populations to be gated. If multiple
population names are supplied (e.g. |
channels | vector of channel names to use for plotting, can be of length 1 for 1-D density histogram or length 2 for 2-D scatter plot. |
type | vector of gate type names used to construct the gates. Multiple
gate types are supported but should be accompanied with an |
gatingTemplate | name of |
display | numeric [0,1] to control the percentage of events to be
plotted. Specifying a value for |
axis | indicates whether the |
density_smooth | smoothing factor passed to
|
label | logical indicating whether to include
|
plot | logical indicating whether a plot should be drawn, set to
|
... | additional arguments for |
drawn gates are applied to the
GatingSet
and saved to a
gatingTemplate
.
# NOT RUN { library(CytoRSuiteData) # Load in samples fs <- Activation gs <- GatingSet(fs) # Apply compensation gs <- compensate(gs, fs[[1]]@description$SPILL) # Transform fluorescent channels trans <- estimateLogicle(gs[[4]], cyto_fluor_channels(fs)) gs <- transform(gs, trans) # Gate using gate_draw gating(Activation_gatingTemplate, gs) # draw gates using gate_draw - add contour lines & overlay control gate_draw(gs, parent = "Dendritic Cells", channels = c("Alexa Fluor 488-A", "Alexa Fluor 700-A"), alias = c("CD8+ DC", "CD4+ DC"), gatingTemplate = "Example-gatingTemplate.csv", type = "rectangle", contour_lines = 15 ) # Constructed gate applied directly to GatingSet getNodes(gs) # }