2
$\begingroup$

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. gs_pop_get_data(gs, "Gate1", "Gate2") apparently doesn't work. 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 objects.

$\endgroup$
2
  • $\begingroup$ Could you provide a reproducible examples so that we can try this? Check this $\endgroup$
    – llrs
    Jun 21 at 15:50
  • $\begingroup$ Edited such that it should now be possible to run the example code. $\endgroup$
    – gaspanic
    Jun 22 at 15:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.