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

Error in manhattan(results) : P column should be numeric. #8

Closed cjfiscus closed 10 years ago

cjfiscus commented 10 years ago

Hi there.

Using qqman package from this link: http://www.r-bloggers.com/qqman-an-r-package-for-creating-q-q-and-manhattan-plots-from-gwas-results/

I formatted my data in format that worked with older version of qqman, substituting NA for missing values. Upon trying to make a manhattan plot I receive the following error:

Error in manhattan(results) : P column should be numeric.

Does qqman no longer deal with missing data?

stephenturner commented 10 years ago

Hm, it should still work.

> gwasResults$P[2] <- NA
> head(gwasResults)
  SNP CHR BP         P
1 rs1   1  1 0.9148060
2 rs2   1  2        NA
3 rs3   1  3 0.2861395
4 rs4   1  4 0.8304476
5 rs5   1  5 0.6417455
6 rs6   1  6 0.5190959
> 
> # works for me
> qq(gwasResults$P)

If you run qq without the parentheses it will print out what the function does. You'll notice the function stops if the p-value vector is not numeric. A numeric vector with NA values is still considered numeric.

> x <- c(1,2,3)
> is.numeric(x)
[1] TRUE
> x <- c(1,NA,3)
> is.numeric(x)
[1] TRUE

Not sure what's going on. Can you put some of your data on https://gist.github.com/?

cjfiscus commented 10 years ago

I was able to figure out how to fix the issue.

https://gist.github.com/cjfiscus/d0f2c883bc1caab0583a

Thank you for your help and for creating such an invaluable tool!

stephenturner commented 10 years ago

Glad you were able to fix your problem, and thanks for the kind words!