manhattanr: Creates a manhattanr object

Description Usage Arguments Value Source See Also Examples

View source: R/manhattanr.R

Description

An object of class manhattanr includes all the needed information for producing a manhattan plot. The goal is to seperate the pre-processing of the manhattan plot elements from the graphical rendaring of the object, which could be done using any graphical device including plot_ly and plot in base R.

Usage

1
2
manhattanr(x, chr = "CHR", bp = "BP", p = "P", snp, gene, annotation1,
  annotation2, logp = TRUE, ...)

Arguments

x

A data.frame which must contain at least the following three columns:

  • the chromosome number

  • genomic base-pair position

  • a numeric quantity to plot such as a p-value or zscore

chr

A string denoting the column name for the chromosome. Default is chr = "CHR". This column must be numeric or integer. Minimum number of chromosomes required is 1. If you have X, Y, or MT chromosomes, be sure to renumber these 23, 24, 25, etc.

bp

A string denoting the column name for the chromosomal position. Default is bp = "BP". This column must be numeric or integer.

p

A string denoting the column name for the numeric quantity to be plotted on the y-axis. Default is p = "P". This column must be numeric or integer. This does not have to be a p-value. It can be any numeric quantity such as peak heights, bayes factors, test statistics. If it is not a p-value, make sure to set logp = FALSE.

snp

A string denoting the column name for the SNP names (e.g. rs number). More generally, this column could be anything that identifies each point being plotted. For example, in an Epigenomewide association study (EWAS) this could be the probe name or cg number. This column should be a character. This argument is optional, however it is necessary to specify if you want to highlight points on the plot using the highlight argument in the manhattanly function

gene

A string denoting the column name for the GENE names. This column could be a character or numeric. More generally this could be any annotation information that you want to include in the plot. This argument is optional.

annotation1

A string denoting the column name for an annotation. This column could be a character or numeric. This could be any annotation information that you want to include in the plot (e.g. zscore, effect size, minor allele frequency). This argument is optional.

annotation2

A string denoting the column name for an annotation. This column could be a character or numeric. This could be any annotation information that you want to include in the plot (e.g. zscore, effect size, minor allele frequency). This argument is optional.

logp

If TRUE, the -log10 of the p-value is plotted. It isn't very useful to plot raw p-values, but plotting the raw value could be useful for other genome-wide plots, for example, peak heights, bayes factors, test statistics, other "scores" etc.

...

currently ignored

Value

A list object of class manhattanr with the following elements

data

processed data to be used for plotting

xlabel

The label of the x-axis which is determined by the number of chromosomes present in the data

ticks

the coordinates on the x-axis of where the tick marks should be placed

labs

the labels for each tick. This defaults to the chromosome number but can be changed in the manhattanly function

nchr

the number of unique chromosomes present in the data

pName, snpName, geneName, annotation1Name, annotation2Name

The names of the columns corresponding to the data provided. This information is used for annotating the plot in the manhattanly function

Source

The pre-processing is mostly the same as the manhattan function from the qqman package by Stephen Turner

See Also

manhattanly, https://github.com/stephenturner/qqman, D3ManhattanPlots

Examples

1
2
3
4
5
6
7
8
9
# HapMap dataset included in this package already has columns named P, CHR and BP
library(manhattanly)
DT <- manhattanr(HapMap)
class(DT)
head(DT[["data"]])

#include snp and gene information
DT2 <- manhattanr(HapMap, snp = "SNP", gene = "GENE")
head(DT2[["data"]])

sahirbhatnagar/manhattan documentation built on Dec. 17, 2017, 12:11 p.m.