Train multi-context TWAS weights from per-context summary statistics
Source:R/twas_weights.R
twas_multivariate_weights_sumstat_pipeline.RdMulti-context summary-statistics analog of
twas_multivariate_weights_pipeline. Bundles per-context RSS
QC, cross-context variant alignment, optional RAISS missing-variant
imputation, data-driven prior construction (reusing
build_mrmash_prior_matrices and the same FLASH / diagonal
covariance helpers as the individual-level pipeline), and multi-context
weight training via mrmash_rss_weights and/or
mvsusie_rss_weights.
Usage
twas_multivariate_weights_sumstat_pipeline(
sumstats_list,
LD_data,
n,
methods = list(mrmash_rss = list(), mvsusie_rss = list()),
qc_method = NULL,
keep_indel = TRUE,
impute = FALSE,
impute_missing = FALSE,
impute_opts = list(rcond = 0.01, R2_threshold = 0.6, minimum_ld = 5, lamb = 0.01),
data_driven_prior_matrices = NULL,
canonical_prior_matrices = TRUE,
estimate_priors_from_sumstats = TRUE,
verbose = 1
)Arguments
- sumstats_list
Named list of per-context sumstats data.frames. Each data.frame must contain
variant_id,chrom,pos,A1,A2, and eitherzorbeta/se. List names become condition labels.- LD_data
Shared
LDDataS4 object covering the union of variants. Each per-context sumstats is QC'd against this same LD panel.- n
Per-context sample sizes; either a named numeric vector matching
names(sumstats_list)or a single scalar to broadcast.- methods
Named list of multivariate RSS weight methods to fit. Function names must match
<name>_weights. Defaults to mr.mash-RSS and mvSuSiE-RSS with default arguments.- qc_method
Per-context QC method passed to
summary_stats_qc; one of"slalom","dentist", or NULL/"none". DefaultNULL(basic harmonization only).- keep_indel
Passed through to QC. Default TRUE.
- impute
Logical. If TRUE, run per-context RAISS re-imputation of LD-mismatch outliers (QC re-imputation). Default FALSE.
- impute_missing
Logical. If TRUE, after per-context QC and before cross-context alignment, RAISS imputes per-context z-scores for LD-reference variants absent from each context's sumstats. Widens the intersection used downstream. Default FALSE.
- impute_opts
Named list of RAISS parameters shared by both
imputeandimpute_missing.- data_driven_prior_matrices
Optional list of pre-computed prior matrices (with element
U) passed tobuild_mrmash_prior_matrices. When NULL andestimate_priors_from_sumstats = TRUE, the pipeline estimates a data-driven covariance from the cross-contextBhatmatrix viacompute_cov_flash. If FLASH fails the error is allowed to propagate; supplydata_driven_prior_matricesexplicitly or setestimate_priors_from_sumstats = FALSEto bypass.- canonical_prior_matrices
Passed to
build_mrmash_prior_matrices. Default TRUE.- estimate_priors_from_sumstats
Logical. When TRUE (default) and
data_driven_prior_matricesis NULL, estimate data-driven priors from the cross-context Bhat matrix usingcompute_cov_flash. FLASH errors are not swallowed; seedata_driven_prior_matricesfor the explicit-prior path.- verbose
Integer verbosity level.