Using the Bioconductor flowCore package, I'm applying two parallel and non-overlapping gates to a gatingSet directly under "root"
:
library(flowCore)
# Import data
file.name <-system.file("extdata","0877408774.B08",package="flowCore")
x <-read.FCS(file.name, transformation=FALSE)
# Create flowSet
fs <-as(list(x,x), "flowSet")
# Gate
library(flowWorkspace)
gs <- GatingSet(fs)
gate1 <- rectangleGate(filterId = "Gate1", list("FSC-H" = c(300,600), "SSC-H" = c(50,300)))
gs_pop_add(gs, gate1, parent = "root")
gate2 <- rectangleGate(filterId = "Gate2", list("FSC-H" = c(700,800), "SSC-H" = c(500,600)))
gs_pop_add(gs, gate2, parent = "root")
recompute(gs)
gs_get_pop_paths(gs)
# [1] "root" "/Gate1" "/Gate2"
# Plot
library(ggcyto)
autoplot(gs, gs_get_leaf_nodes(gs))
# Extract gated data
gs_pop_get_data(gs, "Gate1") # Works
gs_pop_get_data(gs, "Gate2") # Works
gs_pop_get_data(gs, c("Gate1", "Gate2")) # Does not work
gs_pop_get_data(gs, "Gate1", "Gate2") # Does not work
I want to get the data from the union of gates 1 and 2 but I can't figure out how. The flowCore documentation touches on this topic, but the examples shown are for filters, and I haven't figured out how to get it to work with gates.
If there is a more straightforward way of doing this using another package that would also be of interest, as long as it is compatible with flowSet/flowCore objects.