RGLab / openCyto

A package that provides data analysis pipeline for flow cytometry.
GNU Affero General Public License v3.0
75 stars 29 forks source link

Add support for pop = "*" for quadrant gating methods #245

Closed djhammill closed 1 year ago

djhammill commented 1 year ago

This PR addresses the issue raised in #241 regarding the use of pop = "*" for quadrant gating methods. Looking at the code base, pop = "*" is not currently supported for quadrant gating methods. When pop = "*" the user wants to keep all quadrant gates and population names can be supplied through alias.

I initially added a length check on alias but removed it to allow alias = "*" as well, so that the default population names can be used for the quadrant gates if they are not manually supplied.

Quadrant gates can now be manually labelled through alias:

# manual alias
gs_add_gating_method(
  gs,
  alias = "A,B,C,D",
  pop = "*",
  parent = "root",
  dims = "CD4,CD8",
  gating_method = "gate_quad_sequential",
  gating_args = list(
    gFunc = "mindensity"
  )
)
# population names
gs_get_pop_paths(gs)
> "root" "/A" "/B" "/C" "/D"

image

Or default names can be used with alias = "*":

# manual alias
gs_add_gating_method(
  gs,
  alias = "*",
  pop = "*",
  parent = "root",
  dims = "CD4,CD8",
  gating_method = "gate_quad_sequential",
  gating_args = list(
    gFunc = "mindensity"
  )
)
# population names
gs_get_pop_paths(gs)
> "root" "/Alexa Fluor 700-A-Alexa Fluor 488-A+" "/Alexa Fluor 700-A+Alexa Fluor 488-A+" 
 "/Alexa Fluor 700-A+Alexa Fluor 488-A-" "/Alexa Fluor 700-A-Alexa Fluor 488-A-" 

image