RGLab / CytoML

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

Using FlowJo gating on pre-compensated, pre-transformed FCS files #146

Open timmocking opened 2 years ago

timmocking commented 2 years ago

Hi all,

In my experiment I'm compensating and transforming individual FCS files using flowCore before aggregating these FCS files into one big concatenated flowframe using FlowSOM's AggregateFlowFrames. I want to gate this data in FlowJo and import this using flowjo_to_gatingset. However, I get the following error:

library(CytoML)

wsfile <- FILENAME
ws <- open_flowjo_xml(file=wsfile, options = 0, sample_names_from = "keyword" )
gs <- flowjo_to_gatingset(ws, name = 1, includeGates = T, path=path)
Error in (function (ws, group_id, subset, execute, path, cytoset, backend_dir,  : 
  please call buildHash() first to build the hash map for column index!

It should be noted that my files do not contain a spillover matrix (due to the aggregation) and are already transformed. I suspect that his has something to do with the error.

Is there some way to get to gating labels without applying trying to re-apply compensation and transformation FlowJo?

gfinak commented 2 years ago

Not that I'm aware of a the moment. flowJo to gating set conversion was built for importing data analyzed using a standard widespread workflow from flowJo, it makes some assumptions about what that workflow is, including that that data has been transformed and compensated in flowJo.

mikejiang commented 2 years ago

Your error message seems to be indicating something wrong with fcs files you feed to this converter, which could be due to the reason Greg mentioned. Is the fcs written by flowcore or flowjo? Feel free to share the reproducible example data for troubleshooting

timmocking commented 2 years ago

The FCS file is written by FlowCore and is like I said pretty abnormal (e.g., no spillover matrix etc.) compared to a regular FCS file. Unfortunately I cannot share the file due some restrictions in this study. However, I think any FCS file generated by the AggregateFlowFrames function of FlowSOM would result in the same errors..

I managed to solve my issue by using execute=FALSE after which I wrote a small script to browse through the gating hierachy in order to get the correct labeling based on the leaf nodes. Do you know of any functions that can do the same thing? My implementation works but I would like to use something a bit less "hacky".

mikejiang commented 2 years ago

maybe you can try to export fcs from flowjo, and use that together with wsp file to see if that works. I am not asking for the original data, any reproducible example will help us to further assist you

SamGG commented 2 years ago

Could you send directly to Mike a FCS with 20 events? I don't think this will reveal much of you study.