Knowledgebase: R Integration - FlowClean Script

More Testimonials

“Very nice, and remarkably easy to implement flowClean! [in FCS Express]…the fact that you supplied the proper code ready-made doesn't hurt…..Who knew you already had it implemented so cleanly and with such well-written implementation instructions? ”

- Robert W. Baer, Ph.D.
Professor of Physiology Kirksville College of Osteopathic Medicine
A T Still University of Health Sciences

FlowClean via R Integration in FCS Express

FlowClean is an algorithm and tool for quality control, designed to identify fluorescence abnormalities caused by fluidic issues at the time of acquisition. FlowClean tracks subset frequency changes within a sample during acquisition, and "flags" time periods with fluorescence perturbations that could possibly lead to the emergence of false populations. The result of the FlowClean R script, when used in FCS Express, is a new parameter, called FCSE_GoodVsBad. The end user can utilize the newly created parameter to easily exclude events that are within aberrant time periods.
The FlowClean algorithm can be run from within the R Integration tools of FCS Express 6 by using an adapted version of the original (flowClean_1.12.0) code. For the sake of simplicity, the original script has been adapted so that a matrix is used as input parameter instead of a standard FCS file while the remaining portions of the code and algorithm are unchanged.

Note: the original FlowClean script works on raw fluorescence data, which is uncompensated and not transformed (i.e. linear) for FCS 3.0 and 3.1 files. However, the matrix exported by FCS Express 6 into R reflects what is displayed in the plot to which the transformation has been applied. Since compensated data are usually displayed in the plots, these compensated data will be exported to R instead of uncompensated data. If this is the case, the results obtained when FlowClean is run through FCS Express 6 will not reflect the results obtained when FlowClean is run directly through R. The same consideration needs to be taken into account with regards to parameter scaling. By default, FCS Express exports fluorescence parameters with biexponential scaling. When this is the case, the results obtained when FlowClean is run through FCS Express may not reflect the results obtained when FlowClean is run directly through R. The scale applied to parameters while data is exported to R can be customized (e.g. set to linear) in the transformation dialog.

For more details about the modifications made to the original script in order to be run through FCS Express 6, please see the comments within the script or contact us at

Please Note: The FlowClean R implementation may fail on a wide variety of data files do to the algorithm itself failing. Please use these tools at your own risk.

Jump to:

Download link for FlowClean for FCS Express


Installation Instructions

Installation FlowClean for use with R Integration in FCS Express

  1. Installing the required packages
    • FlowClean makes use of additional R packages that must be installed via R prior to using with FCS Express.

      To install the FlowClean package please run the following lines in your R console:
    • To check that the installation was performed properly please load the FlowClean package in your R console by running the following lines:
    • The following lines should be returned confirming the package was installed properly

      > library("flowClean")
      Loading required package: flowCore

      If any errors are problems are encountered please contact us at
  2. Running FlowClean via R Integration in FCS Express

    FlowClean can be run in FCS Express 6 via the steps below. Please ensure the R Application Bridge is set to be open in your FCS Express Options

    1. Open FCS Express.
    2. Load a data file into the layout and create a plot.
    3. Create a new Transformation for R Add Parameters (please refer to the FCS Express manual to learn how to create an R Add Parameter transformation).
    4. Choose the FlowClean_FCSE6.R script as the R Script File in the Transformations dialog.
    5. Check all of the Fluorescence parameters and the time parameter in the parameter list check box section. Note that Scatter parameters are generally not included.
    6. Select Events as row in the Events order section of the Transformation dialog.
    7. Drag the newTransformation from step 3 from the Transformation window onto the plot you inserted in step 2.


The result of the FlowClean algorithm will be now available as an additional parameter called FCSE_GoodVsBad that will allow the discrimination between “Good” and “Bad” events, where “Bad” means perturbations caused by the fluidics. The algorithm will assign a numeric value to each event. When default settings of the script are used, numbers from 1 to 100 are assigned to Good events while numbers from 10000 to 20000 are assigned to Bad events. Once the FCSE_GoodVsBad parameter is available, gates can be drawn around Good events (to include them in the downstream analysis) or around Bad events (to exclude them form the downstream analysis) as depicted below.

However, there are exceptions to this behavior outlined below

FlowClean Results
Above is an example of the FCSE_GoodVsBad parameter when viewed in linear (left) and logarithmic (right) scaling. Gates around the "good" and "bad" events have been created.

The user should be aware of the following possible results and errors:

  1. When no time parameter is available the GoodVsBad parameter will contain only 0 (zero).
  2. When the number of events is lower than 30000 the GoodVsBad parameter will contain only 0 (zero).
  3. When the script encounters a fault or error when the FlowClean algorithm fails, no parameter will be created and a warning message will be reported in FCS Express log as seen below
FlowClean Error Message
The FCS Express error log will indicate if the algorithm has failed via warning message.