Rlogo is an open source programming environment used by scientists to create software tools for their research needs.  Many of these tools have been shared and can be incorporated for free into your cytometric data analysis workflow.

There are four ways that you can use R with FlowJo, listed here in order of increasing computer skills.

  1. Choose from the list of R tools that FlowJo has built directly into FlowJo
  2. Run the R tools from a simple web browser based interface and import the results into FlowJo.
  3. Run FlowJo and the desired R tools in a script from the command line
  4. Write you own R scripts and share them with the community

 

Tools built directly into FlowJo

FlowJo has added some tools directly into the program, but these tools still call on R functions in the background to execute, and so you must have R installed on your computer.  R can be downloaded from http://www.r-project.org/.  You will notice on the left-hand side of this page there are links for downloading the software, and resources for learning how to use it.  Some of these tools also use the bioconductor libraries as well, as so these must be loaded.  Bioconductor is a suite of R tools that deal specifically with biological data.

To install the Bioconductor suite, simply open R and type:

       source("http://bioconductor.org/biocLite.R")
       biocLite()

To use the SPADE tool we’ve incorporated you need to install the SPADE library by typing:

       source("http://bioconductor.org/biocLite.R")
       biocLite("spade")

You only need to do this one time.  Once installed you no longer need to open R to access the tools in FlowJo.

In FlowJo v10.0.7 and greater you will find a Power User band among the list of bands available by clicking on the ribbon icon in the upper right hand corner of a workspace.  Add this band to any ribbon, open it and select the Extra tab, as shown in the figure below.

Figure 10

 

There are currently two R based tools built in, FlowMeans and SPADE.  To use FlowMeans simply:

  • Click on a sample or population within FlowJo
  • Click Calculate FlowMeans
  • Pick the parameters you want to use from  the popup menu that will appear
  • Then you will see clusters appear based on the FlowMeans algorithm

SPADE is a bit more intricate, and we’ll break that out into a separate page.  Click here for SPADE in FlowJo.

 

Run the R tools from a simple web browser based interface and import the results into FlowJo

Many of the tools in bioconductor have been made available to non-programmers by the Gene Pattern Server, a group based out of MIT’s Broad Institute. They take algorithms from R and create a web browser interface that simply requires the user to answer a few questions to run the algorithm.

The gene pattern server can be accessed from http://genepatternbeta.broadinstitute.org/  You will need to create a user account, but its free.  The picture below shows a screen shot of a the gene pattern server with Modules I have used recently pinned to the left side, and a larger list of the Flow Cytometry tools available by selecting ‘Browse Modules’.  Note that there are more tools available than fit on the screen in this screen shot.

 

Screen shot 2013-11-12 at 11.23.31 PM

 

The results are then exported depending on the type of application.  For clustering applications the results are usually available as comma separated value (CSV) files, which just means that you tend to get a vector of cluster memberships separated by commas that programs like Excel or FlowJo can interpret.  To get these results into FlowJo all you need to do is drag and drop the resulting CSV file onto the FCS file in FlowJo that you clustered.

GPS

 

The only downside to this tool is that it tends to be slower to send you data to the Broad Institutes server, have it process, and return to your computer than if you were to run the same algorithms on your own computer (especially if you have a powerful computer) or even better if you had a local server to run these tools on, such as an Enterprise FlowJo setup.  But there’s a lot of upside to free of course!
Run FlowJo and the desired R tools in a script from the command line
Write you own R scripts and share them with the community

 

Run FlowJo and the desired R tools in a script from the command line

FlowJo can be called from the command line and asked to do things like execute a template.  A fairly straight forward set of instructions can be used to execute templates, or strings or templates in a sequence, that do things as simple as preprocess your data or as complicated as compensating, gating, and graphing the data then exporting graphics and conditionally formatted tables as stand alone reports.  We’ve broken this out as a separate page as well available at FlowJo Command Line.  R works in a similar fashion.   The general command line syntax for the command line is:

R [options] [<infile] [>outfile]

--args [arg1] [arg2] ... , with this specifying any information needed by the script.

An example for calling a script called ‘myscript’ that requires 3 numeric inputs from the command line is:

  •   R '--args 1 2 3' < myscript.R > write.csv(outputfile.txt)

Any of the files in bioconductor can be called in this manner, and are well documented to instruct you on what the required inputs are and what the possible outputs are.  To get help with a tool simply type ‘??’ before the name of the algorithm.  Once you have loaded bioconductor into R, try typing:

??flowMeans

 

Write you own R scripts and share them with the community

If you are a sophisticated enough programmer to write your own R scripts for analyzing flow cytometric data, consider sharing your work with the community by contacting bioconductor at webmaster@bioconductor.org.

If you have created an R script that you would like to share with FlowJo specifically you can contact us directly at flowjo@treestar.com.