Exporting FCS files from GatingSet
1
0
Entering edit mode
@jordanxanthopoulos-11527
Last seen 7.8 years ago

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.

flowcore opencyto gating flowset • 2.2k views
ADD COMMENT
0
Entering edit mode
Jiang, Mike ★ 1.3k
@jiang-mike-4886
Last seen 3.1 years ago
(Private Address)

Directly access the S4 object slots with '@' is generally in R (discouraged unless you know exactly what you are doing) because it goes against one of the central principles of Object Orient design of S4: Abstraction.

So basically you should use whatever methods/functions provided by the "flowWorkspace" package to interact with "GatingSet" object, in this case, you want to use 'getData' method. e.g.

fs_gated <- getData(gs, nodeName)

Get more details in 'help(getData)'  and I also recommend you to take a look at the vignettes of both "flowCore" and  'flowWorkspace" package to familiarize yourself with the APIs.

 

ADD COMMENT

Login before adding your answer.

Traffic: 587 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