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

Compute a variety of per-cell quality control metrics from a count matrix. More...

#include <PerCellQcMetrics.hpp>

Classes

struct  Buffers
 Buffers for direct storage of the calculated statistics. More...
 
struct  Defaults
 Default parameters. More...
 
struct  Results
 Result store for QC metric calculations. More...
 

Public Member Functions

PerCellQcMetricsset_compute_total (bool s=Defaults::compute_total)
 
PerCellQcMetricsset_compute_detected (bool s=Defaults::compute_detected)
 
PerCellQcMetricsset_compute_max_count (bool s=Defaults::compute_max_count)
 
PerCellQcMetricsset_compute_max_index (bool s=Defaults::compute_max_index)
 
PerCellQcMetricsset_compute_subset_total (bool s=Defaults::compute_subset_total)
 
PerCellQcMetricsset_compute_subset_detected (bool s=Defaults::compute_subset_detected)
 
PerCellQcMetricsset_num_threads (int n=Defaults::num_threads)
 
template<class Matrix , typename Subset = const uint8_t*>
Results run (const Matrix *mat, const std::vector< Subset > &subsets) const
 
template<class Matrix , typename Subset = const uint8_t*, typename Float , typename Integer >
void run (const Matrix *mat, const std::vector< Subset > &subsets, Buffers< Float, Integer > &output) const
 

Detailed Description

Compute a variety of per-cell quality control metrics from a count matrix.

Given a feature-by-cell count matrix, this class computes several QC metrics:

These calculations are done in a single pass, avoiding the need to reload data from the count matrix.

Member Function Documentation

◆ set_compute_total()

PerCellQcMetrics & scran::PerCellQcMetrics::set_compute_total ( bool  s = Defaults::compute_total)
inline
Parameters
sWhether to compute the total count for each cell. This option only affects the run() method that returns a Results object.
Returns
Reference to this PerCellQcMetrics object.

◆ set_compute_detected()

PerCellQcMetrics & scran::PerCellQcMetrics::set_compute_detected ( bool  s = Defaults::compute_detected)
inline
Parameters
sWhether to compute the number of detected features for each cell. This option only affects the run() method that returns a Results object.
Returns
Reference to this PerCellQcMetrics object.

◆ set_compute_max_count()

PerCellQcMetrics & scran::PerCellQcMetrics::set_compute_max_count ( bool  s = Defaults::compute_max_count)
inline
Parameters
sWhether to compute the maximmum count for each cell. This option only affects the run() method that returns a Results object.
Returns
Reference to this PerCellQcMetrics object.

◆ set_compute_max_index()

PerCellQcMetrics & scran::PerCellQcMetrics::set_compute_max_index ( bool  s = Defaults::compute_max_index)
inline
Parameters
sWhether to store the index of the feature with the maximum count for each cell. This option only affects the run() method that returns a Results object.
Returns
Reference to this PerCellQcMetrics object.

◆ set_compute_subset_total()

PerCellQcMetrics & scran::PerCellQcMetrics::set_compute_subset_total ( bool  s = Defaults::compute_subset_total)
inline
Parameters
sWhether to compute the total count in each feature subset. This option only affects the run() method that returns a Results object.
Returns
Reference to this PerCellQcMetrics object.

◆ set_compute_subset_detected()

PerCellQcMetrics & scran::PerCellQcMetrics::set_compute_subset_detected ( bool  s = Defaults::compute_subset_detected)
inline
Parameters
sWhether to compute the number of detected features in each feature subset. This option only affects the run() method that returns a Results object.
Returns
Reference to this PerCellQcMetrics object.

◆ set_num_threads()

PerCellQcMetrics & scran::PerCellQcMetrics::set_num_threads ( int  n = Defaults::num_threads)
inline
Parameters
nNumber of threads to use.
Returns
Reference to this PerCellQcMetrics object.

◆ run() [1/2]

template<class Matrix , typename Subset = const uint8_t*>
Results scran::PerCellQcMetrics::run ( const Matrix *  mat,
const std::vector< Subset > &  subsets 
) const
inline

Compute the QC metrics from an input matrix and return the results.

Template Parameters
MatrixType of matrix, usually a tatami::NumericMatrix.
SubsetPointer to an array of values interpretable as booleans.
Parameters
matPointer to a feature-by-cells tatami matrix containing counts.
[in]subsetsVector of pointers to arrays of length equal to mat->nrow(). Each array represents a feature subset and indicating whether each feature in mat belongs to that subset. Users can pass {} if no subsets are to be used.
Returns
A Results object containing the QC metrics. Subset totals are returned depending on the subsets.

◆ run() [2/2]

template<class Matrix , typename Subset = const uint8_t*, typename Float , typename Integer >
void scran::PerCellQcMetrics::run ( const Matrix *  mat,
const std::vector< Subset > &  subsets,
Buffers< Float, Integer > &  output 
) const
inline

Compute the QC metrics from an input matrix.

Template Parameters
MatrixType of matrix, usually a tatami::NumericMatrix.
SubsetPointer to a type interpretable as boolean.
Parameters
matPointer to a feature-by-cells matrix containing counts.
[in]subsetsVector of pointers to arrays of length equal to mat->nrow(). Each array represents a feature subset and indicating whether each feature in mat belongs to that subset. Users can pass {} if no subsets are to be used.
[out]outputA Buffers object in which the computed statistics are to be stored.

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