1#ifndef SCRAN_MODEL_GENE_VARIANCES_H
2#define SCRAN_MODEL_GENE_VARIANCES_H
5#include "tatami_stats/tatami_stats.hpp"
64template<
typename Stat_>
91template<
typename Stat_>
128template<
typename Stat_>
134 std::vector<ModelGeneVariancesBuffers<Stat_> >
per_block;
147template<
typename Stat_>
167 std::vector<ModelGeneVariancesResults<Stat_> >
per_block;
181template<
typename Value_,
typename Index_,
typename Stat_,
typename Block_>
203 tatami_stats::grouped_variances::direct(
219 auto stat = tatami_stats::variances::direct(
ptr,
NC,
false);
227template<
typename Value_,
typename Index_,
typename Stat_,
typename Block_>
254 tatami_stats::grouped_variances::direct(
272 auto stat = tatami_stats::variances::direct(
range.value,
range.number,
NC,
false);
280template<
typename Value_,
typename Index_,
typename Stat_,
typename Block_>
300 std::vector<tatami_stats::variances::RunningDense<Stat_, Value_, Index_> >
runners;
329template<
typename Value_,
typename Index_,
typename Stat_,
typename Block_>
353 std::vector<tatami_stats::variances::RunningSparse<Stat_, Value_, Index_> >
runners;
382template<
typename Value_,
typename Index_,
typename Stat_,
typename Block_>
390 if (
mat.prefer_rows()) {
405template<
typename Index_,
typename Stat_,
class Function_>
462template<
typename Value_,
typename Index_,
typename Block_,
typename Stat_>
489 std::fill_n(
current.fitted,
NR, std::numeric_limits<double>::quiet_NaN());
490 std::fill_n(
current.residuals,
NR, std::numeric_limits<double>::quiet_NaN());
541template<
typename Value_,
typename Index_,
typename Stat_>
570template<
typename Stat_ =
double,
typename Value_,
typename Index_>
601template<
typename Stat_ =
double,
typename Value_,
typename Index_,
typename Block_>
616 if (!
options.compute_average) {
Fit a mean-variance trend to log-count data.
void average_vectors_weighted(size_t n, std::vector< Stat_ * > in, const Weight_ *w, Output_ *out, bool skip_nan)
Variance modelling for single-cell expression data.
Definition choose_highly_variable_genes.hpp:14
std::vector< Index_ > choose_highly_variable_genes_index(Index_ n, const Stat_ *statistic, const ChooseHighlyVariableGenesOptions &options)
Definition choose_highly_variable_genes.hpp:256
void fit_variance_trend(size_t n, const Float_ *mean, const Float_ *variance, Float_ *fitted, Float_ *residuals, FitVarianceTrendWorkspace< Float_ > &workspace, const FitVarianceTrendOptions &options)
Definition fit_variance_trend.hpp:120
void model_gene_variances_blocked(const tatami::Matrix< Value_, Index_ > &mat, const Block_ *block, const ModelGeneVariancesBlockedBuffers< Stat_ > &buffers, const ModelGeneVariancesOptions &options)
Definition model_gene_variances.hpp:463
void model_gene_variances(const tatami::Matrix< Value_, Index_ > &mat, ModelGeneVariancesBuffers< Stat_ > buffers, const ModelGeneVariancesOptions &options)
Definition model_gene_variances.hpp:542
void parallelize(Function_ fun, Index_ tasks, int threads)
Options for fit_variance_trend().
Definition fit_variance_trend.hpp:19
Workspace for fit_variance_trend().
Definition fit_variance_trend.hpp:80
Buffers for model_gene_variances_blocked().
Definition model_gene_variances.hpp:129
ModelGeneVariancesBuffers< Stat_ > average
Definition model_gene_variances.hpp:140
std::vector< ModelGeneVariancesBuffers< Stat_ > > per_block
Definition model_gene_variances.hpp:134
Results of model_gene_variances_blocked().
Definition model_gene_variances.hpp:148
std::vector< ModelGeneVariancesResults< Stat_ > > per_block
Definition model_gene_variances.hpp:167
ModelGeneVariancesResults< Stat_ > average
Definition model_gene_variances.hpp:173
Buffers for model_gene_variances() and friends.
Definition model_gene_variances.hpp:65
Stat_ * means
Definition model_gene_variances.hpp:69
Stat_ * residuals
Definition model_gene_variances.hpp:84
Stat_ * variances
Definition model_gene_variances.hpp:74
Stat_ * fitted
Definition model_gene_variances.hpp:79
Options for model_gene_variances() and friends.
Definition model_gene_variances.hpp:24
FitVarianceTrendOptions fit_variance_trend_options
Definition model_gene_variances.hpp:28
bool compute_average
Definition model_gene_variances.hpp:47
scran_blocks::VariableWeightParameters variable_block_weight_parameters
Definition model_gene_variances.hpp:41
int num_threads
Definition model_gene_variances.hpp:53
scran_blocks::WeightPolicy block_weight_policy
Definition model_gene_variances.hpp:34
Results of model_gene_variances().
Definition model_gene_variances.hpp:92
std::vector< Stat_ > fitted
Definition model_gene_variances.hpp:116
std::vector< Stat_ > means
Definition model_gene_variances.hpp:106
std::vector< Stat_ > residuals
Definition model_gene_variances.hpp:121
std::vector< Stat_ > variances
Definition model_gene_variances.hpp:111
bool sparse_ordered_index