Code covered by the BSD License  

Highlights from
FCS data reader

4.16667

4.2 | 6 ratings Rate this file 64 Downloads (last 30 days) File Size: 18.5 KB File ID: #9608

FCS data reader

by

 

13 Jan 2006 (Updated )

Read FCS 2.0 and FCS 3.0 format flow cytometry files

| Watch this File

File Information
Description

[fcsdat, fcshdr, fcsdatscaled, fcsdat_comp] = fca_readfcs(filename);
Read FCS 2.0 and FCS 3.0 type flow cytometry data file and creates the fcsdat array with the size of [NumOfPar TotalEvents].
 Some important header data are also stored in the fcshdr structure:
 TotalEvents, NumOfPar, starttime, stoptime and specific info for parameters
 as name, range, bitdepth, logscale(yes-no) and number of decades.

 [fcsdat, fcshdr] = fca_readfcs;
 Without filename input the user can select the desired file using the standard open file dialog box.

[fcsdat, fcshdr, fcsdatscaled] = fca_readfcs(filename);
Supplying the third output the fcsdatscaled array contains also the scaled parameters. It might be useful for logscaled parameters.

[fcsdat, fcshdr, fcsdatscaled, fcsdat_comp] = fca_readfcs(filename);
In that case the script calculates the compensated fluorescence
intensities (fcsdat_comp) as well, if spillover data exist in the header

The program should work also in the case of Becton EPics DLM FCS2.0, CyAn Summit FCS3.0, FACSDiva, BD LSR-II, Partec, Accuri and Luminex type list mode files.

If you find unsupported LM file type please email me.

You can also find a complex flow cytometry data evaluation toolbox(GUI) at the FileExchane area including this function and containing more specific options:

http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=8480&objectType=file

Acknowledgements

This file inspired Gating Ml.

MATLAB release MATLAB 7.10 (R2010a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (9)
15 May 2014 William

Thank you for this code.

I had some trouble with it, because I had an FCS 3.0 file that had some parameters which were 16 bit and some which were 32 bit. As far as I can tell, that kind of mixing is allowed FCS 3.0, so I tried to change the code to handle it correctly.

In the part that actually reads the data, I changed

fcsdat = fread(fid,[fcshdr.NumOfPar fcshdr.TotalEvents],'uint16',machineformat)';

to

fcsdat = fread(fid,[sum([fcshdr.par.bit]/16) fcshdr.TotalEvents],'uint16',machineformat)';

and that seemed to take care of it. You may want to upgrade the other datatypes to use that same method, or some other even better method.

Also, my file used linefeed, ASCII code 10, as the mnemonic separator.

Thanks again!

18 Nov 2013 Irena Kuzmanovska

Thanks a lot for the script!
I was wondering if it is suitable for reading fcs files exported with the FlowJo software. Somehow I have difficulties reading them. Once read, the data looks different from what I actually see in FlowJo.
Cheers!

20 Jul 2013 Sushant

I found the script very readable & well commented. Thank you!

If you have some time, I have a question; I have what seems to be a clear-cut header file off a MoFlo XPD. I didn't think the necessary tweaks to the script were iffy in any sense. Still, I'm having trouble reconciling the parsed output with the proprietary MoFlo software's values. There are orders of magnitude differences.

Again, I don't think it's an issue with your script at all.. I'm just a little lost.

I don't want to spam the thread (any further, that is), so I will only PM you more details if you reply.

30 Dec 2011 Malcolm McFarland

I was initially unable to get this code to read BD Influx FCS files created with Sortware software. I found that the mnemonic_separator is 'LF' (line feed) and the data precision is 'uint16'. I modified the get_mnemonic_value subfunction and the section that reads events. It now works well, although I think some header information is missing. Thanks for some very helpful code.

20 Jun 2011 Avaneesh

This code can't be used to read Accuri C6 FCS3.0 files. I find that the mnemonic separator is '/'. Made the required changes in the code, works great.
Great code!

14 Oct 2008 Quanyuan He

It works well, Thank you.

20 May 2008 * *

*

10 Aug 2006 Brian Harms

Overall nice file. One small error in the code: in line 181 (which converts log-scale FACS data to linear-scale data), the variable "fscdat" needs to be changed from uint16 to double in order for the code to work properly.

24 Apr 2006 Ivan Cao-Berg

I find it is an excellent script. But I do have one comment.
In line 64 you can find the following code

fid = fopen(filename,'r','ieee-be');

If you are using a Windows, Matlab will not have a problem. If you are using Linux you should change the line to

fid = fopen(filename,'r','b');

Technically 'ieee-be' and 'b' are to suppose to be the same option. But I had problems and I fixed it that way.

Updates
20 Mar 2006

Updated to read Becton EPics DLM FCS2.0 and CyAn Summit FCS3.0 type list mode files

16 Aug 2006

Repairing the code suggested by Brian Harms and Ivan Cao-Berg at the user reviews. Thanks the comments!

16 Aug 2006

Refreshing the code according to the user comments and updating the description.

08 Feb 2009

Updated to read the Partec CyFlow format file. Thanks for
Gavin A Price

08 Feb 2009

Updated to read the Partec CyFlow format file. Thanks for
Gavin A Price

28 Feb 2009

The help section of the m file was modified.

07 Mar 2009

Additional minor changes on the help section.

19 Nov 2011

Updated to read Luminex 100 data file. Thanks for Ofir Goldberger, Stanford University

13 May 2013

The fluorescence compensation has been implemented into the code. Thanks for Rick Stanton, J. Craig Venter Institute, La Jolla, San Diego

13 May 2013

The fluorescence compensation has been implemeted into the code. Thanks for Rick Stanton, J. Craig Venter Institute, La Jolla, San Diego

27 Dec 2013

More accurate compensation correction, gain scaling and appropriate reading for large file size are added. Thanks for Rachel Finck; Garry Nolan's lab at Stanford University and Andrea Pagnani; Politecnico Torino, Human Genetics Foundation.

28 May 2014

The FCS 3.0 standard enables the mixture of word lengths in the data, this upgrade modified the code according to. The linefeed (ASCII code 10) as
the mnemonic separator was also added.
Thanks for William Peria /Fred Hutchinson Cancer Researc

Contact us