renaming flow frames in a flowSet using flowCore
1
0
Entering edit mode
6 weeks ago

I'm working with flow cytometry data and I'm reading a set of FCS files into a flowSet using flowCore. By default the individual frames for the FCS files are named with the file name of the FCS file which is long and cumbersome. I would like to rename the frames in the flowSet object without changing the filenames (or copying them and renaming the copies) Is there anyway to do this? I could not find an explanation on how to rename frames in the flowCore documentation. This is what I have tried:

fs <- read.flowSet(sample_files, emptyValue=F, identifier=str_extract(sample_files,'sample_\\d+\\.fcs$'))

However the frames are still identified by the full cumbersome file name instead of a shorter string. Is there a way to rename them during the call to read.flowSet or rename them after the flowSet object is created?

flow cytometry R flowCore • 122 views
ADD COMMENT
1
Entering edit mode

Have you taken a look at the pData() slot for fs? Otherwise, try running str(fs) to see how the internal objects are structured and arranged.

ADD REPLY
2
Entering edit mode
6 weeks ago
jaro.slamecka ▴ 140

I think the key could be changing the GUID of each flowFrame, however, the method sampleNames() should take care of it, after you load the flowSet:

sampleNames(fs) = str_extract(sample_files,'sample_\\d+\\.fcs$')
ADD COMMENT
2
Entering edit mode

This worked! Thank you!

For future reference I did the following:

sampleNames(fs) <- str_extract(sample_files,'sample_\\d+\\.fcs$')
pData(fs)$name <- str_extract(sample_files,'sample_\\d+\\.fcs$')

This changes the flow frame reference in the flowset object and changing the name field in pData changes how ggcyto labels the plots. sampleNames is part of the flowWorkspace package.

ADD REPLY
0
Entering edit mode

Please mark as Accepted (the answer)

ADD REPLY

Login before adding your answer.

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