scran
C++ library for basic single-cell RNA-seq analyses
Loading...
Searching...
No Matches
Classes | Functions
scran::quick_grouped_size_factors Namespace Reference

Quickly compute grouped size factors. More...

Classes

struct  Options
 Options for run(). More...
 

Functions

template<typename Value_ , typename Index_ , typename OutputFactor_ , typename Block_ , typename SizeFactor_ >
void run (const tatami::Matrix< Value_, Index_ > *mat, OutputFactor_ *output, const Options< Block_, SizeFactor_ > &opt)
 
template<typename Value_ , typename Index_ , typename OutputFactor_ >
void run (const tatami::Matrix< Value_, Index_ > *mat, OutputFactor_ *output)
 
template<typename OutputFactor_ = double, typename Value_ , typename Index_ , typename Block_ , typename SizeFactor_ >
std::vector< OutputFactor_ > run (const tatami::Matrix< Value_, Index_ > *mat, const Options< Block_, SizeFactor_ > &opt)
 
template<typename OutputFactor_ = double, typename Value_ , typename Index_ >
std::vector< OutputFactor_ > run (const tatami::Matrix< Value_, Index_ > *mat)
 

Detailed Description

Quickly compute grouped size factors.

Function Documentation

◆ run() [1/4]

template<typename Value_ , typename Index_ , typename OutputFactor_ , typename Block_ , typename SizeFactor_ >
void scran::quick_grouped_size_factors::run ( const tatami::Matrix< Value_, Index_ > *  mat,
OutputFactor_ *  output,
const Options< Block_, SizeFactor_ > &  opt 
)

Quickly compute grouped size factors by deriving a sensible grouping from an expression matrix. The idea is to break up the dataset into broad clusters so that GroupedSizeFactors can remove the composition biases between them. It is primarily intended for ADT count data where large composition biases are introduced by the presence of a few highly abundant markers in each subpopulation.

More specifically, this function will create an initial log-normalized matrix via LogNormCounts, derive a low-dimensional representation via principal components analysis with SimplePca, generate k-means clusters from the top principal components with the kmeans library, and finally use those clusters in GroupedSizeFactors.

If multiple blocks are present, dimensionality reduction and clustering is performed separately for each block. This avoids wasting the cluster partitions on irrelevant differences between blocks, e.g., due to batch effects. However, the final calculation of grouped size factors will be done using the entire dataset at once, so the factors will remove block-to-block scaling differences.

Template Parameters
Value_Numeric type for the matrix values.
Index_Integer type of the matrix row/column indices.
OutputFactor_Floating-point ype of the output factors.
Block_See Options.
SizeFactor_See Options.
Parameters
matInput count matrix, where rows are features and columns are cells.
[out]outputPointer to an array of length equal to the number of cells. On output, this stores the output factors for each cell.
optFurther options.

◆ run() [2/4]

template<typename Value_ , typename Index_ , typename OutputFactor_ >
void scran::quick_grouped_size_factors::run ( const tatami::Matrix< Value_, Index_ > *  mat,
OutputFactor_ *  output 
)

Overload of run() with default options.

Template Parameters
Value_Numeric type for the matrix values.
Index_Integer type of the matrix row/column indices.
OutputFactor_Floating-point ype of the output factors.
Parameters
matInput count matrix, where rows are features and columns are cells.
[out]outputPointer to an array of length equal to the number of cells. On output, this stores the output factors for each cell.

◆ run() [3/4]

template<typename OutputFactor_ = double, typename Value_ , typename Index_ , typename Block_ , typename SizeFactor_ >
std::vector< OutputFactor_ > scran::quick_grouped_size_factors::run ( const tatami::Matrix< Value_, Index_ > *  mat,
const Options< Block_, SizeFactor_ > &  opt 
)

Overload of run() that handles the memory allocation of the output factors.

Template Parameters
OutputFactor_Floating-point ype of the output factors.
Value_Numeric type for the matrix values.
Index_Integer type of the matrix row/column indices.
Block_See Options.
SizeFactor_See Options.
Parameters
matInput count matrix, where rows are features and columns are cells.
optFurther options.
Returns
Vector of length equal to the number of cells, containing the output factors for each cell.

◆ run() [4/4]

template<typename OutputFactor_ = double, typename Value_ , typename Index_ >
std::vector< OutputFactor_ > scran::quick_grouped_size_factors::run ( const tatami::Matrix< Value_, Index_ > *  mat)

Overload of run() with default options.

Template Parameters
OutputFactor_Floating-point ype of the output factors.
Value_Numeric type for the matrix values.
Index_Integer type of the matrix row/column indices.
Parameters
matInput count matrix, where rows are features and columns are cells.
Returns
Vector of length equal to the number of cells, containing the output factors for each cell.