I have created a gating hierarchy/strategy in R to analyse my flow cytometry data (strategy = none-debris, singlets, monocytes, and monocyte subsets via CD14/CD16 expression). However, I am unable to plot my gates on top of my data for the last option in my hierarchy (monocyte subsets; which is a quad-gate). All my other plots at the different stages work fine. Can anybody help me understand?:

Gating strategy:

# Perform manual gating for the FSC vs SSC.

gs = GatingSet(fs_clean_trans) # Create empty gating set.

rg1 = rectangleGate('FSC-A' = c(50000, Inf), filterId = 'None Debris') # Specify where you want the gate to be (cells/debris).

gs_pop_add(gs, rg1, parent = 'root') # Adds the previous gate to gs

recompute(gs) # Applies the newly added gate and recalculates the populations based on the gate (need to recompute to ensure all downstream populations are properly gated)

gs_get_pop_paths(gs) # Shows the gating hierarchy thus far.

# Manual gating for singlets.

sg1 = polygonGate(filterId = 'Singlets', 'FSC-A' = c(1e4, 16e4, 17e4, 0e4), 'FSC-H' = c(0.1e4, 12e4, 16e4, 1e4))

gs_pop_add(gs, sg1, parent = 'None Debris')

recompute(gs)

# Manual gating for monocytes.

mono = rectangleGate('FSC-A' = c(90000, 140000), 'SSC-A' = c(60000, 133000), filterId = 'Monocytes')

gs_pop_add(gs, mono, parent = 'Singlets')

recompute(gs)

# Manual gating for lymphocytes.

lymph = rectangleGate('FSC-A' = c(55000, 120000), 'SSC-A' = c(2000, 60000), filterId = 'Lymphocytes')

gs_pop_add(gs, lymph, parent = 'Singlets')

recompute(gs)

# Manual gating for monocyte subsets.

qg_mono = quadGate(filterId = 'Monocyte Subsets', 'APC-Cy7-A' = 175000, 'BV650-A' = 100000)

gs_pop_add(gs, qg_mono, parent = 'Monocytes')

recompute(gs)

gs_get_pop_paths(gs)

All plots (p5 is the quad gate that won't plot):

# Plot debris/cell gate

p2 = ggcyto(fs_clean_trans[[1]], aes(x = `FSC-A`

, y = `SSC-A`

)) +

geom_hex(bins = 200) +

geom_gate(gs_pop_get_gate(gs, 'None Debris')) +

labs(title = 'All conditions') +

scale_x_continuous(breaks = seq(0, 250000, by = 50000),

labels = paste0(seq(0, 250, by = 50), "k")) +

scale_y_continuous(breaks = seq(0, 250000, by = 50000),

labels = paste0(seq(0, 250, by = 50), "k")) +

geom_stats(size = 5.5, colour = 'red', nudge_x = 65000, nudge_y = 30000) +

theme_bw()

p2

# Plot singlets

p3 = ggcyto(fs_clean_trans[[1]], aes(x = `FSC-A`

, y = `FSC-H`

)) +

geom_hex(bins = 200) +

geom_gate(gs_pop_get_gate(gs, 'Singlets')) +

labs(title = 'All conditions') +

scale_x_continuous(breaks = seq(0, 250000, by = 50000),

labels = paste0(seq(0, 250, by = 50), "k")) +

scale_y_continuous(breaks = seq(0, 250000, by = 50000),

labels = paste0(seq(0, 250, by = 50), "k")) +

geom_stats(size = 4, colour = 'red', nudge_x = 100000, nudge_y = 110000) +

theme_bw()

p3

# Plot cells after exclusion of debris + doublets, then gate the monocyte and lymphocyte populations (exclude geom_gate to view cells without gates)

gs_data = gs_pop_get_data(gs, 'Singlets')

p4 = ggcyto(gs_data[[1]], aes(x = `FSC-A`

, y = `SSC-A`

)) +

geom_hex(bins = 200) +

geom_gate(gs_pop_get_gate(gs, 'Monocytes')) +

geom_gate(gs_pop_get_gate(gs, 'Lymphocytes')) +

labs(title = 'All conditions') +

scale_y_continuous(breaks = seq(0, 250000, by = 50000),

labels = paste0(seq(0, 250, by = 50), "k")) +

coord_cartesian(xlim = c(50000, 250000), ylim = c(0, 180000)) + # Set limits without excluding data

scale_x_continuous(breaks = seq(0, 250000, by = 50000),

labels = paste0(seq(0, 250, by = 50), "k")) +

geom_stats(size = 4, colour = 'black') +

theme_bw()

p4

# Plot CD14 + CD16 expression after doublet and debris exclusion within the monocyte gate.

gs_data = gs_pop_get_data(gs, 'Monocytes')

p5 = ggcyto(gs_data[[1]], aes(x = `APC-Cy7-A`

, y = `BV650-A`

)) +

geom_hex(bins = 200) +

geom_gate(gs_pop_get_gate(gs, 'Monocyte Subsets')) +

labs(title = 'All conditions') +

scale_y_continuous(breaks = seq(0, 250000, by = 50000),

labels = paste0(seq(0, 250, by = 50), "k")) +

scale_x_continuous(breaks = seq(0, 250000, by = 50000),

labels = paste0(seq(0, 250, by = 50), "k")) +

theme_bw()

p5