qqplot: Log QQ p-value plot

View source: R/qqplot.R

qqplotR Documentation

Log QQ p-value plot

Description

Fast function for generating a log quantile-quantile (QQ) p-value plot

Usage

qqplot(
  pval,
  fdr = NULL,
  fdr_cutoff = 0.05,
  scheme = c("darkgrey", "royalblue"),
  npoints = 5e+05,
  show_plot = TRUE,
  verbose = TRUE,
  ...
)

Arguments

pval

A vector of p-values

fdr

An optional vector of FDR values to save time if previously computed. If not supplied, these will be calculated using p.adjust() using the Benjamini-Hochberg method.

fdr_cutoff

Cutoff for FDR significance

scheme

Vector of 2 colours for plotting non-significant and significant SNPs

npoints

Limits the number of non-significant points being plotted to speed up plotting. See details. Set to NULL to plot all points.

show_plot

Logical whether to produce a plot via base graphics or just return dataframe ready for plotting.

verbose

Whether to show messages

...

Optional plotting arguments passed to qqplot2()

Details

Produces a fast QQ plot. Particularly useful for analyses with very large numbers of p-values (such as eQTL analysis) which can be slow to plot. The function looks first for all comparisons which reached FDR at the designated cut-off and ensures all of these points are plotted. Additional points which typically overlap substantially near the origin are thinned by random sampling. In this way the plot can be reduced from millions of points to 500,000 points with a plot which is indistinguishable from one with all points plotted. For comparison, set npoints to NULL to plot all points as usual.

Calling qqplot() will result in a base graphics plot. The plotting dataframe is returned invisibly, so users can save time when refining plots by saving the dataframe produced by qqplot() and then invoking qqplot2() to simply plot the points. Users who prefer ggplot2 can also pass the dataframe generated by qqplot() to gg_qqplot().

Value

Generates a plot using base graphics. Also returns a dataframe invisibly which can be used for downstream plotting via either qqplot2() or gg_qqplot().

See Also

qqplot2() gg_qqplot()


easylabel documentation built on May 29, 2024, noon