Ggman
R package to create manhattan plots using ggplot
Install / Use
/learn @drveera/GgmanREADME
R package to create manhattan plots using ggplot
##Note: The package is currently under development. Please raise issues for any bugs you identify.
##Version
0.99.0.beta
Installation
library(devtools)
install_github("drveera/ggman")
##Quick Reference
Please refer to package vignette and the wiki page for detailed information on the usage.
Create a basic Manhattan plot
ggman(toy.gwas, snp = "snp", bp = "bp", chrom = "chrom", pvalue = "pvalue")

Use relative positioning
ggman(toy.gwas, snp = "snp", bp = "bp", chrom = "chrom", pvalue = "pvalue", relative.positions = TRUE)

Add labels
#subset only the SNPs with -log10(pvalue) > 8
toy.gwas.sig <- toy.gwas[-log10(toy.gwas$pvalue)>8,]
## save the main layer in a variable
p1 <- ggman(toy.gwas, snp = "snp", bp = "bp", chrom = "chrom", pvalue = "pvalue", relative.positions = TRUE)
##add label
ggmanLabel(p1, labelDfm = toy.gwas.sig, snp = "snp", label = "snp")

Add text
ggmanLabel(p1, labelDfm = toy.gwas.sig, snp = "snp", label = "snp", type = "text")

Highlight a single group of points
ggmanHighlight(p1, highlight = toy.highlights)

Multiple Highlights
ggmanHighlightGroup(p1, highlightDfm = toy.highlights.group, snp = "snp", group = "group",
size = 0.5, legend.title = "Significant groups")

Add clumps
gwas.clump <- read.table("plink.clumped", header = TRUE)
toy.clumps <- ggmanClumps(toy.clumped, index.snp.column = "SNP", clumps.column = "SP2")
ggman(toy.gwas,clumps = toy.clumps, snp = "snp", bp = "bp", chrom = "chrom", pvalue = "pvalue", relative.positions = TRUE, pointSize = 0.5)

highlight and label the clumps
toy.clumps <- ggmanClumps(toy.clumped, index.snp.column = "SNP", clumps.column = "SP2", group.column = "group", label.column = "label")
ggman(toy.gwas,clumps = toy.clumps, snp = "snp", bp = "bp", chrom = "chrom", pvalue = "pvalue", relative.positions = TRUE, pointSize = 0.5)

Zoom in to a specific chromosome
ggmanZoom(p1, chromosome = 1)

Zoom in to a specific region of a chromosome
ggmanZoom(p1, chromosome = 1, start.position = 215388741, end.position = 238580695)

Highlight points in the zoomed region
ggmanZoom(p1, chromosome = 1, start.position = 215388741, end.position = 238580695, highlight.group = "gene", legend.title = "Genes")

Inverted Manhattan Plot
ggman(toy.gwas, snp = "snp", bp = "bp", chrom = "chrom", pvalue = "pvalue", invert = TRUE, invert.method = 'or', invert.var = "or")

Plot Odds Ratio
ggman(toy.gwas, snp = "snp", bp = "bp", chrom = "chrom", pvalue = "or", logTransform = FALSE, ymax = 3)

Plot Beta Values
ggman(toy.gwas, snp = "snp", bp = "bp", chrom = "chrom", pvalue = "beta", logTransform = FALSE, ymin = -2, ymax = 2)

Related Skills
node-connect
339.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
83.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
339.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
83.9kCommit, push, and open a PR
