khmer icon indicating copy to clipboard operation
khmer copied to clipboard

unique-kmers.py can produce division by zero

Open bwlang opened this issue 6 years ago • 1 comments

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

bwlang avatar Apr 27 '18 16:04 bwlang

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!

standage avatar Apr 27 '18 16:04 standage