ekirving / qpbrute

Heuristic search algorithm for fitting qpGraph models
MIT License
9 stars 3 forks source link

qpBayes - ERROR: MCMC burn in must be less than the number of iterations #14

Closed dbssyck closed 3 years ago

dbssyck commented 3 years ago

Hi Evan,

I am encountering a bug (?) when running qpbayes with a predefined number of iterations and burnin. I am attempting to run with 10 million iterations and 20% burnin but am getting the following error.

qpBayes \
    --geno filename.geno \
    --ind filename.ind \
    --snp filename.snp \
    --prefix filename \
    --pops A B C D \
    --out Out \
    --iterations 10000000 \
    --burnin 2000000  
 Traceback (most recent call last):
  File "/home/svu/dbssyck/conda_envs/qpbrute/bin/qpBayes", line 8, in <module>
    sys.exit(qpbayes())
  File "/home/svu/dbssyck/conda_envs/qpbrute/lib/python3.8/site-packages/qpbrute/qpbayes.py", line 369, in qpbayes
    calculate_bayes_factors(
  File "/home/svu/dbssyck/conda_envs/qpbrute/lib/python3.8/site-packages/qpbrute/qpbayes.py", line 280, in calculate_bayes_factors
    raise RuntimeError(
RuntimeError: ERROR: MCMC burn in must be less than the number of iterations

Strangely, when using the identical code with 9 million iterations and 20% burnin, it runs with no issues. The code is as follows.

qpBayes \
    --geno filename.geno \
    --ind filename.ind \
    --snp filename.snp \
    --prefix filename \
    --pops A B C D \
    --out Out \
    --iterations 9000000 \
    --burnin 1800000  

I tried a couple of other values above 10 million but they did not work either - is there an upper limit to qpbayes?

ekirving commented 3 years ago

Hi dbssyck,

Thank you for reporting this bug! The problem was that the comparison was being performed on the string values of the parameters, and not on their integer values:

>>> "2000000" >= "10000000"
True
>>> 2000000 >= 10000000
False

This has been corrected in github. To install the latest version, please run:

pip install --upgrade --no-deps --force-reinstall git+git://github.com/ekirving/qpbrute.git
dbssyck commented 3 years ago

Hi Evan,

Awesome, thanks for the very prompt response!