81template<
typename Stat_>
142template<
typename Stat_>
148 std::vector<std::vector<Stat_> >
mean;
194template<
typename Index_,
typename Stat_>
195void process_simple_pairwise_effects(
200 std::vector<Stat_>& combo_means,
201 std::vector<Stat_>& combo_vars,
202 std::vector<Stat_>& combo_detected,
204 const std::vector<Stat_>& combo_weights,
208 std::vector<Stat_> total_weights_per_group;
209 const Stat_* total_weights_ptr = combo_weights.data();
211 total_weights_per_group = compute_total_weight_per_group(ngroups, nblocks, combo_weights.data());
212 total_weights_ptr = total_weights_per_group.data();
214 PrecomputedPairwiseWeights<Stat_> preweights(ngroups, nblocks, combo_weights.data());
217 size_t in_offset = ncombos *
static_cast<size_t>(start);
218 const auto* tmp_means = combo_means.data() + in_offset;
219 const auto* tmp_variances = combo_vars.data() + in_offset;
220 const auto* tmp_detected = combo_detected.data() + in_offset;
222 size_t squared = ngroups * ngroups;
223 for (
size_t gene = start, end = start + length; gene < end; ++gene) {
224 average_group_stats(gene, ngroups, nblocks, tmp_means, tmp_detected, combo_weights.data(), total_weights_ptr, output.
mean, output.
detected);
227 size_t out_offset = gene * squared;
229 internal::compute_pairwise_cohens_d(tmp_means, tmp_variances, ngroups, nblocks, preweights, threshold, output.
cohens_d + out_offset);
233 internal::compute_pairwise_simple_diff(tmp_detected, ngroups, nblocks, preweights, output.
delta_detected + out_offset);
237 internal::compute_pairwise_simple_diff(tmp_means, ngroups, nblocks, preweights, output.
delta_mean + out_offset);
240 tmp_means += ncombos;
241 tmp_variances += ncombos;
242 tmp_detected += ncombos;
244 }, ngenes, num_threads);
247template<
typename Stat_>
248ScoreMarkersPairwiseBuffers<Stat_> fill_pairwise_results(
size_t ngenes,
size_t ngroups, ScoreMarkersPairwiseResults<Stat_>& store,
const ScoreMarkersPairwiseOptions& opt) {
249 ScoreMarkersPairwiseBuffers<Stat_> output;
251 internal::fill_average_results(ngenes, ngroups, store.mean, store.detected, output.mean, output.detected);
253 size_t num_effect_sizes = ngenes * ngroups * ngroups;
255 if (opt.compute_cohens_d) {
256 store.cohens_d.resize(num_effect_sizes);
257 output.cohens_d = store.cohens_d.data();
259 if (opt.compute_auc) {
260 store.auc.resize(num_effect_sizes);
261 output.auc = store.auc.data();
263 if (opt.compute_delta_mean) {
264 store.delta_mean.resize(num_effect_sizes);
265 output.delta_mean = store.delta_mean.data();
267 if (opt.compute_delta_detected) {
268 store.delta_detected.resize(num_effect_sizes);
269 output.delta_detected = store.delta_detected.data();
344template<
typename Value_,
typename Index_,
typename Group_,
typename Stat_>
363 internal::scan_matrix_by_row<true>(
368 static_cast<int*
>(
NULL),
382 internal::scan_matrix_by_column(
394 internal::process_simple_pairwise_effects(
446template<
typename Value_,
typename Index_,
typename Group_,
typename Block_,
typename Stat_>
467 internal::scan_matrix_by_row<false>(
486 internal::scan_matrix_by_column(
498 internal::process_simple_pairwise_effects(
527template<
typename Stat_ =
double,
typename Value_,
typename Index_,
typename Group_>
554template<
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:345
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:447