Tooluniverse gwas finemapping

From mims-harvard/ToolUniverse · View interactive version

Tooluniverse gwas finemapping is an AI agent skill from the GitHub repository mims-harvard/ToolUniverse. Statistical fine-mapping of GWAS loci using credible sets (SuSiE, FINEMAP) and locus-to-gene scoring (Open Targets L2G). Identifies likely causal variants and target genes — distinct from positional 'nearest gene' which is often wrong. Use for prioritizing causal variants at GWAS hits, comparing fin

How to use this skill

Skill file

COMPUTE, DON'T DESCRIBE

When analysis requires computation (statistics, data processing, scoring, enrichment), write and run Python code via Bash. Don't describe what you would do — execute it and report actual results. Use ToolUniverse tools to retrieve data, then Python (pandas, scipy, statsmodels, matplotlib) to analyze it.

GWAS Fine-Mapping & Causal Variant Prioritization

Identify and prioritize causal variants at GWAS loci using statistical fine-mapping and locus-to-gene predictions.

Overview

Genome-wide association studies (GWAS) identify genomic regions associated with traits, but linkage disequilibrium (LD) makes it difficult to pinpoint the causal variant. Fine-mapping uses Bayesian statistical methods to compute the posterior probability that each variant is causal, given the GWAS summary statistics.

REASONING STRATEGY — Start Here:

Fine-mapping asks: which variant at this locus is CAUSAL? Work through this chain:

  1. LD structure first — variants in high LD (r² > 0.8) cannot be statistically distinguished from each other. Look up the LD block via Open Targets or the GWAS Catalog before assuming any single variant is the cause.
  2. Functional annotation breaks LD ties — if two variants have similar posterior probabilities but one is coding (missense, stop-gain) or sits in an active regulatory element (promoter, enhancer), that variant is biologically prioritized. Functional evidence is the tiebreaker.
  3. eQTL colocalization is the key bridge — a variant that is also a significant eQTL for a nearby gene in the relevant tissue (e.g., a pancreatic islet eQTL for a T2D locus) has a mechanistic story. Look up eQTL evidence via Open Targets L2G scores; don't assume the nearest gene is the effector gene.

This skill provides tools to:

Key Concepts

Credible Sets

A credible set is a minimal set of variants that contains the causal variant with high confidence (typically 95% or 99%). Each variant in the set has a posterior probability of being causal, computed using methods like:

Posterior Probability

The probability that a specific variant is causal, given the GWAS data and LD structure. Higher posterior probability = more likely to be causal.

Locus-to-Gene (L2G) Predictions

L2G scores integrate multiple data types to predict which gene is affected by a variant:

L2G scores range from 0 to 1, with higher scores indicating stronger gene-variant links.

Fine-Mapping Reasoning Framework (CRITICAL)

LOOK UP DON'T GUESS -- never assume a lead SNP is the causal variant. Always check LD structure, credible sets, and functional annotations via the tools below.

Step 1: Lead SNP vs Causal Variant

The lead SNP (most significant p-value) is often NOT the causal variant. It is simply the best-tagged variant on the genotyping array. The causal variant may be:

Action: Always call OpenTargets_get_variant_credible_sets for the lead SNP. If the posterior probability is < 0.5, the lead SNP is likely NOT causal -- examine other variants in the credible set.

Step 2: LD Structure Interpretation

LD blocks define the resolution limit of fine-mapping:

Step 3: Credible Set Analysis

When interpreting a credible set:

  1. Size matters: A 95% credible set with 1-3 variants = high resolution. With 50+ variants = low resolution, need more data.
  2. Posterior probability distribution: If one variant has PP > 0.5, it is the strong favorite. If PP is spread evenly across many variants, no single causal variant can be identified statistically.
  3. Multiple credible sets at one locus: Indicates multiple independent causal signals (allelic heterogeneity). Each set represents a different causal mechanism.

Step 4: Colocalization Reasoning

Colocalization asks: do two association signals (e.g., GWAS + eQTL) share the SAME causal variant?

Step 5: Prioritization Tiebreakers

When multiple variants have similar posterior probabilities:

  1. Coding variant (missense, stop-gain) > regulatory > intronic > intergenic
  2. In active chromatin mark (H3K27ac, H3K4me1) in disease-relevant tissue
  3. Disrupts transcription factor binding motif
  4. Conserved across species (PhyloP, GERP)
  5. eQTL in disease-relevant tissue with consistent direction of effect

Common Queries

Tools Used

Open Targets Genetics (GraphQL)

GWAS Catalog (REST API)

Do-It-Yourself Statistical Fine-Mapping, Colocalization, and TWAS

This skill's "Limitations" section above already notes that Open Targets hasn't fine-mapped every published GWAS locus. When a locus has no precomputed OpenTargets_get_variant_credible_sets/OpenTargets_get_study_credible_sets result, three local calculator tools let you run the actual statistics yourself from raw per-SNP summary statistics (beta, standard error, SNP IDs) that you already have or pull from elsewhere:

Where to get the raw inputs: these three tools compute on arrays you supply — they do not fetch summary statistics themselves. src/tooluniverse/data/gwas_sumstats_tools.json's 3 tools (GWASSumStats_list_studies, GWASSumStats_get_trait_studies, GWASSumStats_get_region_associations) were meant to supply exactly this, but as of this writing all three are dead: EBI deprecated its GWAS Summary Statistics REST API entirely — every call returns a clean 410 Gone ("This API has been deprecated. For ways to access summary statistics see: https://www.ebi.ac.uk/gwas/docs/methods/summary-statistics"), confirmed both via tu test and an independent direct curl to the same endpoint. Do not route a workflow through GWASSumStats_* expecting it to work; get region-level summary statistics via the GWAS Catalog's current bulk-download/FTP method (linked from that docs page) or another source, then feed the resulting beta/SE/SNP arrays into the three calculator tools above.

Understanding Fine-Mapping Output

Interpreting Posterior Probabilities

Interpreting L2G Scores

Common Questions

Q: Why don't all variants have credible sets?

A: Fine-mapping requires:

  1. GWAS summary statistics (not just top hits)
  2. LD reference panel
  3. Sufficient signal strength (p < 5e-8)
  4. Computational resources

Q: Can a variant be in multiple credible sets?

A: Yes! A variant can be causal for multiple traits (pleiotropy) or appear in different studies for the same trait.

Q: What if the top L2G gene is far from the variant?

A: This suggests regulatory effects (enhancers, promoters). Check:

Q: How do I choose between variants in a credible set?

A: Prioritize by:

  1. Posterior probability (higher = better)
  2. Functional consequence (coding > regulatory > intergenic)
  3. eQTL evidence
  4. Evolutionary conservation
  5. Experimental feasibility

Limitations

  1. LD-dependent: Fine-mapping accuracy depends on LD structure matching the study population
  2. Requires summary stats: Not all studies provide full summary statistics
  3. Computational intensive: Fine-mapping large studies takes significant resources
  4. Prior assumptions: Bayesian methods depend on priors (number of causal variants, effect sizes)
  5. Missing data: Not all GWAS loci have been fine-mapped in Open Targets

Best Practices

  1. Start with study-level queries when exploring a new disease
  2. Check multiple studies for replication of signals
  3. Combine with functional data (eQTLs, chromatin, CRISPR screens)
  4. Consider ancestry - LD differs across populations
  5. Validate experimentally - fine-mapping provides candidates, not proof

References

  1. Wang et al. (2020) "A simple new approach to variable selection in regression, with application to genetic fine mapping." JRSS-B (SuSiE)
  2. Benner et al. (2016) "FINEMAP: efficient variable selection using summary data from genome-wide association studies." Bioinformatics
  3. Ghoussaini et al. (2021) "Open Targets Genetics: systematic identification of trait-associated genes using large-scale genetics and functional genomics." NAR
  4. Mountjoy et al. (2021) "An open approach to systematically prioritize causal variants and genes at all published human GWAS trait-associated loci." Nat Genet

Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.