scran
C++ library for basic single-cell RNA-seq analyses
|
Fit a mean-variance trend to log-count data. More...
#include <FitVarianceTrend.hpp>
Classes | |
struct | Defaults |
Parameter defaults for trend fitting. More... | |
struct | Results |
Results of the trend fit. More... | |
Public Member Functions | |
FitVarianceTrend & | set_span (double s=Defaults::span) |
FitVarianceTrend & | set_minimum_mean (double m=Defaults::minimum_mean) |
FitVarianceTrend & | set_filter (bool f=Defaults::filter) |
FitVarianceTrend & | set_transform (bool t=Defaults::transform) |
FitVarianceTrend & | set_use_fixed_width (bool u=Defaults::use_fixed_width) |
FitVarianceTrend & | set_fixed_width (double f=Defaults::fixed_width) |
FitVarianceTrend & | set_minimum_window_count (int c=Defaults::minimum_window_count) |
void | run (size_t n, const double *mean, const double *variance, double *fitted, double *residuals) const |
Results | run (size_t n, const double *mean, const double *variance) const |
Fit a mean-variance trend to log-count data.
Fit a trend to the per-feature variances against the means, both of which are computed from log-normalized expression data. We use a LOWESS smoother in several steps:
|
inline |
Set the span for the LOWESS smoother as a proportion of the total number of points. This is only used if set_use_fixed_width()
is set to false.
s | Span for the smoother. |
FitVarianceTrend
object.
|
inline |
Set the minimum mean log-expression, to use for filtering out low-abundance genes.
m | Minimum value for the mean log-expression. |
FitVarianceTrend
object.
|
inline |
Should any filtering be performed by log-expression? This may need to be disabled if FitVarianceTrend
is not being used on statistics computed from log-expression values.
f | Whether filtering should be performed. |
FitVarianceTrend
object.
|
inline |
Should any transformation of the variances be performed prior to LOWESS smoothing. This may need to be disabled if FitVarianceTrend
is not being used on statistics computed from log-expression values.
t | Whether transformation should be performed. |
FitVarianceTrend
object.
|
inline |
Should a fixed-width constraint be applied to the LOWESS smoother? This forces each window to be a minimum width (see fixed_width()
) and avoids problems with large differences in density. For example, the default smoother performs poorly at high abundances where there are few genes.
u | Whether to apply fixed-width constraints. |
FitVarianceTrend
object.
|
inline |
Define the width of the window to use when set_use_fixed_width()
is set to true. This should be relative to the range of mean
values in run()
; the default value is chosen based on the typical range in single-cell RNA-seq data.
f | Fixed width of the window. |
FitVarianceTrend
object.
|
inline |
Define the minimum number of observations in each window when set_use_fixed_width()
is set to true. This ensures that each window contains at least a given number of observations; if it does not, it is extended using the standard LOWESS logic until the minimum number is achieved.
c | Minimum number of observations in the window. |
FitVarianceTrend
object.
|
inline |
Run the trend fitting on the means and variances across all features. This returns the fitted value and residual from the trend for each feature.
n | Number of features. | |
[in] | mean | Pointer to an array of length n , containing the means for all features. |
[in] | variance | Pointer to an array of length n , containing the variances for all features. |
[out] | fitted | Pointer to an array of length n , to store the fitted values. |
[out] | residuals | Pointer to an array of length n , to store the residuals. |
|
inline |
Run the trend fitting on the means and variances across all features.
n | Number of features. | |
[in] | mean | Pointer to an array of length n , containing the means for all features. |
[in] | variance | Pointer to an array of length n , containing the variances for all features. |
Results
object containing the fitted values and residuals of the trend.