81template<
typename Stat_>
149template<
typename Stat_>
155 std::vector<std::vector<Stat_> >
mean;
201template<
typename Index_,
typename Stat_>
202void process_simple_pairwise_effects(
207 std::vector<Stat_>& combo_means,
208 std::vector<Stat_>& combo_vars,
209 std::vector<Stat_>& combo_detected,
211 const std::vector<Stat_>& combo_weights,
215 std::vector<Stat_> total_weights_per_group;
216 const Stat_* total_weights_ptr = combo_weights.data();
218 total_weights_per_group = compute_total_weight_per_group(ngroups, nblocks, combo_weights.data());
219 total_weights_ptr = total_weights_per_group.data();
221 PrecomputedPairwiseWeights<Stat_> preweights(ngroups, nblocks, combo_weights.data());
224 size_t in_offset = ncombos *
static_cast<size_t>(start);
225 const auto* tmp_means = combo_means.data() + in_offset;
226 const auto* tmp_variances = combo_vars.data() + in_offset;
227 const auto* tmp_detected = combo_detected.data() + in_offset;
229 size_t squared = ngroups * ngroups;
230 for (
size_t gene = start, end = start + length; gene < end; ++gene) {
231 average_group_stats(gene, ngroups, nblocks, tmp_means, tmp_detected, combo_weights.data(), total_weights_ptr, output.
mean, output.
detected);
234 size_t out_offset = gene * squared;
236 internal::compute_pairwise_cohens_d(tmp_means, tmp_variances, ngroups, nblocks, preweights, threshold, output.
cohens_d + out_offset);
240 internal::compute_pairwise_simple_diff(tmp_detected, ngroups, nblocks, preweights, output.
delta_detected + out_offset);
244 internal::compute_pairwise_simple_diff(tmp_means, ngroups, nblocks, preweights, output.
delta_mean + out_offset);
247 tmp_means += ncombos;
248 tmp_variances += ncombos;
249 tmp_detected += ncombos;
251 }, ngenes, num_threads);
254template<
typename Stat_>
255ScoreMarkersPairwiseBuffers<Stat_> fill_pairwise_results(
size_t ngenes,
size_t ngroups, ScoreMarkersPairwiseResults<Stat_>& store,
const ScoreMarkersPairwiseOptions& opt) {
256 ScoreMarkersPairwiseBuffers<Stat_> output;
258 internal::fill_average_results(ngenes, ngroups, store.mean, store.detected, output.mean, output.detected);
260 size_t num_effect_sizes = ngenes * ngroups * ngroups;
262 if (opt.compute_cohens_d) {
263 store.cohens_d.resize(num_effect_sizes
264#ifdef SCRAN_MARKERS_TEST_INIT
265 , SCRAN_MARKERS_TEST_INIT
268 output.cohens_d = store.cohens_d.data();
270 if (opt.compute_auc) {
271 store.auc.resize(num_effect_sizes
272#ifdef SCRAN_MARKERS_TEST_INIT
273 , SCRAN_MARKERS_TEST_INIT
276 output.auc = store.auc.data();
278 if (opt.compute_delta_mean) {
279 store.delta_mean.resize(num_effect_sizes
280#ifdef SCRAN_MARKERS_TEST_INIT
281 , SCRAN_MARKERS_TEST_INIT
284 output.delta_mean = store.delta_mean.data();
286 if (opt.compute_delta_detected) {
287 store.delta_detected.resize(num_effect_sizes
288#ifdef SCRAN_MARKERS_TEST_INIT
289 , SCRAN_MARKERS_TEST_INIT
292 output.delta_detected = store.delta_detected.data();
367template<
typename Value_,
typename Index_,
typename Group_,
typename Stat_>
386 internal::scan_matrix_by_row<true>(
391 static_cast<int*
>(
NULL),
405 internal::scan_matrix_by_column(
417 internal::process_simple_pairwise_effects(
469template<
typename Value_,
typename Index_,
typename Group_,
typename Block_,
typename Stat_>
490 internal::scan_matrix_by_row<false>(
509 internal::scan_matrix_by_column(
521 internal::process_simple_pairwise_effects(
550template<
typename Stat_ =
double,
typename Value_,
typename Index_,
typename Group_>
577template<
typename Stat_ =
double,
typename Value_,
typename Index_,
typename Group_,
typename Block_>
void score_markers_pairwise(const tatami::Matrix< Value_, Index_ > &matrix, const Group_ *group, const ScoreMarkersPairwiseOptions &options, const ScoreMarkersPairwiseBuffers< Stat_ > &output)
Definition score_markers_pairwise.hpp:368
void score_markers_pairwise_blocked(const tatami::Matrix< Value_, Index_ > &matrix, const Group_ *group, const Block_ *block, const ScoreMarkersPairwiseOptions &options, const ScoreMarkersPairwiseBuffers< Stat_ > &output)
Definition score_markers_pairwise.hpp:470