Run mashr Across Multi-Context QTL or GWAS Summary Statistics
Source:R/mashPipeline.R
mashPipeline.RdEnd-to-end driver: from `strong, random, null` sumstats
collections, builds the variant × context Bhat / Shat matrices,
estimates the residual correlation (Vhat), and fits the mash
model with canonical + PCA + flash + ED covariance components,
returning the fitted covariance list and the estimated mixture
weights.
Usage
mashPipeline(
sumStatsList,
alpha,
residualCorrelation = NULL,
priorCovariances = NULL,
nPcs = NULL,
inputScale = c("auto", "beta", "z"),
setSeed = 999
)Arguments
- sumStatsList
Named list (or
SimpleList) ofQtlSumStatsorGwasSumStatsobjects. Required names:"strong"(discovery variants),"random"(random background). Optional:"null"(for residual correlation estimation).- alpha
Numeric (length 1). Variance-stabilising-transform exponent forwarded to
mashr::mash_set_data(). Usealpha = 0on the BETA scale,alpha = 1on the Z scale.- residualCorrelation
Optional pre-computed residual correlation matrix (
Vhat). When supplied, replaces the inlinemashr::estimate_null_correlation_simple()call entirely and the"random"slot ofsumStatsListbecomes optional (the function does not need it for anything else). Useful whenVhatwas estimated previously on a larger reference and shipped as a static artefact (the legacy MWE pattern).- priorCovariances
Optional named list of square covariance matrices (the
Ulistmashr::mash()consumes). When supplied, replaces the canonical + PCA + flash + ED chain (cov_canonical/cov_pca/cov_flash/cov_ed) entirely; mash sees only the supplied matrices. Every entry must be ancol(Bhat) x ncol(Bhat)matrix. Useful whenUwas learnt on a larger reference and shipped as a static artefact (the legacy MWE pattern).- nPcs
Optional integer; number of principal components seeded into
mashr::cov_pca(). Defaults toncol(Bhat) - 1. Ignored whenpriorCovariancesis supplied.- inputScale
One of
"auto"(default),"beta","z". Controls which (Bhat, Shat) pair is extracted from each sumstats entry:"beta"Bhat = BETA, Shat = SE — the standard effect-size scale mashr was designed around. Requires every entry to carry BETA + SE mcols.
"z"Bhat = Z, Shat = 1 — z-score scale. Requires Z.
"auto"Use BETA + SE when every entry carries both; otherwise fall back to (Z, 1) when every entry carries Z. Mixed inputs (some entries missing BETA, others missing Z) are a hard error.
alphashould be chosen consistently with the resolved scale: typicallyalpha = 0for beta,alpha = 1for z.- setSeed
Integer. RNG seed for reproducibility of
mashr::cov_flashandmashr::cov_ed. Default 999.