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

Toy example

The FinemappingConvergence dataset from susieR provides a classic example of a SuSiE fit that converges to a local optimum under standard IBSS updates and is subsequently improved by credible-set refinement. The dataset consists of sufficient statistics (XtX, Xty, yty) for 200 variants and a simulated quantitative phenotype derived from real genotypes.

You can explore the generated offline HTML report or inspect its figure index and execution provenance. In the results below, component and variant indices follow Python's zero-based convention (for example, component 1 corresponds to the second row of alpha, or component 2 in susieR).

Main results and resolution

After refinement, the model identifies two active single-effect components with retained credible sets, each carrying posterior probability mass above 0.9999:

Rank Variant PIP Credible set Note
1 33 1.000 Component 2 ({33}) Lead; singleton CS
2 90 0.8228 Component 1 ({86, 90}) Lead within pair
3 86 0.1772 Component 1 ({86, 90}) Partner within pair
4 79 8.76e-09 — Highest non-member

Because marginal PIPs aggregate inclusion across active components while credible sets capture component-specific location uncertainty, variant 90's moderate marginal PIP (0.8228) does not imply weak evidence for component 1. Rather, component 1 is strongly supported as a signal (total CS mass >0.9999>0.9999), with its posterior probability divided between two tightly correlated variants: 0.8228 at variant 90 and 0.1772 at variant 86. Full-precision values are available in comparison.json and posterior_summary.json.

All 200 variants, retained CS and separate LD r² panels for variants 90 and 33.
Open original figure

The locus overview highlights the retained credible sets alongside dedicated LD r2r^2 tracks referenced to each credible set's lead variant (the member with the largest component-specific alpha, breaking ties by lexical variant ID: variant 90 for component 1 and variant 33 for component 2). Full LD reference records are exported under locus overview.ld_references in plot_data.json. The top association panel plots −log⁡10P-\log_{10} P from a two-sided normal approximation to marginal tt-statistics computed from XtX, Xty, and yty (df=n−2\mathrm{df} = n - 2).

Resolution

The two components illustrate different levels of fine-mapping resolution:

  • Component 2 is resolved to a single variant: Credible set {33} is a singleton with a marginal PIP of 1.0 (and purity 1.0 by convention).
  • Component 1 is localized to a collinear pair: Credible set {86, 90} has a minimum within-set correlation of ∣r∣≈0.9989|r| \approx 0.9989 (r2≈0.9978r^2 \approx 0.9978). Because variants 86 and 90 are nearly indistinguishable in the LD matrix, the component splits its posterior mass roughly 82% to 18% between them, corresponding to an entropy-based effective candidate count of 1.595.

The correlation between the two credible-set lead variants (33 and 90) is moderate (∣r∣≈0.532|r| \approx 0.532), and the model cleanly separates them into two distinct components.

A stopped fit improved by refinement

With L=10 and tol=0.001, the baseline IBSS fit satisfies the ELBO stopping criterion after 10 sweeps, identifying three credible sets: the singletons {32} and {35} and the pair {86, 90}. Running credible-set refinement (refine_fit) evaluates five credible-set exclusion candidates across two rounds (10 inner IBSS fits) and accepts a higher-ELBO solution that converges in 3 stage-B sweeps.

Baseline and accepted-candidate convergence trajectories, on separate sweep axes.
Open original figure

Refinement ranks candidates by their final logged ELBO under the original prior. Here, the objective increases by 17.458333 nats, from −70832.271605-70832.271605 to −70814.813272-70814.813272 (recorded under refinement in analysis_summary.json; see the convergence and refinement guide for search details).

Refinement changes candidate support; attempts are compared against their round's incumbent.
Open original figure
Variant Initial PIP Refined PIP L=12 PIP
32 >0.9999 0 >0.9999
33 0.03660 1 0.04627
35 >0.9999 0 >0.9999
86 0.2114 0.1772 0.2192
90 0.8214 0.8228 0.8232

Refinement replaces the two baseline singletons {32} and {35} with a single, better-fitting effect at {33}, while retaining the collinear pair {86, 90} (in the table, >0.9999 denotes an interior probability close to 1; see comparison.json for full precision).

Component detail

The report orders components by their zero-based row index in alpha. The signal detail view for component 1 displays the posterior probability split between variants 90 and 86, their cumulative posterior mass, and their within-set r2r^2:

Component 1 detail: unresolved allocation within the 86/90 CS, cumulative posterior mass and LD r².
Open original figure

Sensitivity and LD compatibility

Baseline-first PIP comparison with refinement and L increased to 12.
Open original figure

In a sensitivity comparison, increasing L from 10 to 12 without refinement leaves the baseline's three credible sets unchanged; the largest marginal PIP shift across all 200 variants is less than 0.01 (at variant 0, from 0.03856 to 0.04825, driven by diffuse background components without credible sets).

Because the LD matrix is normalized directly from the in-sample XtX matrix, the marginal statistics and LD are internally consistent. Running diagnose_ld flags none of the 200 variants under the default joint allele-flip criterion (log⁡LR>2\log \mathrm{LR} > 2 and ∣z~∣>2|\tilde z| > 2; see ld_diagnostics.json).

Choose a signal detail

To generate component-specific signal plots directly from a summarize result and signed LD matrix R:

from prusie.viz import plot_signal

pair, _, pair_data = plot_signal(
    summary, component_id=1, R=R, layout="compact", ld_measure="r2"
)
singleton, _, singleton_data = plot_signal(
    summary, component_id=2, R=R, layout="compact", ld_measure="r2"
)

The "compact" layout focuses on the credible-set members, displaying their component inclusion probabilities (alpha), cumulative posterior mass, and pairwise LD r2r^2. You can also select a component by passing a variant identifier (e.g., variant_id="90"), which picks the retained component assigning the highest alpha to that variant. See the plotting API for styling and export options.

Sources and reproducibility

The fixture metadata records the provenance of upstream FinemappingConvergence.RData (from susieR commit 1f9166cf88ed19c1d6acd4ee53a605ff9505a563, SHA-256 8b9ac71cd119cd8e9818340fb1152e422d9b7eaefac747058d8087f6c0b5139b), alongside reference results pinned to susieR 0.16.6 (8e56a8e038e989856d106d9ca5175cc664fea9d2). Upstream attribution and license terms are preserved in LICENSE.txt and BSD-3-Clause.txt.

From a repository checkout with the analysis extra installed, you can re-run the complete analysis (baseline fit, refinement, L=12 sensitivity, and LD diagnostics) and regenerate the report:

python examples/post_analysis.py --output-dir output/post-analysis --case official

To re-render the HTML report and figures from the archived numerical records without refitting:

python examples/post_analysis.py --saved-dir docs/examples/post_analysis \
  --output-dir output/rendered-example --case official