Skip to content

Commit

Permalink
Add support for pop = "*" for quadrant gating methods (#245)
Browse files Browse the repository at this point in the history
* Add support for pop = "*" for quadrant gating methods.

* Remove alias length check for quadrant gates to allow default names when alias = "*".
  • Loading branch information
djhammill committed Mar 24, 2023
1 parent 4fd6ff4 commit b4daebf
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions R/gating-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -381,16 +381,19 @@ roxygen_parameter <- function() {
popAlias <- NULL
}
}

# For gate_quad methods, need to filter down to just the gates that were asked for
if(names(x) %in% c("quadGate.seq", "gate_quad_sequential", "quadGate.tmix", "gate_quad_tmix")){
pops <- gtPop@name
pops <- gsub("([\\+-])([^/$])", "\\1&\\2", pops)
pops <- strsplit(pops, "&")[[1]]
pops <- strsplit(pops, "/")
pops <- paste0(rep(pops[[1]], each=length(pops[[2]])), pops[[2]])
pops <- match(pops, c("-+", "++", "+-", "--"))
flist <- lapply(flist, function(sublist) filters(sublist[pops]))
# keep all populations when pop = *
if(!all(pops == "*")) {
pops <- gsub("([\\+-])([^/$])", "\\1&\\2", pops)
pops <- strsplit(pops, "&")[[1]]
pops <- strsplit(pops, "/")
pops <- paste0(rep(pops[[1]], each=length(pops[[2]])), pops[[2]])
pops <- match(pops, c("-+", "++", "+-", "--"))
flist <- lapply(flist, function(sublist) filters(sublist[pops]))
}
}

gs_node_id <- gs_pop_add(y, flist, parent = parent, name = popAlias, validityCheck = FALSE, negated = negated)
Expand Down

0 comments on commit b4daebf

Please sign in to comment.