Question: FlowCore/FlowViz: How do I skip plotting of empty populations that would otherwise cause an error?
0
2.4 years ago by
shieldsy050 wrote:

Hey,

I'm trying to process a whole heap of flow data files (obviously), and I've set up gating strategies. My problem is that due to the nature of my research, in some files, a gated population will be empty, and this causes errors when I try to create a density plot (plots that population for each file until it reaches an empty population, then stops). It's inefficient for me to identify and remove the files, and there are other populations of interest aside from the population that is empty.

How can I remove or skip empty populations, so that I don't have to go back each time and find/delete the FCS files?

Example code:

fn <-list.files(pattern=".fcs")
fsqg1 <- split(fs,qg1)
bc <- fsqg1$CD19+CD3- dpl <- densityplot(IndividualID~FITC.A,bc) Thanks! ADD COMMENTlink modified 2.4 years ago by SamGG190 • written 2.4 years ago by shieldsy050 Answer: FlowCore/FlowViz: How do I skip plotting of empty populations that would otherwi 0 2.4 years ago by Haiying.Kong110 Germany Haiying.Kong110 wrote: If an empty .fcs file does not have even a header, and the file size is 0, add to between the line 1 and the line 2: idx = which( file.info(fn)$size > 0 )

fn = fn[idx]

Answer: FlowCore/FlowViz: How do I skip plotting of empty populations that would otherwi
0
2.4 years ago by
SamGG190
France
SamGG190 wrote:

Hi,

bc is a flowFrame. When it is empty, nrow(bc) should return zero.

It's a start. Is there a way that I can make the densityplot function skip over the empty frames within a subset? bc is the flowset resulting from a gate applied to fs. This is the result I get if one of the frames is blank, see how all the plots are generated up until the problem plot, and the remainder aren't generated?

I was wrong, bc is a flowSet. Filtering upon the number of rows (aka events) should do the job.

ff.ok <- fsApply(bc, nrow) > 100  # for a better estimation
table(ff.ok)  # always report when filtering
dpl <- densityplot(IndividualID ~ FITC.A, bc[ff.ok])  # should be ok