Fine-mapping · Python + RustLucaJiang/prusie
On this page

Inputs, alignment and priors

Choosing the right entry point depends on whether individual-level genotypes, sufficient statistics, or marginal summary statistics are available. In all cases, covariate adjustment should be performed prior to fine-mapping, and summary statistics must be aligned with the linkage disequilibrium (LD) matrix so that both share the exact same variant ordering and effect alleles.

While prusie validates array dimensions, data types, and numerical finiteness, it cannot infer allele orientation or population compatibility between summary statistics and an external LD reference. See Statistical model for how each input format maps to the working likelihood and effect scale.

Supported model and input routes

prusie fits Gaussian SuSiE models on CPU in double precision (float64). The table below summarizes the primary entry points and how they construct the working regression quantities:

Entry point Inputs Working scale and interpretation
susie X, y Individual-level regression with optional centering (intercept=True) and predictor standardization (standardize=True)
susie_suff_stat XtX, Xty, yty, n Exact sufficient statistics computed from centered individual-level data
susie_rss z (or bhat, shat), R, n Standardized working scale using the finite-sample Wald adjustment (z_method="wald") by default
susie_rss bhat, shat, R, n, var_y Reconstructs original regression scale; coef returns effects per predictor unit in phenotype units
susie_rss z, R, n, var_y Scales yty and default initial variances by var_y, while keeping zz-based XtX and Xty on the standardized scale
susie_rss z (or bhat, shat), R (without n) Large-sample noncentrality likelihood; emits a warning and uses prior_variance
susie_rss_lambda z, R (or reference X), lambda_ Regularized RSS with a fixed or estimated isotropic covariance term λI\lambda \mathbf{I}
susie_ser z (or bhat, shat) Standalone single-effect regression without LD

For individual-level susie, rows of X correspond to samples and columns to variants. SciPy sparse matrices (csc_matrix or csr_matrix) are operated on directly without densifying. Passing na_rm=True drops samples with missing phenotypes (y), whereas genotype entries in X must be finite.

For single-panel susie_rss, you can supply either marginal zz-scores z or effect estimates bhat with standard errors shat (from which z=β^/SEz = \hat\beta / \mathrm{SE} is formed). When the sample size n is provided, z_method="wald" applies the finite-sample Wald adjustment, whereas z_method="score" uses unadjusted zz-scores; see From summaries to working sufficient statistics.

Instead of a precomputed LD matrix R, susie_rss can also accept a reference genotype matrix X (whose sample size need not equal n). Standard single-panel RSS fits apply X via matrix-free operators without forming a dense p×pp \times p LD matrix, whereas models requiring explicit covariance manipulations—such as bhat/shat/var_y scale reconstruction, R_finite, R_mismatch, multi-panel RSS, and susie_rss_lambda—materialize a dense correlation matrix from X. See additional model options and shared fitting options.

Shapes and numerical checks

For susie_rss and susie_suff_stat with pp variants, 1D summary vectors (z, bhat, Xty) must have length pp, and square matrices (R, XtX) must have shape (p,p)(p, p). If variant_ids are provided, they are coerced to strings and must contain pp unique, non-empty identifiers. Columns in variant_metadata must also have length pp and are preserved in the returned result.

Summary-statistic validation follows consistent numerical rules across entry points:

  • Effect estimates and standard errors (bhat, shat): bhat must be finite. shat may be a positive scalar or a length-pp vector of positive values without NaNs; +inf is permitted in shat and yields z = 0.
  • Marginal zz-scores (z): Missing values (NaN) are replaced with 0 with a RuntimeWarning; infinite values raise ValueError.
  • Sufficient statistics (XtX, Xty, yty, n): Require n>1n > 1 and finite nonnegative yty. When check_input=False (the default), NaN entries in Xty are zeroed with a RuntimeWarning; when check_input=True, they raise ValueError. If yty = 0, Xty must be all zeros, residual_variance must be explicitly positive, and estimate_residual_variance=False is required. Providing X_colmeans and y_mean allows prusie to recover the original-scale intercept (otherwise fit.intercept is NaN; see Data, notation and scale).
  • LD and Gram matrices (R, XtX): Entries must be finite with nonnegative diagonals (singular matrices are permitted). Symmetry is checked on the working matrix (XtX = (n - 1) * R when n is given, or R without n). If off-diagonal pairs (i,j)(i, j) and (j,i)(j, i) differ, prusie emits a RuntimeWarning and symmetrizes the working matrix as (Q+Q⊤)/2(\mathbf{Q} + \mathbf{Q}^\top)/2. On the bhat/shat/n/var_y route, the reconstructed XtX is always symmetrized.

By default, caller arrays are never modified in place. Setting overwrite_ld=True in susie_rss allows the solver to reuse R as an in-place workspace when symmetry repair is needed; see Optional LD workspace for usage requirements.

Setting check_input=True performs an additional eigendecomposition of the working matrix before standardization, rejecting negative eigenvalues at or below -r_tol (while allowing zero eigenvalues) and issuing a RuntimeWarning if the squared norm of Xty projected onto near-null eigenvectors (eigenvalues ≤ϵ\le \epsilon, where ϵ\epsilon is float64 machine epsilon) exceeds ϵ\epsilon.

Variant order and alleles

prusie aligns inputs strictly by array position rather than matching variant_ids across arguments. Any subsetting, reordering, or allele flipping must be applied consistently across z (or bhat), both dimensions of R (or XtX, or columns of X), prior_weights, maf, variant_ids, and variant_metadata.

When harmonizing summary statistics with an LD reference panel, resolve strand-ambiguous or palindromic variants prior to fitting. If a subset of variants has reversed effect alleles relative to the LD matrix, let signs be a length-pp vector with -1 at flipped variants and +1 elsewhere, and update both the summary statistics and LD matrix:

z_new = signs * z
R_new = signs[:, None] * R * signs[None, :]

For bhat/shat inputs, multiply bhat by signs and leave shat unchanged.

To filter variants by minor allele frequency during input preparation, pass maf (and optionally maf_thresh, default 0.0) to susie_rss or susie_suff_stat. Variants with maf > maf_thresh are retained across all arrays and metadata.

Priors and zero-information columns

In susie, susie_suff_stat, and susie_rss (with known n), scaled_prior_variance specifies the initial effect-size prior variance relative to the working phenotype variance and accepts either a positive scalar or a length-LL vector (see A sum of single effects). When n is omitted in susie_rss, prior_variance is used instead.

prior_weights specifies nonnegative prior inclusion weights for the pp variants (uniform by default) and is normalized to sum to 1 (πj\pi_j). Setting a positive null_weight (0<w0<10 < w_0 < 1) appends a virtual null column with zero crossproducts, assigning prior weight w0w_0 to the null column and rescaling the unnormalized variant weights by 1−w01 - w_0 before normalizing the combined length-(p+1)(p+1) vector. Always pass only the pp biological variants in variant_ids and variant_metadata.

Following susieR, the Gaussian single-effect regression evaluates log prior weights as log⁡(πj+ϵ)\log(\pi_j + \sqrt{\epsilon}), where ϵ\epsilon is float64 machine epsilon. Consequently, setting a variant's prior weight to 0 does not strictly exclude it from receiving posterior mass; to exclude a variant completely, filter it out of the inputs as described in Variant order and alleles. Similarly, uninformative columns with zero working diagonal (Qjj=0Q_{jj} = 0) receive a log Bayes factor of 0 and conditional moments of 0, though their posterior inclusion probability remains proportional to their prior weight. Note that fit.lbf_variable records per-variant log Bayes factors prior to weighting by πj\pi_j.

To warm-start a fit from a previous SusieResult or a dictionary containing alpha, mu, and mu2, pass model_init (or its alias s_init). prusie verifies that variant identifiers, scales, and null-column layout match the new inputs. See Continue first, then consider refinement for the distinction between warm-starting a new fit and continuing a fit with retained data.

Choosing variance and iteration settings

By default, susie and susie_suff_stat estimate the residual variance σ2\sigma^2 (estimate_residual_variance=True), whereas susie_rss fixes σ2\sigma^2 (estimate_residual_variance=False) because estimating residual variance from summary statistics requires in-sample LD and can become unstable with external reference panels. See ELBO and residual variance for update formulas and bounds.

In susie_rss and susie_rss_lambda, check_prior=True (enabled by default) checks after each IBSS sweep that no component prior variance VℓV_\ell exceeds

100max⁡j: Qjj>0gj2Qjjσ2, 100 \max_{j:\,Q_{jj}>0} \frac{g_j^2}{Q_{jj}\sigma^2},

raising a ValueError if an extreme variance indicates severe mismatch between the summary statistics and LD matrix.

The maximum number of IBSS sweeps defaults to max_iter=100 for susie and susie_suff_stat and max_iter=50 for susie_rss and susie_rss_lambda. The default convergence tolerance is tol=1e-4 (1e-6 when tol=None is paired with estimate_residual_method="NIG", and 1e-3 for susie_rss_lambda). See Stopping rules, Defaults by entry point, and Iterations and finalization for details on convergence criteria, component trimming, and memory usage.