/cytofCore

R package for working with CyToF data

Primary LanguageR

Table of Contents

CyTOFCore README 0.3

Installation

The cytofCore package can be installed directly from github using the devtools package. Start R and run the following commands:

 R>install.packages("devtools")
 R>install.packages("XML")
 R>library("devtools")

You will need to install flowCore if you have not already:

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

Now install the cytofCore package

 R>install_github("nolanlab/cytofCore")

Editing the Panel of a set of FCS Files

The cytofCore.updatePanel function can be used to edit the panel written into the header of a set of FCS files. Typical edits include making spelling consistent (e.g., HLADR vs. HLA-DR), removing entire columns, re-ordering columns, etc. To use the panel editor, you must first prepare a template file with the desired panel. It can take one of two forms:

  • FCS Template: You may use an existing FCS file that has the correct panel as your template.
  • Spreadsheet Template: You may write your desired panel into a spreadsheet. The first column should be a list of the channel names, and the second column should be the marker you want to write into those channels. You must save your spreadsheet as a CSV or tab-delimited TXT file. Below is an example spreadsheet that would create FCS files with only four parameters
Time Time
Cell_length Cell_length
(Ir191)Di DNA1
(Ir193)Di DNA2

You must put all the FCS files whose panels you want to update to the template's panel into a single folder.

In every FCS file in the selected folder, the panel updater will search for each metal listed in the template, and then will write that metal's marker as it is written in the template. It will put the list of metals/markers in the same order in each file. If a metal is not found, it will ask whether you want to include a placeholder column of zeros, or if you want to omit that channel from that file. A subfolder called 'relabeled' will be created within the selected folder, and new FCS files will be written there.

To use the panel editor, you must load the cytofCore library, and then call the cytofCore.updatePanel function:

 R>library("cytofCore")
 R>cytofCore.updatePanel()

This will prompt you to choose the template file, and then the folder of FCS files. When choosing the folder, you must actually enter into that folder in the selection window before clicking OK.

You can also specify the folder and/or template directly:

 R>cytofCore.updatePanel(templateFile="/path/to/templatefile", fcsFolder="/path/to/files/to/fix/")

Adding the XML tail (or "header") to an IMD File

In the occasional circumstance that the CyTOF software crashes or is forced to quit while still writing an IMD file, the XML tail of the IMD file that includes the panel and dual calibration information may not get written. It is necessary to add this information to the IMD file before extracting the cell events. If you attempt to convert the IMD file to an FCS file without this, you will get a warning from the CyTOF software along the lines of "missing header." (While this is commonly called the "header," it is actually at the tail of the file.) You will also see no channels if you click "Select Channels" in the IMD analysis window. The easiest way to fix this is to copy the entire XML tail from another IMD file that has the same panel and dual calibration values. To do this:

 R>library("cytofCore")
 R>cytofCore.copyImdXml(sourceImdFilename,targetImdFilename)

For example, if the name of the truncated file is fileWithoutXml.imd, and the name of the template file is fileWithXml.imd, the command would be

 R>cytofCore.copyImdXml("fileWithXml.imd","fileWithoutXml.imd")

It is strongly recommended to apply this code only to files that have been backed up.

Note that you either need to use a full path to the file, or change your working directory using setwd:

 R>setwd("/path/to/directory/with/imdfiles")