RGLab / flowStats

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

proBin fails due to NULL dimension #18

Closed marshallaf closed 7 years ago

marshallaf commented 7 years ago

I'm getting an error while using proBin on certain fcs files: dim(X) must have a positive length

It occurs in this call to apply, and, as far as I can tell, happens when the data at that node has only 1 row.

The selection made in the apply call - data[[as.character(nodeIndx)]][,channels] - returns a vector, which apply doesn't work on since dim(vector) == NULL.

My grasp on R style and syntax is still pretty lacking, but I think if the condition was checked for, then the vector could be turned into a matrix by:

originalNames = names(vector)
dim(vector) = c(1,3)
colnames(vector) = originalNames

Although there's probably a better way of doing that.

gfinak commented 7 years ago

I've pushed a fix that keeps the dimensions from being dropped when there is just one row. See if it works for you. It should be in the trunk branch here on GitHub.

marshallaf commented 7 years ago

Thanks! That fixed that particular issue. And much more concisely than my approach!

I discovered that my real problem that I had was that I had a rangeGate earlier in the workflow that had a too-high refline, so I was calling proBin with minEvents = 0.45, which even with this fix gave me some weird stats for the bins.