labelManhattan: Annotate Manhattan or Miami Plot

View source: R/labelManhattan.R

labelManhattanR Documentation

Annotate Manhattan or Miami Plot

Description

Annotate Manhattan or Miami Plot

Usage

labelManhattan(
  chr,
  pos,
  name,
  gwas,
  gwasChrLab = "chr",
  gwasPosLab = "pos",
  gwasPLab = "p",
  gwasZLab = "NULL",
  chrmaxpos,
  textPos = 4,
  angle = 0,
  miamiBottom = FALSE
)

Arguments

chr

A vector of chromosomes for the markers to be labelled.

pos

A vector of positions on the chromosome for the markers to be labelled. These must correspond to markers in the GWAS dataset used to make the manhattan plot.

name

A vector of labels to be added next to the points specified by chr and pos.

gwas

The same GWAS dataset used to plot the existing Manhattan or Miami plot to be annotated.

gwasChrLab

The name of the column in gwas containing chromosome number. Defaults to ‘⁠"chr"⁠’.

gwasPosLab

The name of the column in gwas containing position. Defaults to ‘⁠"pos"⁠’.

gwasPLab

The name of the column in gwas containing p-values. Defaults to ‘⁠"p"⁠’.

gwasZLab

The name of the column in gwas containing z-values. Defaults to ‘⁠"NULL"⁠’.

chrmaxpos

Data frame containing x coordinates for chromosome start positions, generated by labelManhattan.

textPos

An integer or vector dictating where the label should be plotted relative to each point. Good for avoiding overlapping labels. Provide an integer to plot all points in the same relative position or use a vector to specify position for each label. Passed to the pos option of graphics::text. Defaults to ‘⁠4⁠’.

angle

An integer or vector dictating the plot angle of the label for each point. rovide an integer to plot all points in the same relative position or use a vector to specify position for each label.Passed to the srt option of graphics::text. Defaults to ‘⁠0⁠’.

miamiBottom

If ‘⁠TRUE⁠’, labels will be plotted on the lower region of a Miami plot. If ‘⁠FALSE⁠’, labels will be plotted on the upper region. Defaults to ‘⁠FALSE⁠’.

Details

Add labels beside specified points on a Manhattan or Miami plot. Ideal for adding locus names to peaks. Currently only designed to work with miamiplot2.

Value

Adds annotation to existing Manhattan or Miami plot

Note

Extended to handle extreme P values.

Author(s)

Jonathan Marten

Examples

## Not run: 
labelManhattan(c(4,5,11,19),c(9994215,16717922,45538760,51699256),
               c("GENE1","GENE2","GENE3","GENE4"),
               gwas1,chrmaxpos=chrmaxpos)
labelManhattan(geneLabels$chr,geneLabel$pos,geneLabel$geneName,gwas1,chrmaxpos=chrmaxpos)

## End(Not run)

gap documentation built on Sept. 11, 2024, 5:36 p.m.