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

Create filters to identify low-quality cells from ADT-derived QC metrics. More...

#include <SuggestAdtQcFilters.hpp>

Classes

struct  Defaults
 Default parameters. More...
 
struct  Thresholds
 Thresholds to define outliers on each metric. More...
 

Public Member Functions

SuggestAdtQcFiltersset_detected_num_mads (double n=Defaults::num_mads)
 
SuggestAdtQcFiltersset_subset_num_mads (double n=Defaults::num_mads)
 
SuggestAdtQcFiltersset_num_mads (double n=Defaults::num_mads)
 
SuggestAdtQcFiltersset_min_detected_drop (double m=Defaults::min_detected_drop)
 
template<typename Float , typename Integer >
Thresholds run (size_t n, const PerCellAdtQcMetrics::Buffers< Float, Integer > &buffers) const
 
Thresholds run (const PerCellAdtQcMetrics::Results &metrics) const
 
template<typename Block , typename Float , typename Integer >
Thresholds run_blocked (size_t n, const Block *block, const PerCellAdtQcMetrics::Buffers< Float, Integer > &buffers) const
 
template<typename Block >
Thresholds run_blocked (const PerCellAdtQcMetrics::Results &metrics, const Block *block) const
 

Detailed Description

Create filters to identify low-quality cells from ADT-derived QC metrics.

In antibody-derived tag (ADT) count matrices, the QC filtering decisions are slightly different than those for RNA count matrices (see SuggestAdtQcFilters for the latter). Here, low-quality cells are defined as those with:

We define a threshold on each metric based on a certain number of MADs from the median. This assumes that most cells in the experiment are of high (or at least acceptable) quality; any outliers are indicative of low-quality cells that should be filtered out. See the ChooseOutlierFilters class for implementation details.

For the number of detected features and the total IgG counts, the outliers are defined after log-transformation of the metrics. This improves resolution at low values and ensures that the defined threshold is not negative. Note that all thresholds are still reported on the original scale, so no further exponentiation is required.

For the number of detected features, we supplement the MAD-based threshold with a minimum drop. Cells are only considered to be low quality if the difference in the number of detected features from the median is greater than a certain percentage. By default, the number must drop by at least 10% from the median. This avoids overly aggressive filtering when the MAD is zero due to the discrete nature of this statistic in datasets with few tags.

For datasets with multiple blocks, SuggestAdtQcFilters::run_blocked() will compute block-specific thresholds for each metric. See comments in SuggestRnaQcFilters for more details.

Member Function Documentation

◆ set_detected_num_mads()

SuggestAdtQcFilters & scran::SuggestAdtQcFilters::set_detected_num_mads ( double  n = Defaults::num_mads)
inline
Parameters
nNumber of MADs below the median, to define the threshold for outliers in the number of detected features. This should be non-negative.
Returns
Reference to this SuggestAdtQcFilters object.

◆ set_subset_num_mads()

SuggestAdtQcFilters & scran::SuggestAdtQcFilters::set_subset_num_mads ( double  n = Defaults::num_mads)
inline
Parameters
nNumber of MADs above the median, to define the threshold for outliers in the total count for each subset. This should be non-negative.
Returns
Reference to this SuggestAdtQcFilters object.

◆ set_num_mads()

SuggestAdtQcFilters & scran::SuggestAdtQcFilters::set_num_mads ( double  n = Defaults::num_mads)
inline
Parameters
nNumber of MADs from the median, overriding previous calls to set_detected_num_mads() and set_subset_num_mads(). This should be non-negative.
Returns
Reference to this SuggestAdtQcFilters object.

◆ set_min_detected_drop()

SuggestAdtQcFilters & scran::SuggestAdtQcFilters::set_min_detected_drop ( double  m = Defaults::min_detected_drop)
inline
Parameters
mMinimum drop in the number of detected features from the median, in order to consider a cell to be of low quality. This should lie in $[0, 1)$.
Returns
Reference to this SuggestAdtQcFilters object.

◆ run() [1/2]

template<typename Float , typename Integer >
Thresholds scran::SuggestAdtQcFilters::run ( size_t  n,
const PerCellAdtQcMetrics::Buffers< Float, Integer > &  buffers 
) const
inline
Template Parameters
FloatFloating point type for the metrics.
IntegerInteger for the metrics.
Parameters
nNumber of cells.
[in]buffersPointers to arrays of length n, containing the per-cell ADT-derived metrics.
Returns
Filtering thresholds for each metric.

◆ run() [2/2]

Thresholds scran::SuggestAdtQcFilters::run ( const PerCellAdtQcMetrics::Results metrics) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
metricsCollection of arrays of length equal to the number of cells, containing the per-cell ADT-derived metrics.
Returns
Filtering thresholds for each metric.

◆ run_blocked() [1/2]

template<typename Block , typename Float , typename Integer >
Thresholds scran::SuggestAdtQcFilters::run_blocked ( size_t  n,
const Block *  block,
const PerCellAdtQcMetrics::Buffers< Float, Integer > &  buffers 
) const
inline
Template Parameters
BlockInteger type for the block assignments.
FloatFloating point type for the metrics.
IntegerInteger for the metrics.
Parameters
nNumber of cells.
[in]blockPointer to an array of length n, containing the block assignments for each cell. This may be NULL, in which case all cells are assumed to belong to the same block.
[in]buffersPointers to arrays of length n, containing the per-cell ADT-derived metrics. Only detected and subset_totals are used; sums does not need to be set.
Returns
Filtering thresholds for each metric in each block.

◆ run_blocked() [2/2]

template<typename Block >
Thresholds scran::SuggestAdtQcFilters::run_blocked ( const PerCellAdtQcMetrics::Results metrics,
const Block *  block 
) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Template Parameters
BlockInteger type for the block assignments.
Parameters
metricsCollection of arrays of length equal to the number of cells, containing the per-cell ADT-derived metrics. Only detected and subset_totals are used; sums does not need to be set.
[in]blockPointer to an array of length equal to the number of cells, containing the block assignments for each cell. This may be NULL, in which case all cells are assumed to belong to the same block.
Returns
Filtering thresholds for each metric in each block.

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