RGLab / CytoML

A GatingML Interface for Cross Platform Cytometry Data Sharing
GNU Affero General Public License v3.0
29 stars 14 forks source link

How to extract the FCS filename from a gatingset #131

Closed Close-your-eyes closed 3 years ago

Close-your-eyes commented 3 years ago

Dear all,

for the ordinary not-R-user the filename of an FCS file as seen in the explorer (windows) or finder (mac) is the primary way to identify files and their content. This filename may be subject changes as generally opposed to the "name" or "sampleName" in the meta data (aka "$FIL" keyword).

In order to communicate with these not-R-users about samples I am asking to how to pull out these FCS filenames from a GatingSet.

I used to do it this way, but this has stopped working as of BioConductor 3.12. Maybe it only worked in 3.11:

sampleNames(gs) <- unlist(lapply(1:length(gs), function(x) {basename(flowWorkspace::gh_pop_get_data(gs[[x]])@description[["FILENAME"]])}))

Also, this does not work when the gs <- CytoML::flowjo_to_gatingset() is run with execute = F.

So, is there an elegant way to pull out the actual filenames of fcs files in a gatingset?

mikejiang commented 3 years ago

accessing the directly s4 slots through @ should be avoided (since it is internal data structure subject to changes). Use public methods instead, in this case keyword(gh_pop_get_data(gs[[x]]))[["FILENAME"]]

execute = F only parse the xml and doesn't load FCS files, thus no keyword available for gs. but you can Retrieve keywords associated with that xml workspace, see ?fj_ws_get_keywords