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 remove unwanted gates prior to execute in flowjo_to_gatingset #117

Closed malisas closed 3 years ago

malisas commented 3 years ago

I am trying to load a FlowJo 10 workspace which:

1) Has a lot of unneeded and unwanted gates, 2) Has different gating trees even within the same sample group, and 3) Results in the following error if I set execute = TRUE in flowjo_to_gatingset(), even when loading a single sample (using the subset option):

Error in .cpp_gating(gs@pointer, mat, guid, gains, nodeInd, recompute,  : 
  Reference node: Time B+ or Time B2+ or Time B3+ or Time G+ or Time G2+ or Time G3+ or Time R+ or Time R2+ or Time R3+ or Time V+ or Time V2+ or Time V3+/Single Cells/Keeper gate 1/Keeper gate 2/CD3/Keeper gate 3/live/TRAV1-2 not found!

I know that the inconsistent gating trees and the error are all due to gates that I don't care about and are unnecessary. So, I thought that I should try to remove those gates before the gates get computed, in order to avoid the errors:

I tried running flowjo_to_gatingset with execute = FALSE (great, no more errors!) and was then able to use groupByTree() and gs_pop_remove() in a loop to remove the unwanted nodes and get a consistently gated GatingSet, thinking that I could call execute() after this step. I noticed that there doesn't seem to be a user-callable execute() function, and in fact the documentation for flowjo_to_gatingset() says:

To execute the gating of each data file, a call to execute() must be made on each GatingHierarchy object in the GatingSet. This is done automatically by default, and there is no more reason to set this argument to FALSE.

I feel like my situation could benefit from something like an execute() function, however.

I also tried the combination of the options execute=TRUE and includeGates=FALSE, thinking I could add the gates later, but then it says:

Error in .cpp_parseWorkspace(xmlFileName, sampleIDs, guids, includeGates,  : 
  gate is not parsed!

Does anyone have any suggestion for where to find such an execute() function, or perhaps some other work-around to get rid of unwanted gates via OpenCyto?

Thank you, I hope this is clear!

mikejiang commented 3 years ago

How about try skip_faulty_gate = T?

malisas commented 3 years ago

Hi Mike, thank you for your suggestion! What a timely addition to CytoML. I'm actually having a bit of trouble installing the latest CytoML version, so for now as a work-around I just ended up generating a list of inconsistent gates via OpenCyto, opening up the demo version of FlowJo 10, and manually deleting all the unwanted gates from the workspace in FlowJo 10. So I'll close this issue for now, but I will try to report back once I troubleshoot/update R and try out skip_faulty_gate = T. Thanks!