btmartin721/ClineHelpR

vcf2bgc.py file

Irvilma opened this issue · 6 comments

Hello,

I'm trying to convert my vcf file (from ipyrad) to bcg using vcf2bgc.py file. For this, I'm using your example data files download from DRYAD but I get an error:

./vcf2bgc.py -v eatt.trans.finalfilt.recode.vcf -m eatt.bgc.popmap_final.txt --p1 PureEA --p2 PureTT --admixed EATT -o example_tutorial

P1 population has 8 individuals...

P2 population has 8 individuals...

Admixed populalation has 85 individuals...

Processing 233 records in VCF file...

Traceback (most recent call last):
File "./vcf2bgc.py", line 378, in
main()
File "./vcf2bgc.py", line 140, in main
normalize_linkagemap(pos_list, pos_min, pos_max, chrom_number, linkage_fh, locus_list)
File "./vcf2bgc.py", line 192, in normalize_linkagemap
mylist[i] = (val - nmin) / (nmax - nmin)
ZeroDivisionError: integer division or modulo by zero

Does anybody have an idea what is wrong? Any help would be appreciated.
The same error occurs with my own data.

The package is really helpful, congrats!
Thank you!

Hello,

Thank you for your interest in ClineHelpR. I will look into what may be happening with the vcf2bgc.py script this evening. Sorry for the issue.

Hello,

The issue should be fixed now. Please do a git pull to update the vcf2bgc.py script and try running it again. Let me know if you are still having issues with the script.

The problem was that I had accidentally turned the linkage model on by default, but it should have to be toggled on to use it. Because the example file as well as your own data file had chromosomes with only one site, the script was dividing by zero when it tried to normalize the position maps between 0 and 1.

I turned the option to generate linkage maps off by default now, and I added error handling for if the linkage map file has chromosomes with only one position.

Thanks,

-Bradley

Hi Irene,

It looks like the list.clear() which is throwing the error was added in Python 3.3, so I'm guessing you are using an older version of Python than 3.3. I just added a fix that should work with Python3 versions older than 3.3, could you give that a try?

Thanks,
Tyler

You're very welcome. Glad to see it's working now. Thanks for your interest in ClineHelpR.

-Bradley