scran
C++ library for basic single-cell RNA-seq analyses
|
Define outlier filters from the median and MAD. More...
#include <ChooseOutlierFilters.hpp>
Classes | |
struct | Defaults |
Default parameters. More... | |
struct | Thresholds |
Outlier thresholds for QC filtering. More... | |
Public Member Functions | |
ChooseOutlierFilters & | set_lower (bool l=Defaults::lower) |
ChooseOutlierFilters & | set_upper (bool u=Defaults::upper) |
ChooseOutlierFilters & | set_num_mads (double n=Defaults::num_mads) |
ChooseOutlierFilters & | set_min_diff (double m=Defaults::min_diff) |
Thresholds | run (ComputeMedianMad::Results x) const |
Define outlier filters from the median and MAD.
This class uses the output from ComputeMedianMad
to define filter thresholds for outliers on the QC metrics. Given an array of values, outliers are defined as those that are more than some number of median absolute deviations (MADs) from the median value. By default, we require 3 MADs, which is motivated by the low probability (less than 1%) of obtaining such a value under the normal distribution. Outliers can be defined in both directions, or just a single direction, depending on the interpretation of the QC metric. Any log-transformation used to compute the MAD (see ComputeMedianMad::set_log()
) is automatically reversed in the reported thresholds.
|
inline |
l | Should low values be considered as potential outliers? If false , no lower threshold is applied when defining outliers. |
ChooseOutlierFilters
object.
|
inline |
u | Should high values be considered as potential outliers? If false , no upper threshold is applied when defining outliers. |
ChooseOutlierFilters
object.
|
inline |
n | Number of MADs to use to define outliers. Larger values result in more relaxed thresholds. |
ChooseOutlierFilters
object.
|
inline |
m | Minimum difference from the median to define outliers. This enforces a more relaxed threshold in cases where the MAD may be too small. If the median and MADs are log-transformed, this difference is interpreted as a unit on the log-scale. |
ChooseOutlierFilters
object.
|
inline |
x | Median and MAD computed from ComputeMedianMad::run() or ComputeMedianMad::run_blocked() . |
If x.log
is true, the returned thresholds are defined in the original space, i.e., not log-transformed. They can be directly used for comparison to the original metrics without further exponentiation.
If multiple blocks are present in x
, one upper/lower threshold is computed for each block.