scran
C++ library for basic single-cell RNA-seq analyses
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
scran::ChooseOutlierFilters Struct Reference

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

ChooseOutlierFiltersset_lower (bool l=Defaults::lower)
 
ChooseOutlierFiltersset_upper (bool u=Defaults::upper)
 
ChooseOutlierFiltersset_num_mads (double n=Defaults::num_mads)
 
ChooseOutlierFiltersset_min_diff (double m=Defaults::min_diff)
 
Thresholds run (ComputeMedianMad::Results x) const
 

Detailed Description

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.

Member Function Documentation

◆ set_lower()

ChooseOutlierFilters & scran::ChooseOutlierFilters::set_lower ( bool  l = Defaults::lower)
inline
Parameters
lShould low values be considered as potential outliers? If false, no lower threshold is applied when defining outliers.
Returns
A reference to this ChooseOutlierFilters object.

◆ set_upper()

ChooseOutlierFilters & scran::ChooseOutlierFilters::set_upper ( bool  u = Defaults::upper)
inline
Parameters
uShould high values be considered as potential outliers? If false, no upper threshold is applied when defining outliers.
Returns
A reference to this ChooseOutlierFilters object.

◆ set_num_mads()

ChooseOutlierFilters & scran::ChooseOutlierFilters::set_num_mads ( double  n = Defaults::num_mads)
inline
Parameters
nNumber of MADs to use to define outliers. Larger values result in more relaxed thresholds.
Returns
A reference to this ChooseOutlierFilters object.

◆ set_min_diff()

ChooseOutlierFilters & scran::ChooseOutlierFilters::set_min_diff ( double  m = Defaults::min_diff)
inline
Parameters
mMinimum 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.
Returns
A reference to this ChooseOutlierFilters object.

◆ run()

Thresholds scran::ChooseOutlierFilters::run ( ComputeMedianMad::Results  x) const
inline
Parameters
xMedian and MAD computed from ComputeMedianMad::run() or ComputeMedianMad::run_blocked().
Returns
Outlier filter thresholds defined in terms of MADs from the median.

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.


The documentation for this struct was generated from the following file: