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

unique-kmers.py can produce division by zero #1856

Open
bwlang opened this issue Apr 27, 2018 · 1 comment
Open

unique-kmers.py can produce division by zero #1856

bwlang opened this issue Apr 27, 2018 · 1 comment

Comments

@bwlang
Copy link

bwlang commented Apr 27, 2018

Traceback (most recent call last):
  File "/home/NEB/langhorst/miniconda2/envs/khmer/bin/unique-kmers.py", line 166, in <module>
    main()
  File "/home/NEB/langhorst/miniconda2/envs/khmer/bin/unique-kmers.py", line 155, in main
    to_print = graphsize_args_report(cardinality, args.error_rate)
  File "/home/NEB/langhorst/miniconda2/envs/khmer/lib/python2.7/site-packages/khmer/khmer_args.py", line 354, in graphsize_args_report
    optimal_size(unique_kmers, fp_rate=fp_rate / 10.0)
  File "/home/NEB/langhorst/miniconda2/envs/khmer/lib/python2.7/site-packages/khmer/khmer_args.py", line 221, in optimal_size
    return estimate_optimal_with_K_and_f(num_kmers, fp_rate)
  File "/home/NEB/langhorst/miniconda2/envs/khmer/lib/python2.7/site-packages/khmer/khmer_args.py", line 328, in estimate_optimal_with_K_and_f
    fp_rate = (1 - math.exp(-num_kmers / float(ht_size))) ** int_n_tables
ZeroDivisionError: float division by zero

easily reproduced with:
unique-kmers.py
on
ftp://ftp.ensemblgenomes.org/pub/bacteria/release-39/fasta/bacteria_0_collection/haemophilus_influenzae_rd_kw20/dna/Haemophilus_influenzae_rd_kw20.ASM2730v1.dna.toplevel.fa.gz

@standage
Copy link
Member

Greetings Brad, and thanks for the report!

I was unable to reproduce the error with the indicated file on the latest (master) version of khmer. Could you please let us know what version of khmer you have installed, and the exact command you invoked in the terminal to run unique-kmers.py. This will help us isolate the issue.

One quick observation: it looks like you're running khmer in a Python 2.7 environment. Previous versions of khmer supported Python 2, but we recently dropped Python 2 support. If you're using a recent version (i.e. if you installed from github) then I'd suggest trying to run this in a Python 3.5/3.6 environment as a first step.

Let us know if that works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants