Changes

From Genome Analysis Wiki
Jump to navigationJump to search
Line 2: Line 2:     
[[File:Pval-qq-sample.png|center]]
 
[[File:Pval-qq-sample.png|center]]
 +
 +
= Credit =
 +
 +
This page is based on a tutorial originally written by [mailto:mflick@umich.edu Matthew Flickinger]
    
== Credits ==
 
== Credits ==
Line 32: Line 36:  
ylab=expression(paste("Observed (",-log[10], " p-value)")),  
 
ylab=expression(paste("Observed (",-log[10], " p-value)")),  
 
draw.conf=TRUE, conf.points=1000, conf.col="lightgray", conf.alpha=.05,
 
draw.conf=TRUE, conf.points=1000, conf.col="lightgray", conf.alpha=.05,
already.transformed=FALSE, pch=20, aspect="iso",  
+
already.transformed=FALSE, pch=20, aspect="iso", prepanel=prepanel.qqunif,
 
par.settings=list(superpose.symbol=list(pch=pch)), ...) {
 
par.settings=list(superpose.symbol=list(pch=pch)), ...) {
 
 
Line 42: Line 46:  
stop("pvalue vector is not numeric, can't draw plot")
 
stop("pvalue vector is not numeric, can't draw plot")
 
if (any(is.na(unlist(pvalues)))) stop("pvalue vector contains NA values, can't draw plot")
 
if (any(is.na(unlist(pvalues)))) stop("pvalue vector contains NA values, can't draw plot")
if (any(unlist(pvalues)==0)) stop("pvalue vector contains zeros, can't draw plot")
+
if (already.transformed==FALSE) {
 
+
if (any(unlist(pvalues)==0)) stop("pvalue vector contains zeros, can't draw plot")
 +
} else {
 +
if (any(unlist(pvalues)<0)) stop("-log10 pvalue vector contains negative values, can't draw plot")
 +
}
 
 
 
 
Line 113: Line 120:  
gc()
 
gc()
 
 
prepanel.origin = function(x,y,...) {
+
prepanel.qqunif= function(x,y,...) {
 
A = list()
 
A = list()
 
A$xlim = range(x, y)*1.02
 
A$xlim = range(x, y)*1.02
Line 123: Line 130:  
#draw the plot
 
#draw the plot
 
xyplot(pvalues~exp.x, groups=grp, xlab=xlab, ylab=ylab, aspect=aspect,
 
xyplot(pvalues~exp.x, groups=grp, xlab=xlab, ylab=ylab, aspect=aspect,
prepanel=prepanel.origin, scales=list(axs="i"), pch=pch,
+
prepanel=prepanel, scales=list(axs="i"), pch=pch,
 
panel = function(x, y, ...) {
 
panel = function(x, y, ...) {
 
if (draw.conf) {
 
if (draw.conf) {

Navigation menu