ggman: Creates a Manhattan Plot.

Description Usage Arguments Details Value Examples

View source: R/ggman.R

Description

Creates a Manhattan Plot as a ggplot layer.

Usage

1
2
3
4
5
6
7
ggman(gwas, clumps = NA, snp = NA, bp = NA, chrom = NA, pvalue = NA,
  sigLine = 8, lineColour = "red", pointSize = 0.1, ymin = NA,
  ymax = NA, logTransform = TRUE, invert = FALSE, invert.method = "or",
  invert.var = "or", relative.positions = FALSE, xlabel = "chromosome",
  ylabel = "-log10(P value)", title = "Manhattan Plot",
  legend.title = "legend", clumps.label.type = "label",
  legend.remove = FALSE, ...)

Arguments

gwas

A data frame with the gwas results

clumps

Optional argument; takes an object of class 'ggclumps' containing the SNP clumps, see ggmanClumps

snp

Name of the column containing SNP identifiers; default is 'snp'

bp

Name of the column containing the basepair positions; default is 'bp'

chrom

Name of the column containing the chromosome identifers; default is 'chrom'

pvalue

Name of the column containing the p values; default is 'pvalue'

sigLine

Threshold for the genome wide significant line in -log10 scale; default is 8; specify NA to remove the line.

lineColour

colour of the genomewide line; default is 'red'

pointSize

Size of the points in the plot; default is 0.1

ymin

Starting point of y axis; default is 0

ymax

Ending point of y axis

logTransform

if TRUE, P value is -log10 transformed; default is TRUE; Specify FALSE when plotting values other p values, such as zscore or beta

invert

if TRUE, an inverted Manhattan Plot will be created. The p values of the variants with (or < 1 or beta < 0) will positive log10-transformed, which will result in negative values.

invert.method

whether inversion should be based on odds ratio or beta. possible values: 'or' or 'beta'

invert.var

name of the column in the gwas data.frame containing the or or beta

relative.positions

if TRUE, the x axis points will be calculated in proportion to the basepair positions. So, the gaps in the genome with no genotypes will be reflected in the plot(requires more computation, hence more time to plot). If FALSE, the SNPs are ascendingly sorted chromosome-wise. The default value is FALSE.

xlabel

X-axis label

ylabel

Y-axis label

title

plot title

legend.title

title of legend; this argument applies only when the clumps are plotted and highlighted in groups.

clumps.label.type

type of label; either 'text' or 'label'; default is 'label'

legend.remove

if TRUE, the legend will be removed; default is FALSE

...

other arguments to pass to geom_point; Note: do not use size to specify size of the points, instead use pointSize

Details

The function creates a manhattan plot as a ggplot layer. The output can be stored in a variable, and additional layers can be added. See ggmanHighlight, ggmanZoom and ggmanLabel.

Value

A Manhattan Plot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#simple Manhattan Plot
ggman(toy.gwas, snp = "snp", bp = "bp", chrom = "chrom",
pvalue = "pvalue")

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

#plot odds ratio
ggman(toy.gwas, snp = "snp", bp = "bp", chrom = "chrom",
pvalue = "or",logTransform = FALSE, ymax = 3)

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

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

veera-dr/ggman documentation built on May 3, 2019, 4:59 p.m.