plotgg_manhattan: Manhattan plot with ggplot2

Description Usage Arguments Value Examples

View source: R/plotgg_manhattan.r

Description

Creates manhattan plot

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
plotgg_manhattan(
  dat,
  refs = NULL,
  pval_thres = 1e-06,
  pval_column = "p.value",
  log_transform = TRUE,
  color_refs = TRUE,
  alpha = 0.2,
  custom_theme = ggplot2::theme(panel.background = ggplot2::element_blank(), panel.grid
    = ggplot2::element_blank(), axis.text = ggplot2::element_text(color = "black"),
    axis.title = ggplot2::element_text(color = "black", face = "bold"),
    axis.line.x.bottom = ggplot2::element_line(), axis.line.y.left =
    ggplot2::element_line())
)

Arguments

dat

A data.frame or tibble with columns 'ref_id', 'ref_pos' and one column matching 'pval_column'.

refs

A data.frame or tibble with columns 'ref_id', 'start' and 'end'.

pval_thres

p-value threshold value to draw a line.

pval_column

Name of the column with the p-values.

log_transform

If TRUE, values in 'pval_column' will be transformed via -log10(p-value).

color_refs

If TRUE, points from different refs will have different colors.

alpha

Transparency parameters for the points

custom_theme

A theme function or call to format the plot.

Value

A ggplot2 plot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# Create some fake data
set.seed(12345)
dat <- tibble::tibble(ref_id = rep(LETTERS[1:5], each = 20),
                      ref_pos = sample(1:200,size = 100, replace = FALSE),
                      p.value = runif(100)^4)

# Create some fake ref sizes
refs <- tibble::tibble(ref_id = LETTERS[1:5],
                       start = 0,
                       end = c(600,500,450,400,200))

# Make some plots
plotgg_manhattan(dat)
plotgg_manhattan(dat, refs = refs)
plotgg_manhattan(dat, refs = refs, color_refs = FALSE)

surh/HMVAR documentation built on Aug. 18, 2021, 1:21 a.m.