81template<
typename Stat_>
139template<
typename Stat_>
145 std::vector<std::vector<Stat_> >
mean;
191template<
typename Index_,
typename Stat_>
192void process_simple_pairwise_effects(
197 std::vector<Stat_>& combo_means,
198 std::vector<Stat_>& combo_vars,
199 std::vector<Stat_>& combo_detected,
201 const std::vector<Stat_>& combo_weights,
205 std::vector<Stat_> total_weights_per_group;
206 const Stat_* total_weights_ptr = combo_weights.data();
208 total_weights_per_group = compute_total_weight_per_group(ngroups, nblocks, combo_weights.data());
209 total_weights_ptr = total_weights_per_group.data();
211 PrecomputedPairwiseWeights<Stat_> preweights(ngroups, nblocks, combo_weights.data());
214 size_t in_offset = ncombos *
static_cast<size_t>(start);
215 const auto* tmp_means = combo_means.data() + in_offset;
216 const auto* tmp_variances = combo_vars.data() + in_offset;
217 const auto* tmp_detected = combo_detected.data() + in_offset;
219 size_t squared = ngroups * ngroups;
220 size_t out_offset = start * squared;
221 for (
size_t gene = start, end = start + length; gene < end; ++gene, out_offset += squared) {
222 average_group_stats(gene, ngroups, nblocks, tmp_means, tmp_detected, combo_weights.data(), total_weights_ptr, output.
mean, output.
detected);
226 internal::compute_pairwise_cohens_d(tmp_means, tmp_variances, ngroups, nblocks, preweights, threshold, output.
cohens_d + out_offset);
230 internal::compute_pairwise_simple_diff(tmp_detected, ngroups, nblocks, preweights, output.
delta_detected + out_offset);
234 internal::compute_pairwise_simple_diff(tmp_means, ngroups, nblocks, preweights, output.
delta_mean + out_offset);
237 tmp_means += ncombos;
238 tmp_variances += ncombos;
239 tmp_detected += ncombos;
241 }, ngenes, num_threads);
244template<
typename Stat_>
245ScoreMarkersPairwiseBuffers<Stat_> fill_pairwise_results(
size_t ngenes,
size_t ngroups, ScoreMarkersPairwiseResults<Stat_>& store,
const ScoreMarkersPairwiseOptions& opt) {
246 ScoreMarkersPairwiseBuffers<Stat_> output;
248 internal::fill_average_results(ngenes, ngroups, store.mean, store.detected, output.mean, output.detected);
250 size_t num_effect_sizes = ngenes * ngroups * ngroups;
252 if (opt.compute_cohens_d) {
253 store.cohens_d.resize(num_effect_sizes);
254 output.cohens_d = store.cohens_d.data();
256 if (opt.compute_auc) {
257 store.auc.resize(num_effect_sizes);
258 output.auc = store.auc.data();
260 if (opt.compute_delta_mean) {
261 store.delta_mean.resize(num_effect_sizes);
262 output.delta_mean = store.delta_mean.data();
264 if (opt.compute_delta_detected) {
265 store.delta_detected.resize(num_effect_sizes);
266 output.delta_detected = store.delta_detected.data();
341template<
typename Value_,
typename Index_,
typename Group_,
typename Stat_>
360 internal::scan_matrix_by_row<true>(
365 static_cast<int*
>(
NULL),
379 internal::scan_matrix_by_column(
391 internal::process_simple_pairwise_effects(
443template<
typename Value_,
typename Index_,
typename Group_,
typename Block_,
typename Stat_>
464 internal::scan_matrix_by_row<false>(
483 internal::scan_matrix_by_column(
495 internal::process_simple_pairwise_effects(
524template<
typename Stat_ =
double,
typename Value_,
typename Index_,
typename Group_>
551template<
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:342
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:444