bioXiaoheng / BalLeRMix

Software package for BalLeRMix and scripts used in the study "Flexible mixture model approaches that accommodate footprint size variability for robust detection of balancing selection" (Cheng & DeGiorgio 2020)
5 stars 1 forks source link

Integer/Float error? #4

Closed YannBourgeois closed 3 years ago

YannBourgeois commented 3 years ago

Dear Xiaoheng, I was experimenting with BALLERMIX (v2.3), and had an issue when running the statistics based on the MAF (for example B0,MAF). I got Type errors such as "TypeError: 'float' object cannot be interpreted as an integer". I think the error came from lines such as L73, 361, 364, where the result of a division (which is a float instead of an integer) was fed to the range() function. When replacing, for example L73: for i in range(N/2): by for i in range(N//2): The error disappeared. I guess range(int(N/2)) would work too. My apologies if I missed something. Thanks for this resource, it is a really nice contribution! All the best, Yann Bourgeois

bioXiaoheng commented 3 years ago

Hi Yann,

Thank you so much for reporting this bug! This script was initially written in python2 where integer divisions would still return integers, and obviously when I upgraded it to python3 this was not accounted for. I can believe this went undetected for so long! I just fixed them in the v2.3 script. Thanks again for catching it!

Cheers, Xiaoheng

YannBourgeois commented 3 years ago

Hi Xiaoheng, No problem! I guess many people are lucky enough that they can confidently polarize alleles as ancestral/derived, so they do not have to fold their spectra :). Cheers, Yann