whitlock / OutFLANK

A procedure to find Fst outliers based on an inferred distribution of neutral Fst
18 stars 9 forks source link

problem with qvalue handoff #23

Closed jpwares closed 4 years ago

jpwares commented 4 years ago

hello! excited to use outFLANK, i've hit a snag with its use of qvalue however. with many attempts at different input files and using the dartR wrapper, I hit the same problem when executing OutFLANK()

Error in quantile.default(pi0, prob = 0.1) : missing values and NaN's not allowed if 'na.rm' is FALSE

I've dug around enough to believe this is package qvalue throwing the error. Nb I am now using R 4.0.0 and it seems there is a recent update to qvalue. please advise.

jpwares commented 4 years ago

Nb I tried with another laptop (older R 3.6.3, older qvalue 2.18 instead of 2.20) - same error.

jpwares commented 4 years ago

Nb 2 I saw some of these error issues on the qvalue github and tried using your code but instead with (a) remove the bootstrap noted as potentially problematic in your code, or (b) set pi0=1 suggested in qvalue github problems. in both cases, this returns

Error in smooth.spline(lambda, pi0, df = smooth.df) :

missing or infinite values in inputs are not allowed

So, I've hit my wall on knowing what the problem is. FWIW my data are about 1900 SNPs, hopefully not too small for this method.

jpwares commented 4 years ago

thanks to Katie I figured out it was a data input issue; however now I'm dealing with invariant q-values despite a huge range of pvals so I think I saw that as a different issue to chase. Thanks.

DrK-Lo commented 4 years ago

Check your model fit. When the model fits the data very well and there are few outliers, you can get a huge range of P-values and invariant q-values.

If model fits the data perfectly you should have a uniform distribution of Q-values: P<-runif(1000) hist(qvalue(P)$q)

If you have outliers your Q-values will be more variable, here is an example of 10% of data with low P-values:

hist(qvalue(c(P, runif(100,0,0.01)))$q)