Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Univariate fine-mapping and TWAS with SuSiE

Fine-map cis-xQTL signals and estimate cross-validated transcriptome-wide association study (TWAS) weights for one molecular trait in one or more contexts.

Learning goals

After completing this vignette, readers should be able to:

  1. define the analysis unit and cis-association window used by susie_twas;

  2. distinguish SuSiE fine-mapping outputs from TWAS prediction weights;

  3. compare prediction methods using out-of-fold performance; and

  4. identify credible sets, posterior inclusion probabilities, and common input failures.

Background and method

qtl_dataset_construct+susie_twas in mnm_regression.ipynb builds a QtlDataset from genotype, phenotype, and covariate files. For each region, it residualizes genotype and phenotype matrices, fits SuSiE, and trains ten TWAS prediction models (mrash, susie, susie_inf, enet, lasso, mcp, scad, l0learn, bayes_r, and bayes_c) plus a cross-validation-based ensemble.

SuSiE represents the regional effect as a sum of single effects and reports posterior inclusion probabilities (PIPs) and credible sets. In this example, the maximum number of effects is L = 5. TWAS weights solve a different problem: they predict the molecular trait from regional genotypes. Fine-mapping evidence and predictive performance should therefore be interpreted separately.

The optional mnm workflow pools cross-validated predictions across contexts and estimates a constrained method-by-context mixture, producing multi-context TWAS weights.

Worked example

The example fine-maps one gene in two molecular-trait contexts and estimates within-context TWAS weights.

Input files

FilePurpose
tests/fixtures/qtl_mini/protocol_example.genotype.chr22.bed with matching .bim and .famPLINK genotype data
input/finemapping/protocol_example.protocol_example.pheno_manifest_context.tsvMaps each gene and context to its indexed phenotype BED and covariate file
input/finemapping/protocol_example.gene_expression.context1.bed.gz with .tbiContext 1 molecular-trait values
input/finemapping/protocol_example.gene_expression.context2.bed.gz with .tbiContext 2 molecular-trait values
tests/fixtures/covariate_hidden_factor/covariates.tsvCovariates for the two contexts
tests/fixtures/qtl_mini/association_windows.bedCis-association window for each gene

Run univariate fine-mapping and estimate TWAS weights

This command constructs the analysis dataset, fits SuSiE separately in each context, and estimates TWAS weights. --save-data retains the residualized matrices for analyses that reuse the fitted dataset.

The worked example produces:

  • output_uni/fine_mapping/protocol_example.ENSG00000130538.univariate_bvsr.rds: context-specific SuSiE fine-mapping results.

  • output_uni/twas_weights/protocol_example.ENSG00000130538.univariate_twas_weights.rds: prediction weights and cross-validation results.

  • output_uni/fine_mapping_meta.tsv: manifest linking regions to the generated fine-mapping and weight files.

Optional: adapt the analysis to peak-based traits

Peak- or CpG-based traits use the same fine-mapping workflow, but first require a phenotype manifest and biologically appropriate association windows. For peak data, the helper below splits a multi-sample BED into indexed region files and assigns each feature to its smallest containing extended TAD. Replace the placeholders with your peak BED, extended-TAD reference, and output directory, then use the generated manifest and windows in the main command.

Parameters used in the example

ParameterWhy it matters here
--phenoFileSupplies the context-specific molecular traits through the phenotype manifest.
--customized-association-windowsDefines the variants considered for each gene instead of using a fixed cis window.
--region-nameRestricts this demonstration to ENSG00000130538.
--transpose-covariatesMatches the orientation of the supplied covariate table.
--save-dataSaves residualized matrices that can be reused downstream.
-j1Runs one job for a reproducible, easy-to-debug example.

See the module link or command reference below for all remaining options and defaults.

Command reference

Results and interpretation

Fine-mapping result

  • output_uni/fine_mapping/protocol_example.ENSG00000130538.univariate_bvsr.rds

The RDS contains a QtlFineMappingResult:

LevelAccessContents
Resultattr(result, "listData")Study, context, trait, method, and context-specific entries
Context entryentries$entry[[i]]Fine-mapping information for one context
topLociattr(entry, "topLoci")Variant IDs, PIPs, posterior effects, credible-set membership, and purity
susieFitattr(entry, "susieFit")Fitted SuSiE model and retained credible sets
cvResultattr(entry, "cvResult")Cross-validation information used during weight estimation

The largest PIPs in context 1 are approximately 0.03, every displayed candidate-set label has purity 0, and SuSiE retains no credible set after filtering. This toy example therefore does not support a localized fine-mapped signal. It demonstrates how to inspect PIPs and credible-set diagnostics, not a biological discovery.

TWAS prediction result

  • output_uni/twas_weights/protocol_example.ENSG00000130538.univariate_twas_weights.rds

The RDS contains a TwasWeights object. attr(tw, "listData") gives the study, context, trait, method, and one entry per context-method combination.

Entry slotContents
variantIdsVariants aligned with the weight vector
weightsPer-variant prediction weights
fitsFitted method-specific prediction model
cvResultCV metrics for individual methods; methodCoef and methodPerformance for the ensemble
standardizedWhether genotype and phenotype inputs were standardized
dataTypeOptional molecular-trait type metadata

For context 1, the SuSiE predictor has cross-validated R2 = 0.960. The ensemble assigns approximately 0.955 of its coefficient weight to bayes_r and 0.045 to enet. These values show how to assess prediction performance and ensemble composition. Because the example contains only 49 samples, they should not be treated as stable estimates of out-of-sample accuracy.

Fine-mapping and TWAS answer different questions. Fine-mapping evaluates which variants are supported within the regional model; TWAS evaluates how well cis-genotypes predict the molecular trait. Before downstream TWAS, confirm allele alignment and validate prediction performance in an adequately sized dataset. A TWAS association does not by itself establish mediation or causality.

Limitations and common pitfalls

  • Sample-ID drift. The phenotype BED’s header columns (5+), the bfile FID/IID, and the covariate TSV header must all be drawn from the same set. Sos does not warn on missing samples — it silently drops them and may report zero overlap.

  • Empty regions. If a region has no variants in its association window (e.g. the manifest points at a window with no bfile coverage) sos marks it completed with an empty output. Verify the expected file count in the INFO: susie_twas output: line.

  • --cis-window vs --customized-association-windows. Either/or. If both are passed the customized windows win. Pass --cis-window -1 to force the customized path explicitly.

Next steps

Use the fine-mapping and TWAS mini-protocol to choose among univariate, multivariate, functional, multi-gene, and summary-statistic routes. Refer to mnm_regression.ipynb for the complete command interface and parameter defaults.

After validating credible sets and cross-validated prediction performance, the TWAS weights can enter the GWAS-integration workflows. Fine-mapping PIPs and TWAS associations answer different questions and should not be treated as interchangeable evidence.