FCS (.fcs, .lmd)
Background & Context

-
- FCS molecular biology format.
- Standard format for storing and exchanging flow cytometry data.
- Mixed ASCII/binary format.
- Stores signal intensities for cell events as an array.
- Metainformation about the data acquisition is stored in the file.
Import & Export

- Import["file.fcs"] returns an array representing the cellular events stored in the file.
- Export["file.fcs",{paramnames,events}] exports a list of parameter names and an array of events to the FCS format.
- Export["file.fcs",{paramnames,paramreagents,events}] exports a list of parameter names, a list of parameter reagents, and an array of events to the FCS format.
- Import["file.fcs",elem] imports the specified element from an FCS file.
- Import["file.fcs",{{elem1,elem2,…}}] imports multiple elements.
- The import format can be specified with Import["file","FCS"] or Import["file",{"FCS",elem,…}].
- Export["file.fcs",{expr1,expr2,…},{{elem1,elem2,…}}] treats each expri as specifying the corresponding elemi.
- Export["file.fcs",expr,opt1->val1,…] exports expr with the specified option elements taken to have the specified values.
- Export["file.fcs",{elem1->expr1,elem2->expr2,…},"Rules"] uses rules to specify the elements to be exported.
- See the following reference pages for full general information:
-
Import, Export import from or export to a file CloudImport, CloudExport import from or export to a cloud object ImportString, ExportString import from or export to a string ImportByteArray, ExportByteArray import from or export to a byte array
Import Elements

- General Import elements:
-
"Elements" list of elements and options available in this file "Summary" summary of the file "Rules" list of rules for all available elements - File metadata:
-
"Header" raw file header given as a list of rules - Data representation elements:
-
"Events" cellular events as an array "ParameterName" parameter names as a list of rules (import) or a list (export) "ParameterReagent" parameter reagents as a list of rules (import) or a list (export) - Additional data elements:
-
"Data" cellular events as an array "LabeledData" list of rules for data stored in the file - Import uses the "Events" element by default for the FCS format.
- Export requires at least a list of parameter names and an array of events.
- Export can optionally take a list of parameter reagents. All other optional keys must be specified via the "OptionalKeys" option.
Options

- Advanced Export options:
-
"DataType" Automatic data type used to encode events "OptionalKeys" {} optional keys to include in the header, as a list of rules - The Wolfram Language attempts to identify the most compact format in which the events can be encoded. Automatic data type identification may be overridden via the "DataType" option.
- Valid settings for "DataType" are:
-
"UnsignedInteger8" 8-bit unsigned integer "UnsignedInteger16" 16-bit unsigned integer "UnsignedInteger24" 24-bit unsigned integer "UnsignedInteger32" 32-bit unsigned integer "Real32" IEEE single-precision real number "Real64" IEEE double-precision real number - The Wolfram Language will automatically overwrite certain protected keys (such as "$BEGINDATA" and "$BYTEORD") that are specified in "OptionalKeys". Thus, if you are re-exporting an imported FCS file, you may directly set "OptionalKeys" to the value of the "Header" element from the imported FCS file. Parameter reagents ("$PnS" keys) will be removed from "OptionalKeys" only if parameter reagents are provided in the main Export expression.
Examples
open allclose allBasic Examples (7)Summary of the most common use cases
Read the file header from a sample FCS file:

https://wolfram.com/xid/0jh4kjuv-jwid3c

Read the parameter names and reagents:

https://wolfram.com/xid/0jh4kjuv-nj1

Read events and display the first several in a table:

https://wolfram.com/xid/0jh4kjuv-nm8hla

Export an array of event values with parameter names:

https://wolfram.com/xid/0jh4kjuv-bfg1jp

Specify a data type to use when exporting:

https://wolfram.com/xid/0jh4kjuv-jid9kx

Export an array of event values with parameter names and parameter reagents:

https://wolfram.com/xid/0jh4kjuv-cfkgph

Export a version of a data file with the same header, but with a small subset of the events:

https://wolfram.com/xid/0jh4kjuv-j3t15h

https://wolfram.com/xid/0jh4kjuv-dtxqth

Scope (6)Survey of the scope of standard use cases
Plot the untransformed events in a density histogram:

https://wolfram.com/xid/0jh4kjuv-dhvi4c

Plot the events with axes transformed by ArcSinh as a shaded contour plot:

https://wolfram.com/xid/0jh4kjuv-igduil

https://wolfram.com/xid/0jh4kjuv-wh8jd

Use FindClusters to automatically detect similar groups of cells:

https://wolfram.com/xid/0jh4kjuv-20col

Create a grid of 25 of the possible biaxial plots:

https://wolfram.com/xid/0jh4kjuv-ivvxla

https://wolfram.com/xid/0jh4kjuv-c262h

Perform polygon gating of cell populations:

https://wolfram.com/xid/0jh4kjuv-c90ljr

https://wolfram.com/xid/0jh4kjuv-e5wzgw

https://wolfram.com/xid/0jh4kjuv-b5sp6q

https://wolfram.com/xid/0jh4kjuv-ewcay8

The FCS standard does not support negative integers:

https://wolfram.com/xid/0jh4kjuv-fkp4xc



Alternatively, export negative integers as reals:

https://wolfram.com/xid/0jh4kjuv-d5pcy3
