I have an issue with using gaussNorm on a flowSet constructed by using read.flowSet on .FCS files.
I can visualize the distributions of individual flowFrames using ggcyto, but whenever I run gaussNorm on the flowSet, I get the following error:
"Error in density.default(na.omit(lms.list)) : need at least 2 points to select a bandwidth automatically"
The following code reproduces the problem:
R version 4.1.2 (2021-11-01) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19045)
library(flowCore) library(flowStats) library(ggcyto) data(ITN) pITN <- ITN[1:2] gaussNorm(pITN, "CD8", )$flowset
With the ITN data, I can fix the problem by choosing more elements for the pITN subset, or by transforming the data:
tpITN <- transform(pITN, "CD4"=asinh(CD4), "CD3"=asinh(CD3), "CD8"=asinh(CD8)) tpITN <- gaussNorm(tpITN, "CD8", )$flowset
However, none of those solutions work with my model data.
The following code visualizes the individual flowFrames of the flowSet, and also works on my model data:
#For the raw data ggcyto(pITN, aes(x = "CD8", col = name)) + geom_density() + facet_null() #For the transformed data ggcyto(tpITN, aes(x = "CD8", col = name)) + geom_density() + facet_null()
Why does the error occur, despite the pITN dataset having 2 flowFrames?
How come the above solutions work with the ITN data?
And most importantly, what could I try to fix my issue, since the above solutions doesn't work for my model data?
Thank you in advance :-)