Open fbenedett opened 1 year ago
@fbenedett, I think you are looking for Subset()
- which returns a flowSet of events inside the gate:
# construct a rectangleGate - co-ordinates supplied on transformed scale
rg <- rectangleGate(
filterId = "DNA_gate+", # label the gate
"140Ce" = c(0, 10),
"DNA1" = c(7, 15)
)
# fs is your flowSet - fs_sub is a flowSet of events inside the gate
fs_sub <- Subset(
fs,
rg
)
If you want to have separate gates for every sample, you can include them in a list()
named with sampleNames()
:
# rectangleGate list - example for flowSet with 2 samples (i.e. 2 gates)
rg_list <- structure(
list(
rg, # any gate objects can be added here - one per sample
rg
),
names = sampleNames(fs)
)
# Subset samples individually
fs_sub <- Subset(
fs,
rg_list
)
I'd recommend using ggcyto
to visualise the results:
ggcyto(
fs,
aes(140Ce, DNA1)
) +
geom_hex( # add points
bins = 256
) +
geom_gate( # add gate
rg
) +
geom_stats( # add statistics
type = "percent"
)
Hello,
I am trying to apply some filter on my data and plot them before and after the filter is applied.
I have a specific type of flow set for which I have renamed some channels:
fset=read.ncdfFlowSet(paste0(adir, l_files), channel_alias = map, emptyValue = FALSE)
I have transformed it:And now I want to apply a rectangular gate:
But I get this error:
If I use "filter", without specifying that it is from flowcore:
fset1[[i]]=filter(fset[[i]], rg)
I get:
Any Idea why what I am doing is wrong?
Here is my sessioninfo: