compCytof: Compensate CyTOF data

View source: R/compCytof.R

compCytofR Documentation

Compensate CyTOF data

Description

Compensates a mass spectrometry based experiment using a provided spillover matrix & assuming a linear spillover in the experiment.

Usage

compCytof(
  x,
  sm = NULL,
  method = c("nnls", "flow"),
  assay = "counts",
  overwrite = TRUE,
  transform = TRUE,
  cofactor = NULL,
  isotope_list = CATALYST::isotope_list
)

Arguments

x

a SingleCellExperiment OR a character string specifying the location of FCS files that should be compensates.

sm

a spillover matrix.

method

"flow" or "nnls".

assay

character string specifying which assay data to use; should be one of assayNames(x) and correspond to count-like data, as linearity assumptions underlying compensation won't hold otherwise.

overwrite

logical; should the specified assay slot (and exprs, when transform = TRUE) be overwritten with the compensated data? If FALSE, compensated counts (and expressions, if transform = TRUE) will be stored in assay(s) compcounts/exprs, respectively.

transform

logical; should normalized counts be arcsinh-transformed with the specified cofactor(s)?

cofactor

numeric cofactor(s) to use for optional arcsinh-transformation when transform = TRUE; single value or a vector with channels as names. If NULL, compCytof will try and access the cofactor(s) stored in int_metadata(x), thus re-using the same transformation applied previously.

isotope_list

named list. Used to validate the input spillover matrix. Names should be metals; list elements numeric vectors of their isotopes. See isotope_list for the list of isotopes used by default.

Details

If the spillover matrix (SM) does not contain the same set of columns as the input experiment, it will be adapted according to the following rules:

  1. columns present in the SM but not in the input data will be removed from it

  2. non-metal columns present in the input but not in the SM will be added such that they do neither receive nor cause spill

  3. metal columns that have the same mass as a channel present in the SM will receive (but not emit) spillover according to that channel

  4. if an added channel could potentially receive spillover (as it has +/-1M or +16M of, or is of the same metal type as another channel measured), a warning will be issued as there could be spillover interactions that have been missed and may lead to faulty compensation

Value

Compensates the input flowFrame or, if x is a character string, all FCS files in the specified location.

Author(s)

Helena L Crowell helena.crowell@uzh.ch & Vito RT Zanotelli

Examples

# deconvolute single-stained control samples
data(ss_exp)
sce <- prepData(ss_exp)
bc_ms <- c(139, 141:156, 158:176)
sce <- assignPrelim(sce, bc_ms)
sce <- applyCutoffs(estCutoffs(sce))

# estimate spillover matrix 
sce <- computeSpillmat(sce)

# compensate & store compensated data in separate assays
sce <- compCytof(sce, overwrite = FALSE)
assayNames(sce)

# biscatter before vs. after compensation
chs <- c("Dy162Di", "Dy163Di")
m <- match(chs, channels(sce))
i <- rownames(sce)[m][1]
j <- rownames(sce)[m][2]

par(mfrow = c(1, 2))
for (a in c("exprs", "compexprs")) {
  es <- assay(sce, a)
  plot(es[i, ], es[j, ], cex = 0.2, pch = 19,
       main = a, xlab = i, ylab = j)
}


HelenaLC/CATALYST documentation built on Oct. 16, 2024, 12:21 a.m.