When to Use
- GWAS studies: Standard plot for genome-wide association results
- Rare variant analysis: Display exome-wide or gene-based p-values
- eQTL mapping: Show expression QTL associations
- TWAS: Transcriptome-wide association studies
- Meta-analysis: Combined GWAS results across cohorts
- Quality control: Identify systematic bias or inflation
Basic Example
Input Modes
Three methods map(chrom, …, pvalue) onto the cumulative x-axis:
Mode 1: Sequential Index — with_data
SNPs placed at consecutive integer x positions within each chromosome.
Mode 2: Base-pair Coordinates — with_data_bp
SNP x = chromosome cumulative offset + bp position. Standard mode for GWAS.
GenomeBuild Options
GenomeBuild::Hg19— GRCh37 / hg19 (24 chromosomes + MT)GenomeBuild::Hg38— GRCh38 / hg38 (24 chromosomes + MT)GenomeBuild::T2T— T2T-CHM13 v2.0 / hs1 (telomere-to-telomere)GenomeBuild::Custom(vec)— User-suppliedVec<(chrom_name, size_bp)>
Mode 3: Pre-computed x — with_data_x
Supply explicit cumulative x coordinates.
Key Methods
Thresholds
with_genome_wide(threshold: f64)
Set genome-wide significance in −log₁₀ scale (default 7.301 = p = 5×10⁻⁸).
with_label_top labels.
with_suggestive(threshold: f64)
Set suggestive significance in −log₁₀ scale (default 5.0 = p = 1×10⁻⁵).
Colors
with_color_a(color: impl Into<String>) / with_color_b(color: impl Into<String>)
Set colors for alternating chromosomes (default "steelblue" / "#5aadcb").
with_palette(palette: Palette)
Override two-color scheme with a full palette. Colors cycle across chromosomes.
Gene Labels
with_label_top(n: usize)
Label the n most significant points above the genome-wide threshold (lowest p-values).
with_label_style(style: LabelStyle)
Set label placement style (default LabelStyle::Nudge).
LabelStyle::Nudge(default) — Labels sorted by x and nudged verticallyLabelStyle::Exact— Labels at exact point positionLabelStyle::Arrow { offset_x, offset_y }— Labels offset with leader line
with_point_labels(iter)
Attach specific gene/SNP labels to points by (chrom, x, label).
x value must match the coordinate assigned at data-load time.
Other Options
with_point_size(size: f64)
Set radius in pixels (default 2.5).
with_pvalue_floor(floor: f64)
Set explicit p-value floor for −log10 transform. Points with pvalue == 0.0 clamped to this value.
with_legend(label: impl Into<String>)
Enable legend showing genome-wide and suggestive threshold lines.
Examples
Standard GWAS — GRCh38
Custom Genome Build
Custom Color Palette
Exome-wide Sequential Index
Zero p-values
p-values of exactly0.0 are clamped at the smallest non-zero p-value (or pvalue_floor) to prevent infinite y positions.
Chromosome Names
Chromosome names are accepted with or without the"chr" prefix. Internally normalized to standard order: 1–22, X, Y, MT, then lexicographic.
See Also
- VolcanoPlot — For differential expression results
- Scatter — For general scatter plots