widdowquinn / scripts

Miscellaneous scripts
MIT License
22 stars 19 forks source link

"KeyError" calculate_ani.py not writing table #4

Closed petenewell closed 9 years ago

petenewell commented 9 years ago

I installed biopython on my mac to run this script, and it seems to be starting up just fine. I don't have rpy2, so that is the source of my first error message. The next issue is unclear to me: the following is displayed, then the program quits before finishing the alb_lengths.tab table. That table contains only column labels and not rows.

Could not import rpy2: graphical output and TETRA method not available Traceback (most recent call last): File "/Users/peternewell/Bioinformatics/Teaching-0.1.0/Comparative_Genomics_and_Visualisation/Part_1/scripts/calculate_ani.py", line 1088, in methods[options.method]() File "/Users/peternewell/Bioinformatics/Teaching-0.1.0/Comparative_Genomics_and_Visualisation/Part_1/scripts/calculate_ani.py", line 293, in calculate_anim "Aligment lengths") File "/Users/peternewell/Bioinformatics/Teaching-0.1.0/Comparative_Genomics_and_Visualisation/Part_1/scripts/calculate_ani.py", line 647, in write_table val = values[(n2, n1)] KeyError: ('amac', 'aaat')

'amac' and 'aaat' are names of my config files.

Any insights would be greatly appreciated.

widdowquinn commented 9 years ago

Hi Pete,

You may like to try using the pyani module instead - it has improvements and bug fixes that make it a better option than the calculate_ani.py script, and the average_nucleotide_identity.py script that comes with it works very similarly to calculate_ani.py.

Regarding your query, the reason there's a KeyError is probably that one or more of the alignments comes up with a 0% alignment, and the script doesn't like that. This bug is (I believe) eliminated in the pyani module.

I should really deprecate this script, now that pyani is nearly finished.

EDIT: here's the link to the pyani repo: https://github.com/widdowquinn/pyani L.

widdowquinn commented 9 years ago

No progress for a month - will reopen if needed.