gate_from_biplot {hypergate}R Documentation

gate_from_biplot

Description

From a biplot let the user interactively draw polygons to create a "Gate" vector

Usage

gate_from_biplot(
  matrix,
  x_axis,
  y_axis,
  ...,
  bty = "l",
  pch = 16,
  cex = 0.5,
  sample = NULL
)

Arguments

matrix

A matrix

x_axis

character, colname of matrix used for x-axis in the biplot

y_axis

character, colname of matrix used for y-axis in the biplot

...

passed to plot

bty

passed to plot

pch

passed to plot

cex

passed to plot

sample

Used to downsample the data in case there are too many events to plot quickly

Details

Data will be displayed as a bi-plot according to user-specified x_axis and y_axis arguments, then a call to locator() is made. The user can draw a polygon around parts of the plot that need gating. When done, 'right-click' or 'escape' (depending on the IDE) escapes locator() and closes the polygon. Then the user can press "n" to draw another polygon (that will define a new population), "c" to cancell and draw the last polygon again, or "s" to exit. When exiting, events that do not fall within any polygon are assigned NA, the others are assigned an integer value corresponding to the last polygon they lie into.

Value

A named vector of length nrow(matrix) and names rownames(matrix). Ungated events are set to NA

Examples

if(interactive()){
    ##See the details section to see how this function works
    gate_from_biplot(matrix=Samusik_01_subset$tsne,x_axis="tSNE1",y_axis="tSNE2")
}

[Package hypergate version 0.8.5 Index]