CytoExploreR
CytoExploreR copied to clipboard
Getting around gate exists error in script
Is your feature request related to a problem? Please describe. When I create a data analysis script, I ofter include code to draw the basic manual gates that I need to run with new data set. If I am rerunning the script, of course, these gate are already in the gating template, so I often include a cyto_gatingTemplate_apply(gsSamp, "Samples-Template.csv") at the end of the gate series. The latter is smart enough to ignore gates I've just created manually if it is the firs run. However, if I attempt to recreate a manual gate that is in the template I get an error. This seems to mean I can not run the whole script if the template already exists because this error halts the script.
> # Gate (non-debris) Cells (Samples-Template.csv)
> cyto_gate_draw(gsSamp,
+ parent = "root",
+ alias = "Non-Debris",
+ channels = c("FSC-AREA", "SSC-AREA"))
Non-Debris already exists in Samples-Template.csv.
Error in FUN(X[[i]], ...) :
Supply another gatingTemplate or edit gate(s) using cyto_gate_edit.
Describe the solution you'd like I'm not certain whether it would be possible to turn this into a warning instead of an error, so that I could run the script from beginning to end without it stopping on these gate creation lines, or alternatively have a flag that would ignore a cyto_gate_draw() request if it were already in the template. I could manually implement an ifexists solution in my own script, but I would need a way to test existence, and I don't currently know how to do that.
This is not a big deal but I commonly find myself re-running a script on each of the experiments in a protocol set after changing my mind about the graphs or staticial approach to data analysis. I have to babysit each run even after completing the new cyto_setup shiny clicks.
Perhaps there are reasons this makes no sense, and I continue to appreciate this fine package.