Skip to contents

Orchestrates fitMashContrast across every feature (variant) of a mash posterior: aligns the original effect matrix to the posterior columns, runs the per-feature deviation + pairwise contrast, row-binds the results (aligning the union of contrast columns), and orders them (mean/se/p, deviation before pairwise). Features with fewer than two tested conditions are dropped.

Usage

mashPosteriorContrast(posteriorMean, posteriorVcov, origMean, grouping = NULL)

Arguments

posteriorMean

Numeric matrix (features x conditions) of posterior means (PosteriorMean from mashPosterior).

posteriorVcov

Numeric array (conditions x conditions x features) of posterior covariances (PosteriorCov).

origMean

Numeric matrix (features x conditions) of the original effect estimates (e.g. bhat); used to decide which conditions were tested per feature. Aligned to posteriorMean's columns by name; NaN is treated as 0 (untested).

grouping

Optional named integer vector assigning conditions to groups (0 = independent); forwarded to fitMashContrast so replicate populations of one cell type share weight. Names are condition labels.

Value

A data.frame (features x contrasts) with mean_contrast_*, se_contrast_*, p_contrast_* columns and feature ids as row names. Empty when nothing is testable.