% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/QC.R
\name{computeOutliersQScore}
\alias{computeOutliersQScore}
\title{computeOutliersQScore}
\usage{
computeOutliersQScore(
  spe,
  metricList = c("log2SignalDensity", "Area_um", "log2AspectRatio",
    "log2Ctrl_total_ratio")
)
}
\arguments{
\item{spe}{A `SpatialExperiment` object with spatial omics data.}

\item{metricList}{A character vector specifying the metrics to include in
the Quality Score formula. Default is `c("log2SignalDensity", "Area_um",
"log2AspectRatio", "log2Ctrl_total_ratio")`.}
}
\value{
The `SpatialExperiment` object with added outlier variables in
`colData` and the temporary metrics considered for Quality Score computation
stored in the object `metadata`.
}
\description{
Computes outlier cells for each metric that can be used in Quality Score formula
for SpatialExperiment.

This function calculates outlier cells for each variable specified
in `metricList` for a `SpatialExperiment`. log2SignalDensity must be present in
the `colData` of the `SpatialExperiment` object as a minimum requirement.
The user can choose which metrics to include among the following: Area_um,
log2Ctrl_total_ratio, log2AspectRatio. For Xenium and Merfish datasets,
even if outliers for log2AspectRatio are detected, neither the metric will be 
included in the Quality Score formula nor nor the outliers will be used for
training.
}
\details{
The function computes outliers for each specified metric after
automatically choosing the appropriate method according to the skewness of
the distribution.
Internally the function:
\enumerate{
   \item Calls \code{.checkSkw()} to choose the proper outlier detection
    method according to the variable skewness;
   \item Calls \code{computeSpatialOutlier()} on each included metric to get
   fences;
   \item Labels cells as “LOW”/“HIGH” outliers or “NO”.
}
}
\examples{
example(readCosmxSPE)
spe <- spatialPerCellQC(spe)
spe <- computeOutliersQScore(spe)
table(spe$log2SignalDensity_outlier_train)
}
