stephenturner / qqman

An R package for creating Q-Q and manhattan plots from GWAS results
http://cran.r-project.org/web/packages/qqman/
GNU General Public License v3.0
154 stars 92 forks source link

chrlabs for non-human data and logp not working #22

Closed renaschweizer closed 9 years ago

renaschweizer commented 9 years ago

The chrlabs option for more chromosomes than 23 does not seem to be supported, e.g. chrlabs=c(1:38) still plots only 1:23.

Also, logp=FALSE or logp=TRUE both still produce plots of log10P value, rather than likelihood.

stephenturner commented 9 years ago

Please upload some example data on https://gist.github.com/. Thanks.

renaschweizer commented 9 years ago

Here you go: https://gist.github.com/renaschweizer/25c23efa7d1e438b9d62

My command was manhattan(tryThis,col=c("pink","purple"),chrlabs=c(1:38),suggestiveline=neutral99,genomewideline=neutral95,logp=FALSE)

stephenturner commented 9 years ago

1: You've got problems with your P-values. Some are zero, others greater than 1. I was able to make a manhattan plot just fine. If you save the plot in a wider aspect ratio than I did you should be able to see all the labels.

rplot

2: logp=FALSE works just fine. Make sure you're using the dev version.

rplot01

3: chrlabs must be a character vector and equal in length to the number of chromosomes. You get a convenient warning message when this isn't the case. Your terminal should have told you: You're trying to specify chromosome labels but the number of labels != number of chromosomes. Looks to me like you have no data for chromosome 29.

Here's the code I used:

library(qqman)
d <- read.table("~/Desktop/plink.txt", T)

# fix your data
d <- subset(d, P>0 & P<=1)

# regular plot
manhattan(d)

# logp=FALSE works fine
manhattan(d, logp=FALSE)

# chrlabs must be character vector
manhattan(d, chrlabs=as.character(c(1:38)))

# Warning produced:
# You're trying to specify chromosome labels but the number of labels != number of chromosomes.

#whoops, you've got a problem. Look, no chromosome 29 data.
unique(d$CHR)
renaschweizer commented 9 years ago

Thank you for taking the time to work through my problem. I may have only mentioned this on your website, but the data I'm trying to plot consists of likelihood values that can be larger than 1. My understanding with the logp=FALSE options was that one could override the requirements of p being between 0 and 1. Is that not the case?

stephenturner commented 9 years ago

Oh, right, yes, that should work. But I did remove p-values of exactly zero.

library(qqman) 

d <- read.table("untitled.txt", T)
d <- subset(d, P>0)
manhattan(d, logp=FALSE)

rplot