I have noticed that gates defined using transformations (via the %on% operator) and boolean operations (!, &, |, %&%) are not supported by flowCore's GatingSet and by ggcyto. E.g.
library(flowCore) library(ggcyto) fcsSet <- read.flowSet(path=system.file("extdata", "compdata", "data", package="flowCore")) myTransform <- transform("FSC-H" = log, "SSC-H" = log) mat <- matrix(c(500, 400, 400, 600, 650, 650, 500, 600, 750, 750, 600, 500), nrow = 6) colnames(mat) <- c("FSC-H", "SSC-H") myGate <- polygonGate(log(mat)) %on% myTransform # Subset is happy: nrow(Subset(fcsSet[[1]], myGate)) # [1] 10 gateSet <- GatingSet(fcsSet) add(gateSet, myGate) # replicating filter 'defaultPolygonGate on transformed values of FSC-H,SSC-H' across samples! # Error in (function (classes, fdef, mtable) : # unable to find an inherited method for function ‘filterObject’ for signature ‘"transformFilter"’ # not run: # recompute(gateSet) # autoplot(gateSet, "defaultPolygonGate") recompute(gateSet) autoplot(fcsSet[[1]], "FSC-H", "SSC-H") + geom_gate(myGate) # Error: ggcyto doesn't know how to deal with gate of class transformFilter
Am I missing something here or is there an alternative workflow? (In the example above, one could perhaps transform the parameters first and then do the gating, but this approach wouldn't help if different transformations are used by different gates or in cases of combinatorial gates).
May be, transformFilter was the wrong choice in my example, because it might indeed be a rare case to have the need to apply different transforms on the same parameter for different gates, but I see no workaround for unionFilter, intersectFilter, subsetFilter or complementFilter.
A practical case for transformFilter: gates were first defined in logicle-axes in, say, FACSDiva, but now we want to have them in log.
These filters can be represented as "booleanFilter" (equivalent to flowJo's Boolean Gate). Why would you want to change logicle to log scale?