% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/AllGenerics.R, R/compCytof.R
\docType{methods}
\name{compCytof}
\alias{compCytof}
\alias{compCytof,flowFrame,matrix-method}
\alias{compCytof,flowSet,ANY-method}
\alias{compCytof,character,matrix-method}
\alias{compCytof,ANY,data.frame-method}
\title{Compensate CyTOF data}
\usage{
compCytof(x, y, ...)

\S4method{compCytof}{flowFrame,matrix}(x, y, out_path = NULL,
  method = "flow")

\S4method{compCytof}{flowSet,ANY}(x, y, out_path = NULL, method = "flow")

\S4method{compCytof}{character,matrix}(x, y, out_path = NULL,
  method = "flow")

\S4method{compCytof}{ANY,data.frame}(x, y, out_path = NULL, method = "flow")
}
\arguments{
\item{x}{a \code{\link{flowFrame}} OR a character string specifying the location of 
FCS files that should be compensates.}

\item{y}{a spillover matrix.}

\item{...}{optional arguments.}

\item{out_path}{a character string. If specified, compensated FCS files will be generated 
in this location. If \code{x} is a character string, file names will be 
inherited from uncompensated FCS files and given extension "_comped".}

\item{method}{\code{"flow"} or \code{"nnls"}.}
}
\value{
Compensates the input \code{\link{flowFrame}} or, 
if \code{x} is a character string, all FCS files in the specified location. 
If \code{out_path=NULL} (the default), returns a \code{\link{flowFrame}} 
containing the compensated data. Otherwise, compensated data will be written 
to the specified location as FCS 3.0 standard files.
}
\description{
Compensates a mass spectrometry based experiment using a
provided spillover matrix & assuming a linear spillover in the experiment.
}
\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:
\enumerate{
\item{columns present in the SM but not in the input data 
will be removed from it}
\item{non-metal columns present in the input but not in the SM 
will be added such that they do neither receive nor cause spill}
\item{metal columns that have the same mass as a channel present in the SM 
will receive (but not emit) spillover according to that channel}
\item{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}}
}
\examples{
# get single-stained control samples
data(ss_exp)

# specify mass channels stained for
bc_ms <- c(139, 141:156, 158:176)

# debarcode
re <- assignPrelim(x = ss_exp, y = bc_ms)
re <- estCutoffs(x = re)
re <- applyCutoffs(x = re)
spillMat <- computeSpillmat(x = re)
compCytof(x = ss_exp, y = spillMat)

}
\author{
Helena Lucia Crowell \email{crowellh@student.ethz.ch}
and Vito Zanotelli \email{vito.zanotelli@uzh.ch}
}
