Code covered by the BSD License  

Highlights from
Flow Cytometry GUI for Matlab

5.0 | 1 rating Rate this file 51 Downloads (last 30 days) File Size: 8.35 MB File ID: #38080 Version: 1.3
image thumbnail

Flow Cytometry GUI for Matlab



10 Sep 2012 (Updated )

This GUI was built in order to make Flow Cytometry data analyses in Matlab – gating, statistics etc.

| Watch this File

File Information

Elaborate documentation can be found in the 'FCGUI_help.pdf' file.
Some of its functionalities:
* Present scatter plot (+density color map) or histograms (+values of statistical measures), of FC data and of gates, X and Y axis selection among the different parameters that were collected, linear or logarithmic display, and option to export the plot to a separate Matlab figure
* Move between FC files keeping the same display setting
* Gating in different methods: manually – draw a shape on the plot, automatically – select # cells from a center (circle, or according to the density of cells in plot), quadrants, thresholds on histogram plot, and logical operations on the created gates
* Saving the data of cells included in a gate, or the gate coordinates, into .mat files, and load it on a different FC data file
* Make calculations on the collected parameters for each cell (e.g. normalize fluorescence to SSC)
* Make a multiplot figure of scatter plots or histograms, of a few FC data files.
This GUI was built with the aid of the 'GUI layout toolbox' (file exchange submission, see link below), and it is required for its functionality, download it and run the 'install.m' file there.
This submission includes the following file exchange submissions: 'Fast points-in-polygon test' by Darren Engwirda, ' Distance from a point to polygon' by Alejandro Weinstein, 'Subaxis - Subplot' by Aslak Grinsted, see links below.
Please, help to improve it:
1. Report any bug or inconvenience you experience.
2. Make suggestions on how to improve it.
3. Modify the code and share what you changed.
Some open issues:
1. Logicle (biexponential) display is missing. An implementation of the logicle transformation in Matlab is needed (see Parks et al. 2006, and Moore and Parks 2012 papers).
2. 'Fast points-in-polygon test' by Darren Engwirda, was found to be faster here in the .mex file version (see '2D polygon interior detection' by Bruno Luong). It was not included here to simplify installation and compatibility issues (see remark in help file section 1 for how to use it here).

Nitai Steinberg
At Prof. Yitzhak Pilpel Lab,
Molecular Genetics Department
The Weizmann Institute of Science


Subaxis Subplot, Fast Points In Polygon Test, Distance From A Point To Polygon, Gui Layout Toolbox, 2 D Polygon Interior Detection, and Gui Layout Toolbox inspired this file.

Required Products Image Processing Toolbox
Statistics and Machine Learning Toolbox
MATLAB release MATLAB 7.11 (R2010b)
MATLAB Search Path
Other requirements This GUI was built with the the 'GUI layout toolbox' (file exchange submission, see link), and it is required for its functionality, download it and run the 'install.m' file there. for MATLAB R2014a or earlier use 27758 MATLAB R2014b or later use 47982
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (11)
05 Feb 2016 Nitai Steinberg

I am happy to hear that.
Please tell me if you encounter any other problem.
Good luck!

Comment only
03 Feb 2016 Estelle Dacheux

Dear Nitai,

Sorry for not getting back to you earlier (I switched to something else for a while).
I just had a try and it works perfectly now. Thank you very much for your help.

Best wishes.


Comment only
18 Jan 2016 Nitai Steinberg

Dear Estelle,

OK, I think that I understand now what I meant, and I corrected the error in the new version I now uploaded.

Please tell me if it now works for you (also without using logical gates, but just unselect 'all data' as you did before).

Thanks again for letting me know,

Comment only
18 Jan 2016 Nitai Steinberg

Dear Estelle,

I am afraid it is the same problem, and because a lot of time passed since I wrote this code, it will take me a while to fix it...
The reason is, that I think that MATLAB changed in the newer versions some things that now the code I wrote needed to be changed a little bit in order to be again compatible with those changes. But I need to remember why I wrote those lines and then rephrase them.
I think that for now - as a workaround, temporary solution to the problem - you can create two separate gates - one with the radial option, and the other with the trimmed population, and then intersect them using the logical gate (marked with the red intersection symbol). I tried it and it works.
In the meanwhile I will try to understand my code, and fix those problematic lines.
Thank you for raising these issues, and please tell me if it worked for you.

Comment only
15 Jan 2016 Estelle Dacheux

Dear Nitai,

Thank you very much for the update. I played a lot with the app yesterday and I still have some trouble. Making a gate on the whole population works, but when I try to create a gate automatically (using the "radial" option, a center and a certain number of cells) on a subpopulation (for example trimmed off 5% top and bottom SSC-A and FSC-A values but kept as population, or just a rectangular gate I drew), then it gives me the same kind of error as before:

Error using num2str (line 45)
Input to num2str must be numeric.

Error in FCGUI_main/saveGate_callback (line 1622)
(~strcmp(num2str(hObject),'logical') && ...

Error while evaluating UIControl Callback

Is it because it never was possible to create another subpopulation within a previously selected population or is it because there still are some problematic lines within the code?

Many thanks in advance for your help.


Comment only
20 Dec 2015 Nitai Steinberg

Dear Estelle,

Thank you for your comment!
I don't know why I wrote it the way I did (it is a long time since I touched this code) - but maybe it is a matter of Matlab versions... not sure. But I also had this error when trying to use it in 2015a, and I built it in 2010b, so maybe something changed with one of Matlab functions...

I am uploading a fix of this line (just removed the num2str in this line) - I hope it will not make problems for people who use earlier versions of Matlab...

Tell me if you encounter more problems.


Comment only
17 Dec 2015 Estelle Dacheux

Dear Nitai,

I systematically get this error message whenever I am trying to save a gate:

Error using num2str (line 45)
Input to num2str must be numeric.

Error in FCGUI_main/saveGate_callback (line 1771)
if ~ismember(1,chosenGates) || strcmp(num2str(hObject),'logical')

Error while evaluating UIControl Callback

Without gating, no analysis possible... Hava you any idea of what is wrong?
Many thanks in advance for your help.

Best regards,


Comment only
24 Nov 2013 Nitai Steinberg

Dear Joakim Sandstedt,
Thank you for your comment, I am happy you use this software and like it.
About the error message you encounter, it looks like it relates to the "GUI Layout Toolbox" I used to build this GUI (
I don't know what cause this specific error, but if I have to guess, it might be related to the Matlab version that you use.
Do you encounter problems in changing the window size? or is it just this error that appears in the beginning and that's it?
If you want you can address the people that wrote the toolbox and describe what you experience. I am sorry but I am not familiar with their code, I just used it, so I can't help you more than this...
In any case I hope you can still work with this software, and please tell me about any other problem you encounter, and I hope I could be more helpful :)
Good luck,

Comment only
21 Nov 2013 Joakim Sandstedt

Dear Nitai Steinberg!

Thank you for an excellent application for analysis of FACS data which I also plan to use for quantification of immunocytochemistry data obtained from CellProfiler. I'm quite new to the Matlab script language, but I noticed when I started the program the following error message:
Error using set
Values must be finite and non-NaN

Error in uiextras.Container/repositionChild (line 376)
set( child, propname, position );

Error in uiextras.VBox/redraw (line 88)
obj.repositionChild( child, newPosition );

Error in uiextras.Container/onResized (line 326)

Error in uiextras.Container>@(varargin)obj.onResized(varargin{:}) (line 90)
obj.Listeners{end+1,1} = handle.listener( containerObj, findprop(
containerObj, 'PixelBounds' ), 'PropertyPostSet', @obj.onResized );

The application seems to be working correctly, so this might not be anything of importance. Thanks again for a very nice application.

Kind regards

Joakim Sandstedt M.D., PhD student

Department of Clinical Chemistry and Transfusion Medicine,
Institute of Biomedicine, The Sahlgrenska Academy

02 Apr 2013 Nitai Steinberg

Hi Nicole,
Thank you very much for the feedback, it is very important to me.
About the issues you raised:
- I also have Windows machine, and I didn't experienced these problems. I used "\" and not "/" as far as I noticed... (at least in 'private\rorchach.mat' I used "\" and I tried to look for "/" in the file and saw it only in divisions). But please tell me if I am mistaken.
- As for the implementation of the logicle display, I need help, I am not sure I know how to do it efficiently.
- I didn't experience the issue with the little log scale tick marks in 2D plots... If you could tell me exactly which settings you used, or even send me a screenshot it would be helpful.
- About multiple plot of the same file using different X and Y axes for each plot, there is no such option for now. I need to think about it, another person raised a similar issue regarding the multiple plots. I created it for my own use, but I understand that there are many things I didn't think about. Maybe I could try to change it in future version...
Thanks again for your feedback!

Comment only
27 Mar 2013 Nicole

Nicole (view profile)

This is an excellent flow cytometry toolkit/gui for matlab. What I like most about this plug-in is the fact that I don't have to be a matlab master to use it. I hope you continue to develop it since it has a lot of potential.

- There are some path issues in using this plugin on a Windows installation of matlab involving \ vs /. Once repaired, the software works as advertised. (I fixed it awhile ago on my copy, so I fear I've forgotten which files are affected. But at the very least, do a search for "private/rorschach.mat" in FCGUImain.m and change to "private\rorschach.mat" if you have a Windows machine. I seem to remember at least one other file needs a similarly trivial change.)

Feature Requests:
- As you said in "open issues," implementing a logicile/biexponential display would be very beneficial.
- When I try to make a multiple plot figure of 2D histograms, and set them to have the same x/y scale (i.e. 1:1), the little log scale tick marks don't follow suit. I end up deleting them by hand.
- While I can clearly see how to make a multiple plot of several different files, using the same dyes for their x and y axes, I don't see how to make a multiplot of the same file using different dyes for the x and y axes.

Thank you for your hard work on this plug in.

Comment only
11 Sep 2012 1.1

There was a mistake in the 'inpoly' version I put in the .zip folder, now it is the correct form.

22 Jul 2015 1.1

The GUI layout toolbox has two versions
for MATLAB R2014a or earlier
MATLAB R2014b or later

20 Dec 2015 1.2

Bug in lines 1771-1773 in FCGUI_main.m file was fixed due to incompatibility with newer Matlab version

18 Jan 2016 1.3

More compatibility issues with newer Matlab versions, hopefully this time I fixed most

Contact us