fast_manhattan: A fast function for Manhattan plots

View source: R/fast_manhattan.R

fast_manhattanR Documentation

A fast function for Manhattan plots

Description

This is a very fast and easy-to-individualize plotting function for GWAS results e.g. pvalues based on ggplot2 and scattermore.

Usage

fast_manhattan(
  data,
  build = "hg19",
  color1 = "black",
  color2 = "grey",
  y_scale = TRUE,
  log10p = TRUE,
  alpha = 1,
  speed = "fast",
  pointsize = 0,
  pixels = c(512, 512),
  dodge_x = FALSE,
  highlight = NULL,
  ...
)

Arguments

data

A data.frame. Columns 'chr', 'pos', and 'pvalue' are required

build

Genomic build. Currently hg18, hg19, and hg38 are supported. If you are not sure about, set the default "hg19".

color1

Color for odd-numbered chromosomes

color2

Color for even-numbered chromosomes

y_scale

When an own y-scale is provided then set this to TRUE to avoid an error.

log10p

If TRUE (default), the -log10 transformed pvalues are plotted

speed

The speed option. Fast and ultrafast use scattermore functionality

pointsize

Only when using the 'fast' option you can increase pointsize. Default is 0. When using small pointsizes it could be that points are not shown in the RStudio Plots or Zoom window. But they will plotted when saving to pdf.

pixels

Only when using the 'fast' option you can increase pixel width and height. Default is c(512, 512).

dodge_x

default FALSE. When turned on all chromosome labels are drawn and every second are moved a little bit to the bottom.

highlight

Character vector with matching entries of 'data$rsid' or column 'highlight' in data with NAs or concrete colors e.g. 'deeppink'.

Value

A ggplot2 object/plot

Examples

data("gwas_data")
head(gwas_data)
# slow
fast_manhattan(gwas_data, build='hg18')
# fast
fast_manhattan(gwas_data, build = "hg18", speed = "fast")
# ultrafast
fast_manhattan(gwas_data, build='hg18', speed = "ultrafast")
# highlight most significant snps
fast_manhattan(gwas_data, build='hg18', speed = "fast", highlight = gwas_data[gwas_data$pvalue < 10e-20,]$rsid)

roman-tremmel/ggfastman documentation built on Feb. 20, 2024, 11:59 a.m.