FlowHist

Share:

Description

Creates a FlowHist object from an FCS file, setting up the histogram data for analysis.

Usage

1
2
3
4
5
6
FlowHist(file, channel, bins = 256, window = 20, smooth = 20,
  pick = FALSE, linearity = "variable", debris = "SC", opts = list(),
  analyze = TRUE)

batchFlowHist(files, channel, bins = 256, verbose = TRUE, window = 20,
  smooth = 20, linearity = "variable", debris = "SC")

Arguments

file

character, the name of the file to load

channel

character, the name of the data column to use

bins

integer, the number of bins to use to aggregate events into a histogram

window

the width of the moving window used to identify local maxima for peak detection via caTools:runmax

smooth

the width of the moving window used to reduce noise in the histogram via caTools::runmean

pick

boolean; if TRUE, the user will be prompted to select peaks to use for starting values. Otherwise (the default), starting values will be detected automatically.

linearity

character, either "variable", the default, or "fixed". If "fixed", linearity is fixed at 2; if "variable", linearity is fit as a model parameter.

debris

character, either "SC", the default, or "MC", to set the debris model component to the Single-Cut or Multi-Cut models.

opts

list, currently not used, but maybe in future as a way to test additional model options

analyze

boolean, if TRUE the model will be analyzed immediately

files

character, a vector of file names to load

verbose

boolean; if TRUE, histBatch will list files as it processes them.

Details

Starting with a flowFrame object, read from a FCS file, FlowHist will:

  1. Extract the intensity data from channel.

  2. Remove the top bin, which contains off-scale readings we ignore in the analysis.

  3. aggregates the raw data into the desired number of bins, as specified with the bins argument. The default is 256, but you may also try 128 or 512. Any integer is technically acceptable, but I wouldn't stray from the default without a good reason.

  4. identify model components to include. All FlowHist objects will have the single-cut debris model and the G1 peak for sample A, and the broadened rectangle for the S-phase of sample A. Depending on the data, additional components for the G2 peak and sample B (G1, G2, s-phase) may also be added.

  5. Build the NLS model. All the components are combined into a single model.

  6. Identify starting values for Gaussian (G1 and G2 peaks) model components. For reasonably clean data, the built-in peak detection is fine. You can evaluate this by plotting the FlowHist object with the argument init = TRUE. If it doesn't look good, you can play with the window and smooth arguments (which is tedious!), or pick the peaks visually yourself with pick = TRUE.

Value

FlowHist returns a FlowHist object.

batchFlowHist returns a list of FlowHist objects.

Slots

raw

a flowFrame object containing the raw data from the FCS file

channel

character, the name of the data column to use

bins

integer, the number of bins to use to aggregate events into a histogram

histdata

data.frame, the columns are the histogram bin number (xx), florescence intensity (intensity), and the raw single-cut debris model values (SCVals, used in model fitting). Additional columns may be added if/when I add gating, so refer to columns by name, not position.

peaks

matrix, containing the coordinates used for peaks when calculcating initial parameter values.

comps

a list of modelComponent objects included for these data.

model

the function (built from comps) to fit to these data.

init

a list of initial parameter estimates to use in fitting the model.

nls

the nls object produced by the model fitting

counts

a list of cells counted in each peak of the fitted model

CV

a list of the coefficients of variation for each peak in the fitted model.

RCS

numeric, the residual chi-square for the fitted model.

Author(s)

Tyler Smith

Examples

1
2
3
4
5
6
library(flowPloidyData) 
fh1 <- FlowHist(file = flowPloidyFiles[1], channel = "FL3.INT.LIN")
fh1
library(flowPloidyData) 
batch1 <- batchFlowHist(flowPloidyFiles, channel = "FL3.INT.LIN")
batch1