Thursday, March 26, 2015

Index Sorting - From FACSDiVa to FlowJo

We recently upgraded our FACSAria to FACSDiVa 8 running on Windows 7 primarily for the ability to do index sorting. Getting used to a brand new set of DiVa issues and quirks has been difficult, but we soldiered on nonetheless. After scouring the web for resources on both index sorting and analyzing index sorting data outside of FACSDiVa, I decided to compile all the resources in one place. They are out there, it's just a pain to jump around to various sites trying to compile all the information together. I've done the leg work already, so read on to get the info. Of course, I'm sure there are more elegant ways of doing this in other programs or even in FlowJo, but I needed this info yesterday, so I'm documenting it here for future reference. 

Figuring out index sorting in FACSDiVa. You may think index sorting is no more than checking a box in FACSDiVa, but there are enough one-off situations that arise that it really warrants a separate FAQ. There are two resources that are quite helpful in figuring this part out. The first, oddly enough, is BD's very own Index Sorting Manual (<-- fixed bad link), which comes as an addendum to the FACSDiVa software manual and may not even be installed on your computer or available for download from BD's website. I only came upon this after our BD service engineer sent me a copy of it. The second resource is a document presented at GLIIFCA 2014 by Matt Cochran (University of Rochester), in which he outlines some of his tips and tricks for working with index sorting in FACSDiVa 8. 

So, let's assume you figure out how to successfully perform an index sort in FACSDiVa. You should have a Pre-sort FCS file of your entire population, and an Index sort "tube" for each plate you ran. You can export both (or all) of these as FCS files. There is a decent interface for looking at your index sort plate information within FACSDiVa, but if you're use to doing all your analysis is FlowJo, you probably want to bring that data over at some point. And here's the fun part.

Analyzing index sorting data in FlowJo. I have an application where a user is index sorting based on a range of FITC intensities. The resulting plate will be a mix of FITC low and FITC high clones. The goal of index sorting, in this case, is to retain the original FITC intensity information for each well after the sort. What follows below is A method (not THE method) I stumbled upon to go from an index sort file from FACSDiVa to Figure 1 below. I'd really love for someone to tell me there is a way easier way to do this in FlowJo.
Figure 1. Heatmap analysis of index sorting file.

Figure 2. Running the initial script to create 96 populations
Step 1: Use the Script Editor index sorting example from the Daily Dongle Blog (or see Addendum below regarding the method in Version 9). You simply copy and paste the script starting with  /** --- Iterate samples --- **/ all the way through gate.update(); } and paste it into the script editor window (under the tools tab of the ribbon) in version 10.0.7 (if you have access to the 10.0.8beta version, I would do this step in that'll see why later).  Highlight your index sorting file in the workspace and click the run button in the script editor window. You should now have 96 populations under your index sorting file. If you end up with a bunch of "-" where it usually says the number of cells in each population, click the refresh button at the top of the workspace window and then it'll show you that there is 1 cell per region (Figure 2). 

Step 2: The next step is to export each of these populations as its own FCS file. In essence creating 96 FCS files. The problem here is that you can do the initial index sorting script in version 10.0.7, but you can't do the export to 96 FCS files in 10.0.7 for the Mac (I think you can do this in the windows version, but I'm not sure). You can do the export to 96 separate files in Mac version 9.8.3, but you can't do the initial script in 9.8.3. So, if you can do this all in 10.0.8beta, that's your best bet (or on windows). So, in 10.0.8b, you can highlight all the populations and choose export (right click or within the File tab in the ribbon) and export this as 96 FCS files. 

Step 3: Using the plate layout to create a heatmap. The last step is to load the 96 FCS files into FlowJo v10.x.x and assign the Well ID keyword to each of the files corresponding to their position on the plate. Now, the files are in chronological order going across and then down (in serpentine fashion). So all you have to do is add the Well ID keyword as a column and copy and paste a list of Well IDs (A1 - H12 in serpentine fashion) from a spreadsheet. BUT WAIT, THERE's MORE! If you're doing this on a Mac, this post from the Daily Dongle states that since Mac Excel copies data in the ANSI format you won't be able to paste into FlowJo, which only reads the Unicode format. To get around this, create the Well ID list in Google Sheets and copy and paste from there (Google Sheets copies data in Unicode format). Now that you have a Well ID associated with each of the files you can use this link to in FlowJo's documentation to set up a heatmap of your index sorting data.

And there you have it. Please leave a comment below with your preferred method of analyzing index sorting data using whatever software you like. 

Addendum #1: Using the script is somewhat cumbersome. Thanks to Helene Dujardin (from HCD Bioexperts) for the tip below:

"There is another way in version 9, has there is an option for index sort analysis.  Select your sample and go to the menu Platform/ Event number gate / Create Indexed sort gates. It will directly create a gate for each of your well. Each gate name will be the corresponding well ID.

You can then export each of your gate as a new fcs file also with version 9. Your exported fcs file name will include the well ID if your original fcs file name is not too long (you can change it by changing the $FIL keyword)."

Addendum #2: Using the methods outlined in Addendum #1, I'll add one more point of interest. When you export the Index FCS file from FACSDiVa, you might get a really long name (Specimen_001_Index_Tube_001.fcs). FlowJo v9 freezes when you try and export all the regions as FCS files, so you'll need to rename the files after you import the parent into FlowJo. I've been renaming them (CMD+R shortcut) INDX_1, INDX2, etc... Now, when you export the regions as FCS files they'll be labeled INDX_1_A01, etc...