bcm-uga / pcadapt

Performing highly efficient genome scans for local adaptation with R package pcadapt v4
https://bcm-uga.github.io/pcadapt
39 stars 10 forks source link

can't display the histogram as the values are too high. #41

Closed zillurbmb51 closed 4 years ago

zillurbmb51 commented 5 years ago

Hello, I was trying make stats distribution plot for my snp data using pcadapt: pl6=plot(xclinvar, option = "stat.distribution", threshold = 0.1)+ggtitle('P_clinvar hg38 17076 SNPs') And getting this: error in hist_plot(x, 1) : can't display the histogram as the values are too high. Other plots like pca, qq or manhattan works good for this data and stat.distribution also works for other data but error is only for this. Any help? Best, Zillur

privefl commented 5 years ago

Looking at the code, it means that you have X2 statistics larger than 10^5, which is apparently not possible.

> pchisq(1e5, df = 100, lower.tail = FALSE, log.p = TRUE)
[1] -49614.4

Can you provide a reproducible example?

zillurbmb51 commented 5 years ago

Thank you. I am not sure how to reproduce this error because with same data other plots work perfectly. Here is my original data. clinvar.maf5.indep0.1.bed.txt clinvar.maf5.indep0.1.bim.txt clinvar.maf5.indep0.1.fam.txt

privefl commented 5 years ago

I removed the .txt extensions (why do you have them?) This works for me:

library(pcadapt)
bed <- read.pcadapt("tmp-data/clinvar.maf5.indep0.1.bed", type = "bed")
xclinvar <- pcadapt(bed)
plot(xclinvar, option = "stat.distribution", threshold = 0.1) +
  ggplot2::ggtitle('P_clinvar hg38 17076 SNPs')

Note that you might want to change K and use LD clumping.

zillurbmb51 commented 5 years ago

Thank you. The extensions are to upload here. Loading without K works. How can I use LD clumping? Best, ZIllur

privefl commented 5 years ago

There is a parameter for it. Also see the vignette.

mblumuga commented 5 years ago

To use LD clumping, you need to have dense enough data. If you work with radseq data, do not bother with LD clumping. The paragraph "F. Linkage Disequilibrium (LD) thinning" in the vignette explains how to run the procedure.