Skip to contents

Replaces the OTTERS pipeline with a properly integrated workflow that: (1) runs RSS QC on eQTL summary statistics, (2) trains weights via multiple RSS methods, and (3) extracts fine-mapping results from the shared SuSiE-RSS fit. Returns a TWASWeights S4 object with standardized = TRUE that feeds directly into harmonize_twas and twas_analysis.

Usage

twas_weights_sumstat_pipeline(
  sumstats,
  LD_data,
  n,
  methods = list(lassosum_rss = list(), prs_cs = list(phi = 1e-04, n_iter = 1000,
    n_burnin = 500, thin = 5), sdpr = list(iter = 1000, burn = 200, thin = 1, verbose =
    FALSE), susie_rss = list(), susie_inf_rss = list()),
  p_thresholds = c(0.001, 0.05),
  check_ld_method = "eigenfix",
  qc_method = NULL,
  keep_indel = TRUE,
  pip_cutoff_to_skip = 0,
  impute = TRUE,
  impute_missing = FALSE,
  impute_opts = list(rcond = 0.01, R2_threshold = 0.6, minimum_ld = 5, lamb = 0.01),
  var_y = 1,
  verbose = 1
)

Arguments

sumstats

Data.frame with columns: variant_id, A1, A2, chrom, pos, and either z or both beta and se.

LD_data

LDData S4 object, or a legacy list with LD_matrix, LD_variants, ref_panel. Can also be a plain correlation matrix (variant IDs taken from row/colnames).

n

eQTL study sample size (scalar).

methods

Named list of RSS weight methods and their arguments. Method names correspond to functions named <method>_weights(stat, LD, ...). Defaults include lassosum_rss, prs_cs, sdpr, susie_rss, and susie_inf_rss.

p_thresholds

Numeric vector of p-value thresholds for P+T weights. Set to NULL to skip.

check_ld_method

LD matrix repair method: "eigenfix" (default), "shrink", or NULL to skip.

qc_method

RSS QC method for eQTL data: "slalom", "dentist", or NULL/"none" to skip.

keep_indel

Whether to keep indels during QC. Default TRUE.

pip_cutoff_to_skip

PIP threshold for early stopping. Default 0 (off).

impute

Whether to run RAISS imputation of LD-inconsistent variants flagged by QC (the QC re-imputation path). Default FALSE.

impute_missing

Logical. When TRUE, RAISS imputes QTL z-scores for variants present in the LD reference but absent from the QTL summary statistics, after QC and before LD/sumstats intersection. This widens the sumstats panel available to the weight-learning methods so a richer set of weights can later be applied to GWAS. Independent of impute; both can be enabled together. Default FALSE.

impute_opts

RAISS imputation parameters; shared by the impute QC re-imputation and the impute_missing missing-variant path. Imputed variants with R2 < R2_threshold are dropped.

var_y

Phenotype variance. Default 1.

verbose

Verbosity level.

Value

A list with:

twas_weights

A TWASWeights S4 object with standardized = TRUE.

finemapping_result

A FineMappingResult S4 object from the SuSiE-RSS fit, or NULL if no SuSiE-RSS method was used.

qc_summary

List with outlier counts and QC metadata.