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.
Arguments
- objects
A named
listofQtlSumStatsand/orFineMappingResultobjects, one per region. Names disambiguate rownames across regions (defaults toregion1,region2, ...). ForQtlSumStatsinputssummaryStatsQcmust 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
FineMappingResultstrong selection (default 0.95).- zOnly
When
TRUEthe returned partitions carry only.z(the.b/.smatrices are dropped after z is derived).- sigPCutoff
Significance cutoff applied to the strong partition (default 1e-6).
- inputScale
Matrix scale for
QtlSumStatsinputs ("auto"/"beta"/"z"); ignored forFineMappingResult(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
nRandomvariants sampled uniformly at random – represents the genome-wide mixture of effects and drives the mixture weights.- null
nNullvariants 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.