[med-svn] [r-cran-qqman] 01/02: Imported Upstream version 0.1.4

Dylan Aïssi bob.dybian-guest at moszumanska.debian.org
Wed Mar 22 20:53:03 UTC 2017


This is an automated email from the git hooks/post-receive script.

bob.dybian-guest pushed a commit to branch master
in repository r-cran-qqman.

commit 0e79fb1e9fee061cfcee1aace8e48e4f0e26e45f
Author: Dylan Aïssi <bob.dybian at gmail.com>
Date:   Wed Mar 22 21:52:05 2017 +0100

    Imported Upstream version 0.1.4
---
 DESCRIPTION             |  14 ++++----
 MD5                     |  34 ++++++++++---------
 NAMESPACE               |   6 +++-
 NEWS.md                 |  23 +++++++++++++
 R/manhattan.R           |  48 +++++++++++++++++++++++----
 R/qq.R                  |   4 +++
 R/snpsOfInterest-data.R |   1 +
 README.md               |   4 ++-
 build/vignette.rds      | Bin 211 -> 212 bytes
 inst/doc/qqman.R        |   6 ++++
 inst/doc/qqman.Rmd      |  12 +++++++
 inst/doc/qqman.html     |  85 +++++++++++++++++++++++++++++++-----------------
 man/gwasResults.Rd      |   4 +--
 man/manhattan.Rd        |  34 +++++++++++--------
 man/qq.Rd               |   5 +--
 man/qqman.Rd            |   4 +--
 man/snpsOfInterest.Rd   |   6 ++--
 tools/qqman.gif         | Bin 0 -> 281811 bytes
 vignettes/qqman.Rmd     |  12 +++++++
 19 files changed, 218 insertions(+), 84 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index dbcde6a..b88aae5 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,15 +1,17 @@
 Package: qqman
-Title: Q-Q and manhattan plots for GWAS data
-Version: 0.1.2
+Title: Q-Q and Manhattan Plots for GWAS Data
+Version: 0.1.4
 Author: Stephen Turner <vustephen at gmail.com>
 Maintainer: Stephen Turner <vustephen at gmail.com>
-Description: Q-Q and manhattan plots for GWAS data
-Depends: R (>= 3.0.0)
+Description: Create Q-Q and manhattan plots for GWAS data from PLINK results.
+Depends: R (>= 3.0.0),
+Imports: calibrate
 Suggests: knitr
 License: GPL-3
 LazyData: true
 VignetteBuilder: knitr
-Packaged: 2014-09-25 16:54:14 UTC; sdt5z
+RoxygenNote: 6.0.1
 NeedsCompilation: no
+Packaged: 2017-03-15 17:42:34 UTC; sdt5z
 Repository: CRAN
-Date/Publication: 2014-09-25 22:29:57
+Date/Publication: 2017-03-16 03:19:14
diff --git a/MD5 b/MD5
index 4fb8e9e..7f60daa 100644
--- a/MD5
+++ b/MD5
@@ -1,21 +1,23 @@
-878f0a46bac21b0a8714378777493948 *DESCRIPTION
-e8a3b67a1cfc5de2c87e2c05509ccb86 *NAMESPACE
+f022a46b2403ef302c08a258781b4171 *DESCRIPTION
+6d818b3191e430b4dc5e64be2f7a0f77 *NAMESPACE
+9b09f7b747f86fe5ee2bababd94ff8da *NEWS.md
 4703c59c0422edc311c09f34a79425c2 *R/gwasResults-data.R
-506bb6bd378ce87b44d1b452c47dac6a *R/manhattan.R
+16373184eb5c5cd7359af8e458903eac *R/manhattan.R
 6f2bc34e71e66aef115d0a9dff9c2c78 *R/package.R
-32fa6e2f67e18b0f33654b21de1624a6 *R/qq.R
-1d2a7fe82e8a5143d495b8f2f7800eca *R/snpsOfInterest-data.R
+ba406a08010ce9f456757cec1c391170 *R/qq.R
+1d8183045f8520b6f1f7a05b8e8eddd4 *R/snpsOfInterest-data.R
 4e7b578263eee2e20de8b161e4c08af4 *R/zzz.R
-7d28ad0c1131dbad19b657df61645cda *README.md
-86002107ab6d65a20ca6f0bbc7db8d34 *build/vignette.rds
+0c5de2132b11035c80fad042ba49fa63 *README.md
+163dfff68fd924f44e30f4ba1dab5d9f *build/vignette.rds
 ff43bc38623980d5b64e423362075c10 *data/gwasResults.RData
 a10481df0b1192bc3f599e14414e0a55 *data/snpsOfInterest.RData
-9cb0830cb6ce29dbd98ebbb76d770cab *inst/doc/qqman.R
-47c06f8e3c96a96fca34f31fad80fd6d *inst/doc/qqman.Rmd
-c608b972e60a7ce5b88f47c7ae9055cb *inst/doc/qqman.html
-d1bb3943d85241abb665c6235c55825a *man/gwasResults.Rd
-516c1f05ddcecd781b1b1e01e16ad68d *man/manhattan.Rd
-7b64ebaab0b22df9b3c146614083689b *man/qq.Rd
-e7729862ac4cb3540ee65a21600538a4 *man/qqman.Rd
-efcb6525c2360e9fbf5acfa005b5cdff *man/snpsOfInterest.Rd
-47c06f8e3c96a96fca34f31fad80fd6d *vignettes/qqman.Rmd
+f79658ca04fe49041faee56fd1b973e5 *inst/doc/qqman.R
+3c08b1a29af86383f51c9f039bcd10f7 *inst/doc/qqman.Rmd
+c3ffd9e4c8e62c22b5b05338cbdf0adc *inst/doc/qqman.html
+5fcd5f195193e0c06c67306869eb5be0 *man/gwasResults.Rd
+1e5453a5e9abaa2d08bb4ea3e10e79da *man/manhattan.Rd
+84d4a5c8877bcff6b205d90cf45a9afe *man/qq.Rd
+5280e7e7b388f7c3a6b5c431499a29aa *man/qqman.Rd
+df5c691e8de49e89eb05316e6aacce0d *man/snpsOfInterest.Rd
+3f6ead1f8902b40ec314a33eccfc1b32 *tools/qqman.gif
+3c08b1a29af86383f51c9f039bcd10f7 *vignettes/qqman.Rmd
diff --git a/NAMESPACE b/NAMESPACE
index 5d9f9a2..8ca06fa 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -1,4 +1,8 @@
-# Generated by roxygen2 (4.0.1): do not edit by hand
+# Generated by roxygen2: do not edit by hand
 
 export(manhattan)
 export(qq)
+import(graphics)
+import(utils)
+importFrom(calibrate,textxy)
+importFrom(stats,ppoints)
diff --git a/NEWS.md b/NEWS.md
new file mode 100644
index 0000000..8b6ac40
--- /dev/null
+++ b/NEWS.md
@@ -0,0 +1,23 @@
+# qqman 0.1.4
+
+* Minor fix to location to referenced image for pandoc self-contained README.html generation. 
+
+# qqman 0.1.3
+
+* Annotate SNPs below a p-value threshold with the `annotatePval=` option. See vignette for details.
+* Annotate the top SNP on each chromosome with the `annotateTop=` option. See vignette for details.
+
+# qqman 0.1.2
+
+* Does not assume that SNPs are evenly distributed across chromosomes when deciding where to place the tick in the center of the chromosome.
+* Changed single chromosome x-axis notation to use Mb instead of raw pos
+* `qq()` accepts graphical parameters the same way as `manhattan()`
+* Removed default `xlim`
+* Citation details on package load
+* Added axis label options
+* Removed `ymax` argument in favor of allowing user to set `ylim` in `...`
+* Option to *not* take log of p-value
+
+# qqman 0.1.1
+
+* Fixed a bunch of typos in the vignette
diff --git a/R/manhattan.R b/R/manhattan.R
index 555e1c7..b6e3b51 100644
--- a/R/manhattan.R
+++ b/R/manhattan.R
@@ -26,22 +26,29 @@
 #'   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.
+#' @param annotatePval If set, SNPs below this p-value will be annotated on the plot.
+#' @param annotateTop If TRUE, only annotates the top hit on each chromosome that is below the annotatePval threshold. 
 #' @param ... Arguments passed on to other plot/points functions
 #'   
 #' @return A manhattan plot.
 #'   
 #' @keywords visualization manhattan
 #'   
+#' @import utils
+#' @import graphics
+#' 
 #' @examples
 #' manhattan(gwasResults)
 #'   
+#' @importFrom calibrate textxy  
+#'   
 #' @export
 
 manhattan <- function(x, chr="CHR", bp="BP", p="P", snp="SNP", 
                       col=c("gray10", "gray60"), chrlabs=NULL,
                       suggestiveline=-log10(1e-5), genomewideline=-log10(5e-8), 
-                      highlight=NULL, logp=TRUE, ...) {
-    
+                      highlight=NULL, logp=TRUE, annotatePval = NULL, annotateTop = TRUE, ...) {
+
     # Not sure why, but package check will warn without this.
     CHR=BP=P=index=NULL
     
@@ -96,10 +103,12 @@ manhattan <- function(x, chr="CHR", bp="BP", p="P", snp="SNP",
     # 3   1  5
     nchr = length(unique(d$CHR))
     if (nchr==1) { ## For a single chromosome
-        options(scipen=999)
-	d$pos=d$BP/1e6
+        ## Uncomment the next two linex to plot single chr results in Mb
+        #options(scipen=999)
+	    #d$pos=d$BP/1e6
+        d$pos=d$BP
         ticks=floor(length(d$pos))/2+1
-        xlabel = paste('Chromosome',unique(d$CHR),'position(Mb)')
+        xlabel = paste('Chromosome',unique(d$CHR),'position')
         labs = ticks
     } else { ## For multiple chromosomes
         lastbase=0
@@ -114,7 +123,7 @@ manhattan <- function(x, chr="CHR", bp="BP", p="P", snp="SNP",
             # Old way: assumes SNPs evenly distributed
             # ticks=c(ticks, d[d$index==i, ]$pos[floor(length(d[d$index==i, ]$pos)/2)+1])
             # New way: doesn't make that assumption
-            ticks = c(ticks, (min(d[d$CHR == i,]$pos) + max(d[d$CHR == i,]$pos))/2 + 1)
+            ticks = c(ticks, (min(d[d$index == i,]$pos) + max(d[d$index == i,]$pos))/2 + 1)
         }
         xlabel = 'Chromosome'
         #labs = append(unique(d$CHR),'') ## I forgot what this was here for... if seems to work, remove.
@@ -188,5 +197,30 @@ manhattan <- function(x, chr="CHR", bp="BP", p="P", snp="SNP",
         d.highlight=d[which(d$SNP %in% highlight), ]
         with(d.highlight, points(pos, logp, col="green3", pch=20, ...)) 
     }
-
+    
+    # Highlight top SNPs
+    if (!is.null(annotatePval)) {
+        # extract top SNPs at given p-val
+        topHits = subset(d, P <= annotatePval)
+        par(xpd = TRUE)
+        # annotate these SNPs
+        if (annotateTop == FALSE) {
+            with(subset(d, P <= annotatePval), 
+                 textxy(pos, -log10(P), offset = 0.625, labs = topHits$SNP, cex = 0.45), ...)
+        }
+        else {
+            # could try alternative, annotate top SNP of each sig chr
+            topHits <- topHits[order(topHits$P),]
+            topSNPs <- NULL
+            
+            for (i in unique(topHits$CHR)) {
+                
+                chrSNPs <- topHits[topHits$CHR == i,]
+                topSNPs <- rbind(topSNPs, chrSNPs[1,])
+                
+            }
+            textxy(topSNPs$pos, -log10(topSNPs$P), offset = 0.625, labs = topSNPs$SNP, cex = 0.5, ...)
+        }
+    }  
+    par(xpd = FALSE)
 }
diff --git a/R/qq.R b/R/qq.R
index 2b2d31f..6f30bf0 100644
--- a/R/qq.R
+++ b/R/qq.R
@@ -9,6 +9,10 @@
 #' 
 #' @keywords visualization qq qqplot
 #' 
+#' @importFrom stats ppoints
+#' @import utils
+#' @import graphics
+#' 
 #' @examples
 #' qq(gwasResults$P)
 #' 
diff --git a/R/snpsOfInterest-data.R b/R/snpsOfInterest-data.R
index 20647a3..c820e59 100644
--- a/R/snpsOfInterest-data.R
+++ b/R/snpsOfInterest-data.R
@@ -1,4 +1,5 @@
 #' @name snpsOfInterest
 #' @title snpsOfInterest
+#' @description Example SNPs of interest from simulated \code{gwasResults} data.
 #' @docType data
 NULL
\ No newline at end of file
diff --git a/README.md b/README.md
index b32c2bf..28fb1d2 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,8 @@
 # qqman: An R package for creating Q-Q and manhattan plots from GWAS results.
 
-![qqman.gif](assets/qqman.gif)
+[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/qqman)](http://cran.r-project.org/package=qqman)
+
+![qqman.gif](tools/qqman.gif)
 
 ## Citation
 
diff --git a/build/vignette.rds b/build/vignette.rds
index 58afde2..c49fdc5 100644
Binary files a/build/vignette.rds and b/build/vignette.rds differ
diff --git a/inst/doc/qqman.R b/inst/doc/qqman.R
index 162b9b7..d0fd484 100644
--- a/inst/doc/qqman.R
+++ b/inst/doc/qqman.R
@@ -60,6 +60,12 @@ manhattan(gwasResults, highlight=snpsOfInterest)
 manhattan(subset(gwasResults, CHR==3), highlight=snpsOfInterest, xlim=c(200, 500), main="Chr 3")
 
 ## ------------------------------------------------------------------------
+manhattan(gwasResults, annotatePval=0.01)
+
+## ------------------------------------------------------------------------
+manhattan(gwasResults, annotatePval=0.005, annotateTop=FALSE)
+
+## ------------------------------------------------------------------------
 # Add test statistics
 gwasResults <- transform(gwasResults, zscore=qnorm(P/2, lower.tail=FALSE))
 head(gwasResults)
diff --git a/inst/doc/qqman.Rmd b/inst/doc/qqman.Rmd
index c5fe6f8..f0dbc90 100644
--- a/inst/doc/qqman.Rmd
+++ b/inst/doc/qqman.Rmd
@@ -100,6 +100,18 @@ We can combine highlighting and limiting to a single chromosome, and use the `xl
 manhattan(subset(gwasResults, CHR==3), highlight=snpsOfInterest, xlim=c(200, 500), main="Chr 3")
 ```
 
+We can also annotate SNPs based on their p-value. By default, this only annotates the top SNP per chromosome that exceeds the `annotatePval` threshold.
+
+```{r}
+manhattan(gwasResults, annotatePval=0.01)
+```
+
+We can also annotate all SNPs that meet a threshold:
+
+```{r}
+manhattan(gwasResults, annotatePval=0.005, annotateTop=FALSE)
+```
+
 Finally, the `manhattan` function can be used to plot any value, not just p-values. Here, we'll simply call the function passing to the `p=` argument the name of the column we want to plot instead of the default "P" column. In this example, let's create a test statistic ("zscore"), plot that instead of p-values, change the y-axis label, and remove the default log transformation. We'll also remove the genomewide and suggestive lines because these are only meaningful if you're plotting -lo [...]
 
 ```{r}
diff --git a/inst/doc/qqman.html b/inst/doc/qqman.html
index 43dbc04..3019b8f 100644
--- a/inst/doc/qqman.html
+++ b/inst/doc/qqman.html
@@ -5,6 +5,18 @@
 
 <title>Intro to the <strong>qqman</strong> package</title>
 
+<script type="text/javascript">
+window.onload = function() {
+  var imgs = document.getElementsByTagName('img'), i, img;
+  for (i = 0; i < imgs.length; i++) {
+    img = imgs[i];
+    // center an image if it is the only element of its parent
+    if (img.parentElement.childElementCount === 1)
+      img.parentElement.style.textAlign = 'center';
+  }
+};
+</script>
+
 <!-- Styles for R syntax highlighter -->
 <style type="text/css">
    pre .operator,
@@ -45,9 +57,6 @@ var hljs=new function(){function m(p){return p.replace(/&/gm,"&").replace(/<
 hljs.initHighlightingOnLoad();
 </script>
 
-<!-- MathJax scripts -->
-<script type="text/javascript" src="https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
-</script>
 
 
 <style type="text/css">
@@ -99,7 +108,9 @@ a:visited {
 pre, img {
   max-width: 100%;
 }
-
+pre {
+  overflow-x: auto;
+}
 pre code {
    display: block; padding: 0.5em;
 }
@@ -213,25 +224,25 @@ hr {
 <pre><code class="r">head(gwasResults)
 </code></pre>
 
-<pre><code>  SNP CHR BP      P  zscore
-1 rs1   1  1 0.9148 0.10698
-2 rs2   1  2 0.9371 0.07895
-3 rs3   1  3 0.2861 1.06663
-4 rs4   1  4 0.8304 0.21413
-5 rs5   1  5 0.6417 0.46526
-6 rs6   1  6 0.5191 0.64474
+<pre><code>  SNP CHR BP         P    zscore
+1 rs1   1  1 0.9148060 0.1069785
+2 rs2   1  2 0.9370754 0.0789462
+3 rs3   1  3 0.2861395 1.0666287
+4 rs4   1  4 0.8304476 0.2141275
+5 rs5   1  5 0.6417455 0.4652597
+6 rs6   1  6 0.5190959 0.6447396
 </code></pre>
 
 <pre><code class="r">tail(gwasResults)
 </code></pre>
 
-<pre><code>          SNP CHR  BP      P zscore
-16465 rs16465  22 530 0.5644 0.5764
-16466 rs16466  22 531 0.1383 1.4822
-16467 rs16467  22 532 0.3937 0.8529
-16468 rs16468  22 533 0.1779 1.3473
-16469 rs16469  22 534 0.2393 1.1767
-16470 rs16470  22 535 0.2630 1.1192
+<pre><code>          SNP CHR  BP         P    zscore
+16465 rs16465  22 530 0.5643702 0.5763624
+16466 rs16466  22 531 0.1382863 1.4822028
+16467 rs16467  22 532 0.3936999 0.8529268
+16468 rs16468  22 533 0.1778749 1.3473271
+16469 rs16469  22 534 0.2393020 1.1767332
+16470 rs16470  22 535 0.2630441 1.1192251
 </code></pre>
 
 <p>How many SNPs on each chromosome?</p>
@@ -287,7 +298,7 @@ hr {
 <pre><code class="r">manhattan(subset(gwasResults, CHR == 1))
 </code></pre>
 
-<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA4QAAAKjCAYAAABFkMEBAAAEJGlDQ1BJQ0MgUHJvZmlsZQAAOBGFVd9v21QUPolvUqQWPyBYR4eKxa9VU1u5GxqtxgZJk6XtShal6dgqJOQ6N4mpGwfb6baqT3uBNwb8AUDZAw9IPCENBmJ72fbAtElThyqqSUh76MQPISbtBVXhu3ZiJ1PEXPX6yznfOec7517bRD1fabWaGVWIlquunc8klZOnFpSeTYrSs9RLA9Sr6U4tkcvNEi7BFffO6+EdigjL7ZHu/k72I796i9zRiSJPwG4VHX0Z+AxRzNRrtksUvwf7+Gm3BtzzHPDTNgQCqwKXfZwSeNHHJz1OIT8JjtAq6xWtCLwGPLzYZi+3YV8DGMiT4VVuG7oiZpGzrZJhcs/hL49xtzH/Dy6bdfTsXYNY+5yluWO4D4neK/ZUvok/17X0H [...]
+<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA4QAAAKjCAYAAABFkMEBAAAEJGlDQ1BJQ0MgUHJvZmlsZQAAOBGFVd9v21QUPolvUqQWPyBYR4eKxa9VU1u5GxqtxgZJk6XtShal6dgqJOQ6N4mpGwfb6baqT3uBNwb8AUDZAw9IPCENBmJ72fbAtElThyqqSUh76MQPISbtBVXhu3ZiJ1PEXPX6yznfOec7517bRD1fabWaGVWIlquunc8klZOnFpSeTYrSs9RLA9Sr6U4tkcvNEi7BFffO6+EdigjL7ZHu/k72I796i9zRiSJPwG4VHX0Z+AxRzNRrtksUvwf7+Gm3BtzzHPDTNgQCqwKXfZwSeNHHJz1OIT8JjtAq6xWtCLwGPLzYZi+3YV8DGMiT4VVuG7oiZpGzrZJhcs/hL49xtzH/Dy6bdfTsXYNY+5yluWO4D4neK/ZUvok/17X0H [...]
 
 <p>Let's highlight some SNPs of interest on chromosome 3. The 100 SNPs we're highlighting here are in a character vector called <code>snpsOfInterest</code>. You'll get a warning if you try to highlight SNPs that don't exist.</p>
 
@@ -308,7 +319,21 @@ hr {
     500), main = "Chr 3")
 </code></pre>
 
-<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA4QAAAKjCAYAAABFkMEBAAAEJGlDQ1BJQ0MgUHJvZmlsZQAAOBGFVd9v21QUPolvUqQWPyBYR4eKxa9VU1u5GxqtxgZJk6XtShal6dgqJOQ6N4mpGwfb6baqT3uBNwb8AUDZAw9IPCENBmJ72fbAtElThyqqSUh76MQPISbtBVXhu3ZiJ1PEXPX6yznfOec7517bRD1fabWaGVWIlquunc8klZOnFpSeTYrSs9RLA9Sr6U4tkcvNEi7BFffO6+EdigjL7ZHu/k72I796i9zRiSJPwG4VHX0Z+AxRzNRrtksUvwf7+Gm3BtzzHPDTNgQCqwKXfZwSeNHHJz1OIT8JjtAq6xWtCLwGPLzYZi+3YV8DGMiT4VVuG7oiZpGzrZJhcs/hL49xtzH/Dy6bdfTsXYNY+5yluWO4D4neK/ZUvok/17X0H [...]
+<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA4QAAAKjCAYAAABFkMEBAAAEJGlDQ1BJQ0MgUHJvZmlsZQAAOBGFVd9v21QUPolvUqQWPyBYR4eKxa9VU1u5GxqtxgZJk6XtShal6dgqJOQ6N4mpGwfb6baqT3uBNwb8AUDZAw9IPCENBmJ72fbAtElThyqqSUh76MQPISbtBVXhu3ZiJ1PEXPX6yznfOec7517bRD1fabWaGVWIlquunc8klZOnFpSeTYrSs9RLA9Sr6U4tkcvNEi7BFffO6+EdigjL7ZHu/k72I796i9zRiSJPwG4VHX0Z+AxRzNRrtksUvwf7+Gm3BtzzHPDTNgQCqwKXfZwSeNHHJz1OIT8JjtAq6xWtCLwGPLzYZi+3YV8DGMiT4VVuG7oiZpGzrZJhcs/hL49xtzH/Dy6bdfTsXYNY+5yluWO4D4neK/ZUvok/17X0H [...]
+
+<p>We can also annotate SNPs based on their p-value. By default, this only annotates the top SNP per chromosome that exceeds the <code>annotatePval</code> threshold.</p>
+
+<pre><code class="r">manhattan(gwasResults, annotatePval = 0.01)
+</code></pre>
+
+<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA4QAAAKjCAYAAABFkMEBAAAEJGlDQ1BJQ0MgUHJvZmlsZQAAOBGFVd9v21QUPolvUqQWPyBYR4eKxa9VU1u5GxqtxgZJk6XtShal6dgqJOQ6N4mpGwfb6baqT3uBNwb8AUDZAw9IPCENBmJ72fbAtElThyqqSUh76MQPISbtBVXhu3ZiJ1PEXPX6yznfOec7517bRD1fabWaGVWIlquunc8klZOnFpSeTYrSs9RLA9Sr6U4tkcvNEi7BFffO6+EdigjL7ZHu/k72I796i9zRiSJPwG4VHX0Z+AxRzNRrtksUvwf7+Gm3BtzzHPDTNgQCqwKXfZwSeNHHJz1OIT8JjtAq6xWtCLwGPLzYZi+3YV8DGMiT4VVuG7oiZpGzrZJhcs/hL49xtzH/Dy6bdfTsXYNY+5yluWO4D4neK/ZUvok/17X0H [...]
+
+<p>We can also annotate all SNPs that meet a threshold:</p>
+
+<pre><code class="r">manhattan(gwasResults, annotatePval = 0.005, annotateTop = FALSE)
+</code></pre>
+
+<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA4QAAAKjCAYAAABFkMEBAAAEJGlDQ1BJQ0MgUHJvZmlsZQAAOBGFVd9v21QUPolvUqQWPyBYR4eKxa9VU1u5GxqtxgZJk6XtShal6dgqJOQ6N4mpGwfb6baqT3uBNwb8AUDZAw9IPCENBmJ72fbAtElThyqqSUh76MQPISbtBVXhu3ZiJ1PEXPX6yznfOec7517bRD1fabWaGVWIlquunc8klZOnFpSeTYrSs9RLA9Sr6U4tkcvNEi7BFffO6+EdigjL7ZHu/k72I796i9zRiSJPwG4VHX0Z+AxRzNRrtksUvwf7+Gm3BtzzHPDTNgQCqwKXfZwSeNHHJz1OIT8JjtAq6xWtCLwGPLzYZi+3YV8DGMiT4VVuG7oiZpGzrZJhcs/hL49xtzH/Dy6bdfTsXYNY+5yluWO4D4neK/ZUvok/17X0H [...]
 
 <p>Finally, the <code>manhattan</code> function can be used to plot any value, not just p-values. Here, we'll simply call the function passing to the <code>p=</code> argument the name of the column we want to plot instead of the default “P” column. In this example, let's create a test statistic (“zscore”), plot that instead of p-values, change the y-axis label, and remove the default log transformation. We'll also remove the genomewide and suggestive l [...]
 
@@ -317,13 +342,13 @@ gwasResults <- transform(gwasResults, zscore = qnorm(P/2, lower.tail = FALSE)
 head(gwasResults)
 </code></pre>
 
-<pre><code>  SNP CHR BP      P  zscore
-1 rs1   1  1 0.9148 0.10698
-2 rs2   1  2 0.9371 0.07895
-3 rs3   1  3 0.2861 1.06663
-4 rs4   1  4 0.8304 0.21413
-5 rs5   1  5 0.6417 0.46526
-6 rs6   1  6 0.5191 0.64474
+<pre><code>  SNP CHR BP         P    zscore
+1 rs1   1  1 0.9148060 0.1069785
+2 rs2   1  2 0.9370754 0.0789462
+3 rs3   1  3 0.2861395 1.0666287
+4 rs4   1  4 0.8304476 0.2141275
+5 rs5   1  5 0.6417455 0.4652597
+6 rs6   1  6 0.5190959 0.6447396
 </code></pre>
 
 <pre><code class="r"># Make the new plot
@@ -331,7 +356,7 @@ manhattan(gwasResults, p = "zscore", logp = FALSE, ylab = "Z-scor
     suggestiveline = FALSE, main = "Manhattan plot of Z-scores")
 </code></pre>
 
-<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA4QAAAKjCAYAAABFkMEBAAAEJGlDQ1BJQ0MgUHJvZmlsZQAAOBGFVd9v21QUPolvUqQWPyBYR4eKxa9VU1u5GxqtxgZJk6XtShal6dgqJOQ6N4mpGwfb6baqT3uBNwb8AUDZAw9IPCENBmJ72fbAtElThyqqSUh76MQPISbtBVXhu3ZiJ1PEXPX6yznfOec7517bRD1fabWaGVWIlquunc8klZOnFpSeTYrSs9RLA9Sr6U4tkcvNEi7BFffO6+EdigjL7ZHu/k72I796i9zRiSJPwG4VHX0Z+AxRzNRrtksUvwf7+Gm3BtzzHPDTNgQCqwKXfZwSeNHHJz1OIT8JjtAq6xWtCLwGPLzYZi+3YV8DGMiT4VVuG7oiZpGzrZJhcs/hL49xtzH/Dy6bdfTsXYNY+5yluWO4D4neK/ZUvok/17X0H [...]
+<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA4QAAAKjCAYAAABFkMEBAAAEJGlDQ1BJQ0MgUHJvZmlsZQAAOBGFVd9v21QUPolvUqQWPyBYR4eKxa9VU1u5GxqtxgZJk6XtShal6dgqJOQ6N4mpGwfb6baqT3uBNwb8AUDZAw9IPCENBmJ72fbAtElThyqqSUh76MQPISbtBVXhu3ZiJ1PEXPX6yznfOec7517bRD1fabWaGVWIlquunc8klZOnFpSeTYrSs9RLA9Sr6U4tkcvNEi7BFffO6+EdigjL7ZHu/k72I796i9zRiSJPwG4VHX0Z+AxRzNRrtksUvwf7+Gm3BtzzHPDTNgQCqwKXfZwSeNHHJz1OIT8JjtAq6xWtCLwGPLzYZi+3YV8DGMiT4VVuG7oiZpGzrZJhcs/hL49xtzH/Dy6bdfTsXYNY+5yluWO4D4neK/ZUvok/17X0H [...]
 
 <p>A few notes on creating manhattan plots:</p>
 
@@ -348,7 +373,7 @@ manhattan(gwasResults, p = "zscore", logp = FALSE, ylab = "Z-scor
 <pre><code class="r">qq(gwasResults$P)
 </code></pre>
 
-<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA4QAAAKjCAYAAABFkMEBAAAEJGlDQ1BJQ0MgUHJvZmlsZQAAOBGFVd9v21QUPolvUqQWPyBYR4eKxa9VU1u5GxqtxgZJk6XtShal6dgqJOQ6N4mpGwfb6baqT3uBNwb8AUDZAw9IPCENBmJ72fbAtElThyqqSUh76MQPISbtBVXhu3ZiJ1PEXPX6yznfOec7517bRD1fabWaGVWIlquunc8klZOnFpSeTYrSs9RLA9Sr6U4tkcvNEi7BFffO6+EdigjL7ZHu/k72I796i9zRiSJPwG4VHX0Z+AxRzNRrtksUvwf7+Gm3BtzzHPDTNgQCqwKXfZwSeNHHJz1OIT8JjtAq6xWtCLwGPLzYZi+3YV8DGMiT4VVuG7oiZpGzrZJhcs/hL49xtzH/Dy6bdfTsXYNY+5yluWO4D4neK/ZUvok/17X0H [...]
+<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA4QAAAKjCAYAAABFkMEBAAAEJGlDQ1BJQ0MgUHJvZmlsZQAAOBGFVd9v21QUPolvUqQWPyBYR4eKxa9VU1u5GxqtxgZJk6XtShal6dgqJOQ6N4mpGwfb6baqT3uBNwb8AUDZAw9IPCENBmJ72fbAtElThyqqSUh76MQPISbtBVXhu3ZiJ1PEXPX6yznfOec7517bRD1fabWaGVWIlquunc8klZOnFpSeTYrSs9RLA9Sr6U4tkcvNEi7BFffO6+EdigjL7ZHu/k72I796i9zRiSJPwG4VHX0Z+AxRzNRrtksUvwf7+Gm3BtzzHPDTNgQCqwKXfZwSeNHHJz1OIT8JjtAq6xWtCLwGPLzYZi+3YV8DGMiT4VVuG7oiZpGzrZJhcs/hL49xtzH/Dy6bdfTsXYNY+5yluWO4D4neK/ZUvok/17X0H [...]
 
 <p>We can otionally supply many other graphical parameters.</p>
 
@@ -356,7 +381,7 @@ manhattan(gwasResults, p = "zscore", logp = FALSE, ylab = "Z-scor
     12), pch = 18, col = "blue4", cex = 1.5, las = 1)
 </code></pre>
 
-<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA4QAAAKjCAYAAABFkMEBAAAEJGlDQ1BJQ0MgUHJvZmlsZQAAOBGFVd9v21QUPolvUqQWPyBYR4eKxa9VU1u5GxqtxgZJk6XtShal6dgqJOQ6N4mpGwfb6baqT3uBNwb8AUDZAw9IPCENBmJ72fbAtElThyqqSUh76MQPISbtBVXhu3ZiJ1PEXPX6yznfOec7517bRD1fabWaGVWIlquunc8klZOnFpSeTYrSs9RLA9Sr6U4tkcvNEi7BFffO6+EdigjL7ZHu/k72I796i9zRiSJPwG4VHX0Z+AxRzNRrtksUvwf7+Gm3BtzzHPDTNgQCqwKXfZwSeNHHJz1OIT8JjtAq6xWtCLwGPLzYZi+3YV8DGMiT4VVuG7oiZpGzrZJhcs/hL49xtzH/Dy6bdfTsXYNY+5yluWO4D4neK/ZUvok/17X0H [...]
+<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA4QAAAKjCAYAAABFkMEBAAAEJGlDQ1BJQ0MgUHJvZmlsZQAAOBGFVd9v21QUPolvUqQWPyBYR4eKxa9VU1u5GxqtxgZJk6XtShal6dgqJOQ6N4mpGwfb6baqT3uBNwb8AUDZAw9IPCENBmJ72fbAtElThyqqSUh76MQPISbtBVXhu3ZiJ1PEXPX6yznfOec7517bRD1fabWaGVWIlquunc8klZOnFpSeTYrSs9RLA9Sr6U4tkcvNEi7BFffO6+EdigjL7ZHu/k72I796i9zRiSJPwG4VHX0Z+AxRzNRrtksUvwf7+Gm3BtzzHPDTNgQCqwKXfZwSeNHHJz1OIT8JjtAq6xWtCLwGPLzYZi+3YV8DGMiT4VVuG7oiZpGzrZJhcs/hL49xtzH/Dy6bdfTsXYNY+5yluWO4D4neK/ZUvok/17X0H [...]
 
 </body>
 
diff --git a/man/gwasResults.Rd b/man/gwasResults.Rd
index ee31dd0..75990b0 100644
--- a/man/gwasResults.Rd
+++ b/man/gwasResults.Rd
@@ -1,4 +1,5 @@
-% Generated by roxygen2 (4.0.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/gwasResults-data.R
 \docType{data}
 \name{gwasResults}
 \alias{gwasResults}
@@ -6,4 +7,3 @@
 \description{
 Simulated GWAS results as obtained from \code{plink --assoc}.
 }
-
diff --git a/man/manhattan.Rd b/man/manhattan.Rd
index df48072..d25399c 100644
--- a/man/manhattan.Rd
+++ b/man/manhattan.Rd
@@ -1,4 +1,5 @@
-% Generated by roxygen2 (4.0.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/manhattan.R
 \name{manhattan}
 \alias{manhattan}
 \title{Creates a manhattan plot}
@@ -6,22 +7,23 @@
 manhattan(x, chr = "CHR", bp = "BP", p = "P", snp = "SNP",
   col = c("gray10", "gray60"), chrlabs = NULL,
   suggestiveline = -log10(1e-05), genomewideline = -log10(5e-08),
-  highlight = NULL, logp = TRUE, ...)
+  highlight = NULL, logp = TRUE, annotatePval = NULL,
+  annotateTop = TRUE, ...)
 }
 \arguments{
 \item{x}{A data.frame with columns "BP," "CHR," "P," and optionally, "SNP."}
 
-\item{chr}{A string denoting the column name for the chromosome. Defaults to
-PLINK's "CHR." Said column must be numeric. If you have X, Y, or MT
+\item{chr}{A string denoting the column name for the chromosome. Defaults to 
+PLINK's "CHR." Said column must be numeric. If you have X, Y, or MT 
 chromosomes, be sure to renumber these 23, 24, 25, etc.}
 
-\item{bp}{A string denoting the column name for the chromosomal position.
+\item{bp}{A string denoting the column name for the chromosomal position. 
 Defaults to PLINK's "BP." Said column must be numeric.}
 
-\item{p}{A string denoting the column name for the p-value. Defaults to
+\item{p}{A string denoting the column name for the p-value. Defaults to 
 PLINK's "P." Said column must be numeric.}
 
-\item{snp}{A string denoting the column name for the SNP name (rs number).
+\item{snp}{A string denoting the column name for the SNP name (rs number). 
 Defaults to PLINK's "SNP." Said column should be a character.}
 
 \item{col}{A character vector indicating which colors to alternate.}
@@ -29,32 +31,36 @@ Defaults to PLINK's "SNP." Said column should be a character.}
 \item{chrlabs}{A character vector equal to the number of chromosomes
 specifying the chromosome labels (e.g., \code{c(1:22, "X", "Y", "MT")}).}
 
-\item{suggestiveline}{Where to draw a "suggestive" line. Default
+\item{suggestiveline}{Where to draw a "suggestive" line. Default 
 -log10(1e-5). Set to FALSE to disable.}
 
-\item{genomewideline}{Where to draw a "genome-wide sigificant" line. Default
+\item{genomewideline}{Where to draw a "genome-wide sigificant" line. Default 
 -log10(5e-8). Set to FALSE to disable.}
 
-\item{highlight}{A character vector of SNPs in your dataset to highlight.
+\item{highlight}{A character vector of SNPs in your dataset to highlight. 
 These SNPs should all be in your dataset.}
 
-\item{logp}{If TRUE, the -log10 of the p-value is plotted. It isn't very
+\item{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
+other genome-wide plots, for example, peak heights, bayes factors, test 
 statistics, other "scores," etc.}
 
+\item{annotatePval}{If set, SNPs below this p-value will be annotated on the plot.}
+
+\item{annotateTop}{If TRUE, only annotates the top hit on each chromosome that is below the annotatePval threshold.}
+
 \item{...}{Arguments passed on to other plot/points functions}
 }
 \value{
 A manhattan plot.
 }
 \description{
-Creates a manhattan plot from PLINK assoc output (or any data frame with
+Creates a manhattan plot from PLINK assoc output (or any data frame with 
 chromosome, position, and p-value).
 }
 \examples{
 manhattan(gwasResults)
+  
 }
 \keyword{manhattan}
 \keyword{visualization}
-
diff --git a/man/qq.Rd b/man/qq.Rd
index f97730e..1e95ac7 100644
--- a/man/qq.Rd
+++ b/man/qq.Rd
@@ -1,4 +1,5 @@
-% Generated by roxygen2 (4.0.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/qq.R
 \name{qq}
 \alias{qq}
 \title{Creates a Q-Q plot}
@@ -18,8 +19,8 @@ Creates a quantile-quantile plot from p-values from a GWAS study.
 }
 \examples{
 qq(gwasResults$P)
+
 }
 \keyword{qq}
 \keyword{qqplot}
 \keyword{visualization}
-
diff --git a/man/qqman.Rd b/man/qqman.Rd
index 30ce912..7de770c 100644
--- a/man/qqman.Rd
+++ b/man/qqman.Rd
@@ -1,4 +1,5 @@
-% Generated by roxygen2 (4.0.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/package.R
 \docType{package}
 \name{qqman}
 \alias{qqman}
@@ -12,4 +13,3 @@ vignette for details: \cr\cr
 \author{
 Stephen Turner <\url{http://stephenturner.us}>
 }
-
diff --git a/man/snpsOfInterest.Rd b/man/snpsOfInterest.Rd
index 411b532..a013855 100644
--- a/man/snpsOfInterest.Rd
+++ b/man/snpsOfInterest.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.0.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/snpsOfInterest-data.R
 \docType{data}
 \name{snpsOfInterest}
 \alias{snpsOfInterest}
 \title{snpsOfInterest}
 \description{
-snpsOfInterest
+Example SNPs of interest from simulated \code{gwasResults} data.
 }
-
diff --git a/tools/qqman.gif b/tools/qqman.gif
new file mode 100644
index 0000000..662e773
Binary files /dev/null and b/tools/qqman.gif differ
diff --git a/vignettes/qqman.Rmd b/vignettes/qqman.Rmd
index c5fe6f8..f0dbc90 100644
--- a/vignettes/qqman.Rmd
+++ b/vignettes/qqman.Rmd
@@ -100,6 +100,18 @@ We can combine highlighting and limiting to a single chromosome, and use the `xl
 manhattan(subset(gwasResults, CHR==3), highlight=snpsOfInterest, xlim=c(200, 500), main="Chr 3")
 ```
 
+We can also annotate SNPs based on their p-value. By default, this only annotates the top SNP per chromosome that exceeds the `annotatePval` threshold.
+
+```{r}
+manhattan(gwasResults, annotatePval=0.01)
+```
+
+We can also annotate all SNPs that meet a threshold:
+
+```{r}
+manhattan(gwasResults, annotatePval=0.005, annotateTop=FALSE)
+```
+
 Finally, the `manhattan` function can be used to plot any value, not just p-values. Here, we'll simply call the function passing to the `p=` argument the name of the column we want to plot instead of the default "P" column. In this example, let's create a test statistic ("zscore"), plot that instead of p-values, change the y-axis label, and remove the default log transformation. We'll also remove the genomewide and suggestive lines because these are only meaningful if you're plotting -lo [...]
 
 ```{r}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/r-cran-qqman.git



More information about the debian-med-commit mailing list