RGLab / flowStats

flowStats: algorithms for flow cytometry data analysis using BioConductor tools
15 stars 10 forks source link

issue in spillover() : normal bivariate filter not applied (bug?) #39

Closed phauchamps closed 2 years ago

phauchamps commented 2 years ago

Hi dear flowStats team,

I think I noticed a bug in function spillover(), which is e.g. called from spillover_ng(). I noticed that 'useNormFilt' flag did not seem to have an effect. I found that it was due to the following portion of code :

https://github.com/RGLab/flowStats/blob/master/R/spillover.R#L143-L146

The creation of the filter and subsetting using the filter cannot be reached, as the code lies after a stop().

Could you possibly have a look ?

Thanks,

Philippe

jacobpwagner commented 2 years ago

Hmm. Yeah, it looks a simple bracket misplacement, maybe from a code merge at some point or a simple typo. I'm guessing instead of this:

...
                if (is.na(match(ssc, allcols))) {
                  stop("Could not find side scatter parameter. ",
                       "Please set the ssc parameter", call. = FALSE)
                  n2f <- norm2Filter(fsc, ssc, scale.factor = 1.5)
                  x <- Subset(x, n2f)
                }
...

it should just be this:

...
                if (is.na(match(ssc, allcols))) {
                  stop("Could not find side scatter parameter. ",
                       "Please set the ssc parameter", call. = FALSE)
                }
                n2f <- norm2Filter(fsc, ssc, scale.factor = 1.5)
                x <- Subset(x, n2f)
...

The brackets on the if could even just be removed because it's a single statement.

phauchamps commented 2 years ago

This is what I thought also :-)

To my limited experience, this bivariate gaussian filtering in the (FSC,SSC) dimensions is a must have as a preliminary step to calculating compensation. Otherwise there might be a lot of noise introduced in the computation. This is why I was surprised no-one already complained about this issue. Of course you can still do the 2D gaussian pre-filtering manually, prior to calling a spillover method.

To your knowledge, do you think spillover() functions of flowStats package are often used ?