|
| 1 | +--- |
| 2 | +name: gwaslab-analysis-and-output |
| 3 | +description: Use this skill for GWASLab visualization and reporting outputs, including mqq/regional/stacked/miami workflows, lead-variant annotations, and export/report patterns. |
| 4 | +--- |
| 5 | + |
| 6 | +# gwaslab: Analysis and Output |
| 7 | + |
| 8 | +## High-Signal Playbook |
| 9 | +### Route Conditions |
| 10 | +- Use this skill for plot generation, output tuning, and report-ready artifacts. |
| 11 | +- Route to `gwaslab-getting-started` if data is not yet loadable/QCed. |
| 12 | +- Route to `gwaslab-simulation-workflows` for harmonization or clumping prerequisites. |
| 13 | +- Route to `gwaslab-inputs-and-modeling` for format-conversion-only requests. |
| 14 | + |
| 15 | +### Triage Questions |
| 16 | +- Which figure is required: `mqq`, `regional`, `stacked`, `miami`, correlation heatmap? |
| 17 | +- Are input objects already QCed and build-tagged? |
| 18 | +- Is region-specific LD annotation needed (VCF/recombination/GTF)? |
| 19 | +- Are there one or two cohorts (for Miami/stacked comparisons)? |
| 20 | +- Is the issue styling/parameter tuning or plotting failure? |
| 21 | +- What final artifact is needed: figure only, lead table, or formatted output package? |
| 22 | + |
| 23 | +### Canonical Workflow |
| 24 | +1. Confirm input data quality and build before plotting (`docs/tutorial_v4.md`, `docs/visualization_mqq.md`). |
| 25 | +2. Generate baseline `plot_mqq()` with `skip/cut` to control scale/performance (`docs/visualization_mqq.md`). |
| 26 | +3. For locus detail, use `plot_mqq(mode="r", region=...)` with optional LD/gene tracks (`docs/visualization_regional.md`). |
| 27 | +4. For comparisons, use `gl.plot_stacked_mqq()` or `gl.plot_miami2()` with `Sumstats` objects (`docs/visualization_stacked_mqq.md`, `docs/visualization_miami2.md`). |
| 28 | +5. Extract/annotate lead variants with `get_lead()` and export with `to_format()` (`docs/utility_get_lead_novel.md`, `docs/Format.md`). |
| 29 | +6. Cross-check known plotting edge cases in `KnownIssues` when outputs look inconsistent (`docs/KnownIssues.md`). |
| 30 | + |
| 31 | +### Minimal Working Example |
| 32 | +```python |
| 33 | +import gwaslab as gl |
| 34 | + |
| 35 | +s = gl.Sumstats("sumstats.tsv.gz", fmt="auto", build="19") |
| 36 | +s.basic_check(verbose=False) |
| 37 | + |
| 38 | +s.plot_mqq(skip=2, cut=20) |
| 39 | +s.plot_mqq(mode="r", region=(7, 156538803, 157538803)) |
| 40 | +lead = s.get_lead(sig_level=5e-8) |
| 41 | +s.to_format("analysis_ready", fmt="gwaslab") |
| 42 | +``` |
| 43 | + |
| 44 | +### Pitfalls and Fixes |
| 45 | +- `gl.plot_miami2()` called with file paths: pass `Sumstats` objects for `path1` and `path2` (`docs/visualization_miami2.md`). |
| 46 | +- Regional plots missing LD context: provide reference VCF and matching build (`docs/visualization_regional.md`). |
| 47 | +- Plotting full datasets is too slow/noisy: increase `skip` and use `cut`/`mode` adjustments (`docs/visualization_mqq.md`). |
| 48 | +- Unexpected lead extraction in older versions: use updated package and check `KnownIssues` notes (`docs/KnownIssues.md`). |
| 49 | +- Export formatting confusion after plotting: use explicit `to_format()` options and naming rules (`docs/Format.md`). |
| 50 | + |
| 51 | +### Convergence and Validation Checks |
| 52 | +- Figures render with expected panel/layout mode and no build mismatch warnings. |
| 53 | +- Lead-variant counts are consistent with chosen significance/window settings. |
| 54 | +- Annotation labels and highlighted loci map to expected SNPs/genes. |
| 55 | +- Exported tables/files reopen cleanly and preserve plotted variant identifiers. |
| 56 | + |
| 57 | +## Scope |
| 58 | +- Visualization and output generation from QC-ready GWAS summary statistics. |
| 59 | +- Includes parameter tuning and output packaging. |
| 60 | + |
| 61 | +## Primary documentation references |
| 62 | +- `docs/visualization_mqq.md` |
| 63 | +- `docs/visualization_regional.md` |
| 64 | +- `docs/visualization_stacked_mqq.md` |
| 65 | +- `docs/visualization_miami2.md` |
| 66 | +- `docs/visualization_plot_genetic_correlation.md` |
| 67 | +- `docs/Format.md` |
| 68 | +- `docs/format_load_save.md` |
| 69 | +- `docs/KnownIssues.md` |
| 70 | + |
| 71 | +## Workflow |
| 72 | +- Start with docs examples for the requested plot mode. |
| 73 | +- Use `references/doc_map.md` for wider option inventory. |
| 74 | +- Escalate to source maps only when parameter behavior is unclear. |
| 75 | + |
| 76 | +## Source entry points for unresolved issues |
| 77 | +- `src/gwaslab/viz/viz_plot_mqqplot.py` |
| 78 | +- `src/gwaslab/viz/viz_plot_regional2.py` |
| 79 | +- `src/gwaslab/viz/viz_plot_stackedregional.py` |
| 80 | +- `src/gwaslab/viz/viz_plot_stackedpanel.py` |
| 81 | +- `src/gwaslab/viz/viz_plot_miamiplot2.py` |
| 82 | +- `src/gwaslab/viz/viz_plot_rg_heatmap.py` |
| 83 | +- `src/gwaslab/viz/viz_aux_quickfix.py` |
| 84 | +- `src/gwaslab/viz/viz_aux_save_figure.py` |
| 85 | +- `src/gwaslab/util/util_in_get_sig.py` |
| 86 | +- `src/gwaslab/io/io_to_formats.py` |
| 87 | +- Prefer targeted search: `rg -n "<symbol_or_keyword>" src/gwaslab/viz src/gwaslab/util src/gwaslab/io` |
0 commit comments