FlowCore/FlowViz: How do I skip plotting of empty populations that would otherwise cause an error?
2
0
Entering edit mode
shieldsy05 • 0
@shieldsy05-13363
Last seen 7.5 years ago

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")
fs <- read.flowSet(fn,alter.names=TRUE)
qg1 <- quadrantGate(fs,stains=c("CD19","CD3"))
fsqg1 <- split(fs,qg1)
bc <- fsqg1$`CD19+CD3-`
dpl <- densityplot(IndividualID~`FITC.A`,bc)

Thanks!

flowcore flowviz R bioconductor flowstats • 1.9k views
ADD COMMENT
0
Entering edit mode
Haiying.Kong ▴ 110
@haiyingkong-9254
Last seen 5.7 years ago
Germany

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]

 

 

ADD COMMENT
0
Entering edit mode
SamGG ▴ 360
@samgg-6428
Last seen 16 days ago
France/Marseille/Inserm

Hi,

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

ADD COMMENT
0
Entering edit mode

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?

ADD REPLY
0
Entering edit mode

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

 

ADD REPLY
0
Entering edit mode

Brilliant! This works really well and reports errors! Thanks. I really appreciate it.

ADD REPLY

Login before adding your answer.

Traffic: 480 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6