I am trying to gate a flowSet and then take the gateSet and export it to separate fcs files, which should have only the data I chose to gate.
My commands are as follow.
####Read the fcs files with the names i want####
s <- read.flowSet(path = path,files = secondary_datasets,transformation = FALSE, sep="\t")
####Apply the gating with a custom matrix (mat) i have created in the parent my user gives previously as input#####
gs <- GatingSet(fs)
bf <- rectangleGate(filterId=id, .gate=mat)
add(gs, bf, parent=parent)
recompute(gs)
#####Then try to export the new FCS files######
write.flowSet(gs@data,outdir = path,"test")
The problem is my newly created FCS files (1_test, 2_test) are the same with the pre-gated ones. I can see that the files in the flowSet are being loaded properly and the gating gives me no errors, so I guess it works properly as well, since it is a couple lines of code. What am I missing?Doesnt the gs@data give me the gated flowSet? How can I get it if not?
Sorry if I didnt make my problem clear enough, I'm not a biologist.