Skip to contents

This function removes autofluorescence contamination from a sample, using the specified parameters and settings.

Usage

remove.af(
  samp,
  clean.expr,
  spectral.channel,
  peak.channel,
  universal.negative,
  asp,
  scatter.param,
  negative.n = 500,
  positive.n = 1000,
  scatter.match = TRUE,
  k.neighbors = 3L,
  main.figures = TRUE,
  intermediate.figures = FALSE,
  verbose = TRUE,
  diagnostics.env = NULL
)

Arguments

samp

Sample identifier.

clean.expr

List containing cleaned expression data.

spectral.channel

Vector of spectral channel names.

peak.channel

Vector of peak detection channels for fluorophores.

universal.negative

Named vector mapping samples to their matching negatives.

asp

The AutoSpectral parameter list. Prepare using get.autospectral.param

scatter.param

Vector of scatter parameters.

negative.n

Integer. Number of events to include in the downsampled negative population. Default is 500.

positive.n

Integer. Number of events to include in the downsampled positive population. Default is 1000.

scatter.match

Logical, default is TRUE. Whether to select negative events based on scatter profiles matching the positive events.

k.neighbors

Numeric, number of scatter-matched unstained events to pair with every positive event for background determination. Default is 3.

main.figures

Logical, if TRUE creates the main figures to show the impact of intrusive autofluorescent event removal and scatter-matching for the negatives.

intermediate.figures

Logical, if TRUE returns additional figures to show the inner workings of the cleaning, including definition of low-AF cell gates on the PCA-unmixed unstained and spectral ribbon plots of the AF exclusion from the unstained.

verbose

Logical, default is TRUE. Set to FALSE to suppress messages.

diagnostics.env

Optional environment, default NULL. If supplied, remove.af() populates it (keyed by sample name) with the objects used to identify and exclude intrusive autofluorescence for each cell-based AF-removal sample: af.peak.channel, fluor.peak, af.boundaries, expr.data.pos/expr.data.neg (spectral channels only), scatter.data.pos (the scatter-parameter columns aligned to expr.data.pos, for plotting gate.population.idx events on an FSC/SSC panel), and the resulting gate indices. Intended for diagnostic/manuscript figures (see plot.spectra.legacy.steps(), spectra.standard.workflow.plot()); has no effect on the cleaning result. Capture is unreliable when parallel = TRUE.

Value

A matrix containing the expression data with autofluorescent events removed for the sample.