Last data update: 2014.03.03

R: Make a Manhattan Plot
manhattan_plotR Documentation

Make a Manhattan Plot

Description

Generates a manhattan plot (a plot of -log10(p-val)) for a set of markers by chromosome and base-pair position.

Usage

manhattan_plot(pval, bp, chr, groups = NULL, cutoff = NULL,
  xlab = "Chromosome (base-pair position)",
  ylab = expression(paste(-log[10](italic(p)))), transform = TRUE,
  cex = 0.5, ...)

Arguments

pval

A vector of p-values.

bp

A vector of base-pair positions, corresponding to the genomic location for which that p-value is associated (typically, the SNP location).

chr

The chromosomal location associated with the p-value.

groups

A groups vector: used if you want to overlay multiple manhattan plots.

cutoff

optional. By default, a Bonferroni cutoff line is drawn on the plot; if you want to plot a custom cut-off line you can specify the cutoff here.

xlab

The label to use for the x axis.

ylab

The label to use for the y axis.

transform

boolean; if TRUE, we compute -log10(pval); otherwise, we use pval as-is, assuming that pval has been transformed accordingly.

cex

Multiplier for the point size.

...

Optional arguments passed to xyplot.

Examples

pval <- runif(1E4)
bp <- c(1:5E3, 1:5E3)
chr <- rep(1:22, length.out=1E4)
groups=rep( c("Phenotype 1", "Phenotype 2"), each=5E3 )
manhattan_plot( pval, bp, chr, groups, main="Two Phenotype MH Plot" )
manhattan_plot( pval, bp, chr, main="Manhattan Plot" )

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(Kmisc)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Kmisc/manhattan_plot.Rd_%03d_medium.png", width=480, height=480)
> ### Name: manhattan_plot
> ### Title: Make a Manhattan Plot
> ### Aliases: manhattan_plot
> 
> ### ** Examples
> 
> pval <- runif(1E4)
> bp <- c(1:5E3, 1:5E3)
> chr <- rep(1:22, length.out=1E4)
> groups=rep( c("Phenotype 1", "Phenotype 2"), each=5E3 )
> manhattan_plot( pval, bp, chr, groups, main="Two Phenotype MH Plot" )
> manhattan_plot( pval, bp, chr, main="Manhattan Plot" )
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>