Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZeroDivisionError: float division by zero #428

Open
ivaneskos opened this issue May 2, 2024 · 3 comments
Open

ZeroDivisionError: float division by zero #428

ivaneskos opened this issue May 2, 2024 · 3 comments
Labels
question how can I do this? why does it do that? where can I get this? etc.

Comments

@ivaneskos
Copy link

Summary:

ZeroDivisionError: float division by zero

Description:

I am trying to use average_nucleotide_identity.py script for the dataset of 2000 short (~44kb) genomes,
my command was:
average_nucleotide_identity.py -i $all_samples_fasta -o $ani_analysis -m ANIb -f -g -l $log_file -v --workers 160 --seed 22 --gformat png,pdf
I have the following error (end of the log file, all lines before - just the blast commands):

INFO: Command pool done.
WARNING: At least one BLAST run failed. ANIb may fail.
INFO: Processing pairwise ANIb BLAST output.
ERROR: One or more BLAST output files has a problem.
ERROR: This is possibly due to BLASTN run failure, please investigate
ERROR: Traceback (most recent call last):
File "/home/ivan/anaconda3/envs/pyani_env/bin/average_nucleotide_identity.py", line 727, in unified_anib
data = anib.process_blast(
^^^^^^^^^^^^^^^^^^^
File "/home/ivan/anaconda3/envs/pyani_env/lib/python3.12/site-packages/pyani/anib.py", line 444, in process_blast
query_cover = float(resultvals[0]) / org_lengths[qname]
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
ZeroDivisionError: float division by zero

INFO: Compressing/deleting /legserv/Temp/Ivan/Zymo_2000_genomes/ani_files/ANIb_output_500_attempt/blastn_output
INFO: Compressing output from /legserv/Temp/Ivan/Zymo_2000_genomes/ani_files/ANIb_output_500_attempt/blastn_output to /legserv/Temp/Ivan/Zymo_2000_genomes/ani_files/ANIb_output_500_attempt/blastn_output.tar.gz
INFO: Removing output directory /legserv/Temp/Ivan/Zymo_2000_genomes/ani_files/ANIb_output_500_attempt/blastn_output

I didn't have this error on the subset of 100 genomes, I have the same error in the bigger subsets (I've tested 500 and 1000 genomes)

pyani Version:

pyani 0.2.12

Python Version:

Python 3.8.19

Operating System:

Ubuntu 20.04.6 LTS

@kiepczi
Copy link
Collaborator

kiepczi commented May 2, 2024

Hi @ivaneskos,

Thank you for your interest in pyANI.

Unfortunately, from the error message alone, I am unable to provide a definite answer. Could you please provide me with a small dataset that produces this error? This would help me investigate the issue in more detail.

In the meantime, I can think of a few reasons why the analysis might be resulting in this error:

  • One of the pairwise comparisons may be between two highly divergent genomes that do not share any genomic content by alignment length.
  • The genomic data might be corrupted, preventing comparisons from being made.
  • The structure of the input directory may not be accepted by pyANI.

Thanks,

A.

@kiepczi kiepczi added the question how can I do this? why does it do that? where can I get this? etc. label May 2, 2024
@ivaneskos
Copy link
Author

Hi @kiepczi!
Thank you for your immediate answer! Here is the smallest subset where I had an error (500 45kb genomes).
Thank you a lot for helping me!!
500_genomes.tar.gz

@widdowquinn
Copy link
Owner

Hi @ivaneskos - many thanks for the example data, but is it possible maybe to reduce the number of genomes you're sending, and provide a minimal example that replicates the issue?

Many thanks,

L.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question how can I do this? why does it do that? where can I get this? etc.
Projects
None yet
Development

No branches or pull requests

3 participants