Skip to contents

Unified, S4-native replacement for the legacy load_multitrait_*_sumstat + mash_ran_null_sample assembly. Consumes a list of already-constructed objects (one per region) and returns the flat variants x conditions matrix list consumed by the MASH mixture-prior / fit / posterior steps.

Usage

mashInput(
  objects,
  nRandom = 10L,
  nNull = 10L,
  excludeCondition = character(0),
  coverage = 0.95,
  zOnly = FALSE,
  sigPCutoff = 1e-06,
  inputScale = c("auto", "beta", "z"),
  independentVariants = NULL,
  seed = 999L
)

Arguments

objects

A named list of QtlSumStats and/or FineMappingResult objects, one per region. Names disambiguate rownames across regions (defaults to region1, region2, ...). For QtlSumStats inputs summaryStatsQc must have been run (the matrix builder rejects un-QC'd SumStats).

nRandom, nNull

Per-object random / null sample sizes (default 10 each).

excludeCondition

Character vector of condition (column) names to drop.

coverage

Credible-set coverage for FineMappingResult strong selection (default 0.95).

zOnly

When TRUE the returned partitions carry only .z (the .b/.s matrices are dropped after z is derived).

sigPCutoff

Significance cutoff applied to the strong partition (default 1e-6).

inputScale

Matrix scale for QtlSumStats inputs ("auto"/"beta"/"z"); ignored for FineMappingResult (always effect-size scale).

independentVariants

Optional character vector of variant ids (e.g. an LD-pruned independent SNP list). When supplied, the random and null background of every object is restricted to variants that match this set, so the background carries no LD-correlated SNPs (which would bias the residual correlation and the mixture weights). Matching is delegated to matchVariants() (chrom/pos/allele aware, ref/alt flips tolerated), not a raw string compare, so a chr-prefix / separator / allele-order difference still matches. The strong partition is never filtered.

seed

RNG seed for the random / null sampling (default 999).

Value

A flat list: strong.b, strong.s, strong.z, random.*, null.* (each a variants x conditions matrix) and XtX (a conditions x conditions matrix). The .b / .s matrices are omitted when zOnly = TRUE.

Details

For EACH object three partitions are extracted:

strong

The high-signal variants (deterministic, class-specific). QtlSumStats: the single most significant variant (\(\max|z|\)) per condition, unioned. FineMappingResult: the lead variant (\(\max\) PIP) of each credible set in each condition, unioned (conditions with no credible set contribute nothing).

random

nRandom variants sampled uniformly at random – represents the genome-wide mixture of effects and drives the mixture weights.

null

nNull variants sampled from those with \(\max|z|<2\) – the noise floor used to estimate the residual correlation (Vhat).

Random and null are selected identically for both classes (mashRandNullSample over the object's Bhat/Shat). Partitions are merged across objects (rownames disambiguated by region name), cleaned + z-derived by filterInvalidSummaryStat (btoz), and the strong XtX cross-product appended.

See also

mashRandNullSample, mergeMashData, filterInvalidSummaryStat