DillonHammill / CytoExploreR

Interactive Cytometry Data Analysis
60 stars 13 forks source link

No popup for drawing gate #134

Closed liamg15 closed 2 years ago

liamg15 commented 2 years ago

I plan to draw any form of gate around my data. First time using this package and want to practice with all gating options. When I run cyto_gate_draw below, I get an error saying:

Select the upper bound of the Cells population to construct a boundary gate. Error in dimnames(x) <- dn : length of 'dimnames' [1] not equal to array extent

Looks like I don't have the option to manually draw gates around populations as there is no popup even with popup = TRUE. Could this be an issue with Shiny? Do I need to run this code in ShinyApp?

Here is my code:

library(tidyverse)
library(CytoExploreR)
samples <- read.flowSet(path = "2022-02-16 - ADCP S1-S2/FCS files",truncate_max_range = F)
gt <- cyto_setup("samples",
                 gatingTemplate = "Manual-Gating.csv")

fs <- samples
gs <- GatingSet(fs) #small colour panel, no compensation needed.

# Transform fluorescent channels
trans <- cyto_transformer_logicle(gs[[2]], m =4.9)
gs <- cyto_transform(gs,
                     trans = trans)

# Extract root cytoset
cs <- cyto_extract(gs, "root")

cyto_gate_draw(cs, alias = "Cells", channels = c("SSC-H","SSC-A"), type = "boundary", popup = F, axes_limits = "auto")

image image

DillonHammill commented 2 years ago

@liamg15, that is not an error but instead instructions on how to gate. Rmarkdown is designed to be non-interactive so you need to run the code from a traditional R script. The plot should open in a popup window and you can draw your gates in that window.

Also, there is no need to pull the data out before calling cyto_gate_draw(), just give it your GatingSet.