For a single variant (row index), computes deviation contrasts (each condition vs grand mean) and all pairwise contrasts from the mash posterior mean and covariance. Supports condition grouping for weighted contrasts.
Arguments
- index
Integer row index of the variant in the posterior matrices.
- orig_mean
Matrix of original effect sizes (variants x conditions). Used to determine which conditions are "tested" (non-zero).
- posterior_mean
Matrix of mash posterior means (variants x conditions).
- posterior_vcov
3D array of posterior covariance matrices (conditions x conditions x variants).
- grouping
Named integer vector mapping condition names to group IDs. Conditions with the same positive group ID are treated as replicates (e.g., multiple datasets for the same cell type). Use 0 for ungrouped. If NULL (default), all conditions are treated independently.