version (2.43 MB) by Rachel Finck
Functions to import gates, transformations and compensations of cytometry data.


Updated 20 Jan 2015

View License

An object of the gatingML class is a set of compensations, transformations, and gates as defined by a Gating-ML file.

To create a gatingML object by specifying the Gating-ML file, use the gatingML constructor. To associate the gatingML object with a particular fcs file, use the load_fcs_file method. To apply gates to the loaded fcs file, use the apply_gate method.

gatingML requires two functions from the the Mathworks File Exchange: the XMLNode function (#34711) and the fca_readfcs function (#9608). Versions of them that are compatible with this implementation of gatingML are included here.

If you will be using the logicle and/or hyper log transformations, you will need to download and install the logicleTransform (#45022) and/or hyperlogTransform (#45034).

A gatingML object has the following properties:

xml: An XMLNode object created from the Gating-ML file
transforms: A structure array of transformations included in the Gating-ML file. A function to apply a transformation with name trans_name is found in obj.transforms.(trans_name).fun
comps: A structure array of compensations included in the Gating-ML file, each including the compensation matrix and relevant parameters
gates: A structure array of gates included in the Gating-ML file, with fields listing original gate name, parent gate, and gate type. The method apply_gate adds the field inGate, which is a logical vector indicating each cell's inclusion in the gate.

fcsData: A structure array of compensated data matrices, which are created by gatingML.load_fcsfile. The original data is assumed to have the channel-to-scale transformations already applied. To load this data from an fcs file, use the third output (fcsdatscaled) from the function fca_readfcs. The method load_fcs_file then creates a matrix and list of relevant parameters for each compensation.

fcsHdr: An fcs file header created from fca_readfcs.m, which is created by the method load_fcs_file

An example can be found in the file gatingML_example.m


J. Spidlen, International Society for the Advancement of Cytometry Data Standards Task Force, and Brinkman, R.R. (2013). Gating-ML 2.0 -- International Society for Advancement of Cytometry (ISAC) stanford for representing gating descriptions in flow cytometry. Retrieved from

J. Spidlen and N. Gopalakrishnan. gatingMLData: Data and XML files for Gating-ML Test suite. R package version 2.1.4.

Cite As

Rachel Finck (2022). Gating-ML (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2013b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!