Skip to content

jleebio/gwasvizr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gwasvizr

Are you tired of ugly plots? Meet gwasvizr!

Beautiful by default, customizable when needed.

gwasvizr produces publication-ready Manhattan and Miami plots for genome-wide association studies (GWAS) with beautiful defaults and minimal code.

Required Input Format

Your data needs just 3 columns:

Column Type Description
chr character/integer Chromosome (1-22, X, Y, MT)
pos numeric Base pair position
p numeric P-value (0 to 1)

That's it. The package handles the rest.

Flexible Chromosome Handling

✅ Accepts: "1", 1, "chr1", "CHR1"
✅ Accepts: "X", "x", "chrX"
✅ Accepts: "MT", "M", "chrM", "mito"

All formats are automatically standardized internally.

Installation

# Development version
devtools::install_github("jleebio/gwasvizr")

Quick Start

Manhattan Plot Example

Using bladder calculus GWAS data with peak highlighting:

library(gwasvizr)

# Load bladder calculus GWAS data using the built-in function
bladder_calculus_data <- load_gwas_data(
    file = "bladder_calculus.h.tsv.gz",
    chrom_col = "chromosome",
    pos_col = "base_pair_location", 
    pval_col = "p_value",
    snp_col = "variant_id"
)

# Define SNPs to highlight and their corresponding gene names
highlight_snps <- c("16_20381010_G_A", "5_177371039_T_G")
label_text <- c("16_20381010_G_A" = "PDILT", "5_177371039_T_G" = "RGS14")

# Create Manhattan plot with peak highlighting and custom gene labels
manhattan_plot(
    data = bladder_calculus_data,           # Your GWAS data
    highlight_mode = "peak",                # "peak" or "snp" highlighting
    peak_window = 500000,                   # Window size around peaks (bp)
    highlight = highlight_snps,             # Specific SNPs to highlight
    highlight_color = "red3",               # Color for highlighted points
    highlight_shape = 16,                   # Shape: 16=circle, 17=triangle, etc.
    highlight_size = 2.0,                   # Size of highlighted points
    label_highlight = TRUE,                 # Show labels on highlights
    label_text = label_text,                # Custom gene labels
    label_color = "black",                  # Color for label text
    label_size = 4,                         # Size for label text
    label_fontface = "plain",               # Font style (plain, bold, italic)
    sig_threshold = 1e-20,                  # Main significance line
    suggestive_threshold = 5e-8,            # Suggestive significance line
    sig_line_color = "darkblue",            # Main significance line color
    suggestive_line_color = "orange"        # Suggestive line color
)

Manhattan plot with bladder calculus data

Miami Plot Example

# Load Heart Failure data
heart_failure <- load_gwas_data(
    file = "heart_failure.h.tsv.gz",
    chrom_col = "chromosome",
    pos_col = "base_pair_location",
    pval_col = "p_value", 
    snp_col = "variant_id"
)

# Create Miami plot comparing metabolic vs cardiovascular traits
miami_plot(
    top_data = koges_bmi,                    # Metabolic trait (top)
    bottom_data = heart_failure,             # Cardiovascular trait (bottom)
    top_label = "KOGES BMI",                 # Top panel title
    bottom_label = "Heart Failure",          # Bottom panel title
    chr_colors = c("forestgreen", "seashell2"), # Custom color scheme
    highlight_color = "deeppink4",           # Highlight color for both panels
    highlight_shape = 8,                     # Star shape for highlights
    highlight_size = 2.0,                    # Medium highlight size
    label_highlight = TRUE,                  # Show labels on significant hits
    sig_line_color = "#d32f2f",              # Red significance lines
    suggestive_line_color = "#1976d2"       # Blue suggestive lines
)

Miami plot comparing KOGES BMI and Heart Failure

Customization Options

Common Parameters for Both Plot Types:

  • chr_colors: Two-color vector for alternating chromosomes c("color1", "color2")
  • highlight_color: Color for highlighted points (e.g., "red", "#FF0000")
  • highlight_shape: Point shapes (16=circle, 17=triangle, 18=diamond, 19=filled circle, 8=star)
  • highlight_size: Size of highlighted points (numeric, e.g., 1.5, 2.0, 3.0)
  • label_highlight: Show labels on highlighted points (TRUE/FALSE)
  • sig_line_color: Main significance line color
  • suggestive_line_color: Suggestive significance line color

Manhattan Plot Specific:

  • highlight_mode: "peak" (region highlighting) or "snp" (individual points)
  • peak_window: Window size around peaks in base pairs (e.g., 500000, 1000000)
  • label_text: Named vector for custom SNP labels (e.g., c("rs123" = "GENE1", "rs456" = "GENE2"))
  • label_color: Color of label text (e.g., "black", "red")
  • label_size: Size of label text (numeric, e.g., 3, 4, 5)
  • label_fontface: Font style of labels ("plain", "bold", "italic")
  • sig_threshold: Main significance threshold (e.g., 5e-8, 1e-5)
  • suggestive_threshold: Suggestive significance threshold (e.g., 1e-5, 1e-3)
  • chr_label_size: Size of chromosome labels (numeric)
  • y_axis_tick_size: Size of Y-axis tick labels (numeric)

Miami Plot Specific:

  • top_data / bottom_data: Data frames for each panel
  • top_label / bottom_label: Panel titles/labels
  • gap_ratio: Space between panels (negative values create overlap, e.g., -0.14)
  • highlight_a / highlight_b: SNPs to highlight in each panel
  • top_sig_threshold / bottom_sig_threshold: Panel-specific significance thresholds
  • chr_label_size: Chromosome label size (numeric)
  • chr_label_fontface: Label style ("plain", "bold", "italic")
  • y_axis_tick_size: Y-axis tick label size (numeric)
  • x_axis_tick_size: X-axis tick label size (numeric)

Citation

If you use gwasvizr in your research, please cite:

Lee, J. (2026). gwasvizr: R package version 1.0.0. https://github.com/jleebio/gwasvizr

BibTeX entry:

@software{lee2026gwasvizr,
  author = {Lee, Jeongah},
  title = {gwasvizr},
  year = {2026},
  version = {1.0.0},
  url = {https://github.com/jleebio/gwasvizr},
  note = {R package}
}

Your citation helps others find and use this tool, and it supports the development of open-source software. Thank you!

License

MIT License - see LICENSE file for details.

About

gwasvizr: Publication-ready Manhattan and Miami plots for GWAS data

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages