RGLab / flowCore

Core flow cytometry infrastructure
43 stars 25 forks source link

How to subset some cells #227

Closed Ivy-ops closed 2 years ago

Ivy-ops commented 2 years ago

Hi developer, I have a flowSet object, where I want to exclude some cells by the value of one channel. May I know how to achieve that? Thanks.

mikejiang commented 2 years ago

your question is a little too vague, please provide some concrete example or code snippet

mikejiang commented 2 years ago

also read docs and vignettes to understand what the package can do

Ivy-ops commented 2 years ago

Hi @mikejiang , Thanks for the quick response. Please see below example. In this demo data, I want to exclude 'Time' < 3. But I still want to keep the GvHD as flowSet format. Thanks!

image
mikejiang commented 2 years ago

Try this

 fs=GvHD[1:2]
> range(fs[[1]],"data")[,"Time"]
[1]   1 755
> f=expressionFilter(Time>3)
> f
expression filter 'Time > 3' evaluating the expression:
Time > 3
> fs1=fsApply(fs,function(fr){Subset(fr,f)})
> range(fs1[[1]],"data")[,"Time"]
[1]   6 755
Ivy-ops commented 2 years ago

Thanks @mikejiang , It works well.