Last data update: 2014.03.03

R: QQ plot for genome wide assocation studies
qqPlotR Documentation

QQ plot for genome wide assocation studies

Description

Generates a Quantile-Quantile plot for -log10 p-values from genome wide association tests.

Usage

qqPlot(pval, truncate = FALSE, ylim = NULL, thinThreshold = NULL, ci=TRUE, ...)

Arguments

pval

Vector of p-values

truncate

Either a logical value indicating whether the y-axis should be truncted to the same range as the x-axis, or a numeric value indicating where to truncate the y-axis. See details.

ylim

Limits for the y axis. Ignored if truncate=TRUE or truncate is numeric.

thinThreshold

if not NULL, -log10(pval) threshold for thinning points.

ci

logical indicator for whether to add confidence intervals to plots?

...

Other parameters to be passed directly to plot.

Details

The function generates a Quantile-Quantile plot of p-values on a -log10 scale, with the option of truncating the y-axis to the range of the x-axis (0, -log10(1/length(pval)). If the y-axis is truncated, then points off the top of the plot are denoted by triangles at the upper edge. The 95% confidence interval is shaded in gray.

If truncate is set to a numeric value, then ylim is set to c(0, truncate) only if the value of truncate is bigger than the maximum -log10(pval). (Use the ylim argument if alternatve behavior is desired.)

If requested with thinThreshold, points with p-values < -log10(thinThreshold) are thinned before plotting. All points with -log10(pval) >= thinThreshold plus 10,000 points with -log10(pval) < thinThreshold (randomly selected in uniformly-spaced bins of -log10(pval)) are displayed.

Author(s)

Cathy Laurie, Matthew P. Conomos, Adrienne Stilp

Examples

pvals <- seq(0, 1, 0.001)
qqPlot(pvals)
qqPlot(pvals, thinThreshold=2)
qqPlot(pvals, truncate=TRUE)
qqPlot(pvals, truncate=10)

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(GWASTools)
Loading required package: Biobase
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
    get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
    match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
    rbind, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit

Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/GWASTools/qqPlot.Rd_%03d_medium.png", width=480, height=480)
> ### Name: qqPlot
> ### Title: QQ plot for genome wide assocation studies
> ### Aliases: qqPlot
> ### Keywords: hplot
> 
> ### ** Examples
> 
> pvals <- seq(0, 1, 0.001)
> qqPlot(pvals)
> qqPlot(pvals, thinThreshold=2)
> qqPlot(pvals, truncate=TRUE)
> qqPlot(pvals, truncate=10)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>