RGLab / CytoML

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

GatingSet2flowJo: ability to export “group-level” gates #67

Open malisas opened 4 years ago

malisas commented 4 years ago

Summary: Can there be an option to export a gate or gates as “group”-level gates when using GatingSet2flowJo()?


Apologies in advance for repeating things you already know.

In FlowJo, gates either belong to a group (e.g. “Cord Blood Samples”) or to individual samples. Group-level gates get applied to all samples in a group with one click, whereas individual-level gates must be applied one-by-one (rather tedious). One of the consequences of this distinction is that “group”-level gates cannot be added as a child of an “individual”-level gate (but individual-level gates can be added as a child of a group-level gate).

When I read a FlowJo workspace into openCyto, the distinction between the two types of gates is not preserved. To note, I actually like this behavior because it makes it easier for me to manipulate gates for many samples at once.

If I then run GatingSet2flowJo(), all the gates in the resulting FlowJo workspace will get converted to “individual"-level gates, regardless of their original status. In FlowJo I am unable to then add group-level gates as children of these individual-level gates.

I would appreciate the option to export gate(s) as group-level gates.

Note:
In FlowJo, you can apply a group-level gate and then modify the gate for one or more samples. These modified/non-uniform gates are still group-level gates (in that I believe you can still add group-level gates under them), but I am not sure how they get stored in the FlowJo workspace xml. I think that figuring this out will be important, especially for exporting non-uniform group-level gates.

Thanks for all your efforts, as always!

mikejiang commented 4 years ago

When the flowjo workspace is parsed into GatingSet, the group-level gates are not imported. Currently GatingSet simply doesn't have mechanism to store it. Regarding to gatingset_to_flowjo, we can randomly pick one sample (say the first ) and copy all its gates to group-gates (but it won't be the original group-gates from flowjo workspace), will that work for your case?

malisas commented 4 years ago

Hi Mike, thanks for your response!

In regards to your proposal to randomly choose a sample and copy all its gates to group-gates:

This would work for group-gates which are identical across all samples.

However, I sometimes have 'non-uniform group-level' gates, e.g. a Lymphocyte gate which is the same for most samples but has been modified for a few samples. In my case, I would appreciate an option that can retain the 'non-uniformity' of the group-gate. Essentially it is like an individual-gate, but stored as a group-gate. :sweat_smile:

So for me it would be useful to be able to choose whether to export any given gate as a "group" or "individual"-level gate, while preserving the non-uniformity of it. (Of course, while respecting the rule that group-gates cannot exist as children of individual-gates...)

(BTW, at the moment, I don't have a need to preserve the original FlowJo group-gate or individual-gate status of the gates, as long as I can choose the export status. Tracking this information might help with the export function though...?)

mikejiang commented 4 years ago

Not sure that I follow the exact workflow that you are describing. As far as I can understand, the gates from the group are either synchronized (i.e. identical across samples) or non-synchronized (i.e. adjusted individually sample-wise). For the latter, the group gate is no longer in sync with all samples and then you have to click on each sample-gate for the adjustment. Why would the preservation of that original version of group-gate matter to you?

gfinak commented 4 years ago

I think @malisas is referring to having multiple groups, is that correct? In any case, this is not a priority for us right now, and we have a lot on our plate at the moment. Let's keep this issue open and revisit it in the future.

malisas commented 4 years ago

Hi Mike and Greg,

I am referring to 'non-synchronized group-gates' (or what I have been calling 'non-uniform group-gates').

FlowJo allows me to add a group-gate as a child of a 'non-synchronized group-gate'. This is a nice time-saving feature to have. Sorry for not being clearer earlier!

mikejiang commented 4 years ago

Isn't the synchronization flag global (i.e either all gates are synced or non-synced)? What do you mean by add a group-gate as a child of a 'non-synchronized group-gate?

malisas commented 4 years ago

Hi Mike, I sent you a Google Drive link via email to show you what I'm talking about.

mikejiang commented 4 years ago

Based on what you've shown, you basically need a group that contains the same gating tree as the individual samples so that you can add a new gate to all samples by simply

If so, what I proposed (select one gating tree from one sample and store it in group node) should work for you since you don't really care about the actual gate coordinates in that group node (they are not in synced with samples anyway), it is the tree structure you want to retain for adding new gates.

malisas commented 4 years ago

I do care about the actual gate coordinates for these modified/out-of-sync/non-uniform group gates.

The functionality that I'm trying to retain is: