Question: Complex filters in flowCore and ggcyto
0
2.4 years ago by
jaera0
jaera0 wrote:

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).

flowcore ggcyto • 578 views
ADD COMMENTlink
modified 2.4 years ago by Jiang, Mike1.2k • written 2.4 years ago by jaera0
Answer: Complex filters in flowCore and ggcyto
0
2.4 years ago by
Jiang, Mike1.2k
(Private Address)
Jiang, Mike1.2k wrote:

You are right, "transformFilter" is not supported here. We suppose different flow parameters/channels can have different transformations but for each flow parameter the transformation is the fixed in the context of your particular analysis. I don't see the compelling reason to transform the same parameter (e.g. FSC-H in this example) differently in your different gates.

ADD COMMENTlink written 2.4 years ago by Jiang, Mike1.2k

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.

ADD REPLYlink written 2.4 years ago by jaera0

A practical case for transformFilter: gates were first defined in logicle-axes in, say, FACSDiva, but now we want to have them in log.

ADD REPLYlink written 2.4 years ago by jaera0

These filters can be represented as "booleanFilter" (equivalent to flowJo's Boolean Gate). Why would you want to change logicle to log scale?

ADD REPLYlink modified 2.4 years ago • written 2.4 years ago by Jiang, Mike1.2k
Please log in to add an answer.

Content
Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 112 users visited in the last hour