bcgsc / RNA-Bloom

:hibiscus: reference-free transcriptome assembly for short and long reads
Other
96 stars 7 forks source link

ERROR: Infinite or NaN #42

Closed schorlton closed 2 years ago

schorlton commented 2 years ago

Thanks for the great tool! Hitting a bit of an error...I suspect it may be because I have so few reads or they're too short but it's a bit cryptic...

root@f069f7fa8f9e:/data/retry# rnabloom -outdir rnabloom_out -t 8 -long filtered.fastq -ntcard                                                           [58/423]
RNA-Bloom v1.4.3
args: [-outdir, rnabloom_out, -t, 8, -long, filtered.fastq, -ntcard]

name:   rnabloom
outdir: rnabloom_out
WARNING: Output directory does not exist!
Created output directory at `rnabloom_out`

K-mer counting with ntCard...
Running command: `ntcard -t 8 -k 17 -c 65535 -p rnabloom_out/rnabloom @rnabloom_out/rnabloom.ntcard.readslist.txt`...
Parsing histogram file `rnabloom_out/rnabloom_k17.hist`...
Unique k-mers (k=17):     1,600
Unique k-mers (k=17,c>1): 0
K-mer counting completed in 3.977s

Bloom filters          Memory (GB)
====================================
de Bruijn graph:       3.5357662E-6
====================================
Total:                 3.5357662E-6

> Stage 1: Construct graph from reads (k=17)
Parsing `filtered.fastq`...
Exception in thread "Thread-6" Exception in thread "Thread-5" Exception in thread "Thread-3" Exception in thread "Thread-2" java.lang.RuntimeException: java.lang.Arithme$
icException: / by zero
        at rnabloom.RNABloom$FastqToGraphWorker.run(RNABloom.java:617)
        at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.ArithmeticException: / by zero
        at rnabloom.bloom.CountingBloomFilter.getIndex(CountingBloomFilter.java:103)
        at rnabloom.bloom.CountingBloomFilter.increment(CountingBloomFilter.java:132)
        at rnabloom.graph.BloomFilterDeBruijnGraph.add(BloomFilterDeBruijnGraph.java:411)
        at rnabloom.RNABloom$FastqToGraphWorker.run(RNABloom.java:606)
        ... 1 more
Exception in thread "Thread-7" Exception in thread "Thread-0" java.lang.RuntimeException: java.lang.ArithmeticException: / by zero
        at rnabloom.RNABloom$FastqToGraphWorker.run(RNABloom.java:617)
        at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.ArithmeticException: / by zero
        at rnabloom.bloom.CountingBloomFilter.getIndex(CountingBloomFilter.java:103)
        at rnabloom.bloom.CountingBloomFilter.increment(CountingBloomFilter.java:132)
        at rnabloom.graph.BloomFilterDeBruijnGraph.add(BloomFilterDeBruijnGraph.java:411)
        at rnabloom.RNABloom$FastqToGraphWorker.run(RNABloom.java:606)
        ... 1 more
Exception in thread "Thread-4" Exception in thread "Thread-1" java.lang.RuntimeException: java.lang.ArithmeticException: / by zero
        at rnabloom.RNABloom$FastqToGraphWorker.run(RNABloom.java:617)
        at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.ArithmeticException: / by zero
        at rnabloom.bloom.CountingBloomFilter.getIndex(CountingBloomFilter.java:103)
        at rnabloom.bloom.CountingBloomFilter.increment(CountingBloomFilter.java:132)
        at rnabloom.graph.BloomFilterDeBruijnGraph.add(BloomFilterDeBruijnGraph.java:411)
        at rnabloom.RNABloom$FastqToGraphWorker.run(RNABloom.java:606)
        ... 1 more
java.lang.RuntimeException: java.lang.ArithmeticException: / by zero
        at rnabloom.RNABloom$FastqToGraphWorker.run(RNABloom.java:617)
        at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.ArithmeticException: / by zero
        at rnabloom.bloom.CountingBloomFilter.getIndex(CountingBloomFilter.java:103)
        at rnabloom.bloom.CountingBloomFilter.increment(CountingBloomFilter.java:132)
        at rnabloom.graph.BloomFilterDeBruijnGraph.add(BloomFilterDeBruijnGraph.java:411)
        at rnabloom.RNABloom$FastqToGraphWorker.run(RNABloom.java:606)
        ... 1 more
java.lang.RuntimeException: java.lang.ArithmeticException: / by zero
        at rnabloom.RNABloom$FastqToGraphWorker.run(RNABloom.java:617)
        at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.ArithmeticException: / by zero
        at rnabloom.bloom.CountingBloomFilter.getIndex(CountingBloomFilter.java:103)
        at rnabloom.bloom.CountingBloomFilter.increment(CountingBloomFilter.java:132)
        at rnabloom.graph.BloomFilterDeBruijnGraph.add(BloomFilterDeBruijnGraph.java:411)
        at rnabloom.RNABloom$FastqToGraphWorker.run(RNABloom.java:606)
        ... 1 more
java.lang.RuntimeException: java.lang.ArithmeticException: / by zero
        at rnabloom.RNABloom$FastqToGraphWorker.run(RNABloom.java:617)
        at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.ArithmeticException: / by zero
        at rnabloom.bloom.CountingBloomFilter.getIndex(CountingBloomFilter.java:103)
        at rnabloom.bloom.CountingBloomFilter.increment(CountingBloomFilter.java:132)
        at rnabloom.graph.BloomFilterDeBruijnGraph.add(BloomFilterDeBruijnGraph.java:411)
        at rnabloom.RNABloom$FastqToGraphWorker.run(RNABloom.java:606)
        ... 1 more
java.lang.RuntimeException: java.lang.ArithmeticException: / by zero
        at rnabloom.RNABloom$FastqToGraphWorker.run(RNABloom.java:617)
        at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.ArithmeticException: / by zero
        at rnabloom.bloom.CountingBloomFilter.getIndex(CountingBloomFilter.java:103)
        at rnabloom.bloom.CountingBloomFilter.increment(CountingBloomFilter.java:132)
        at rnabloom.graph.BloomFilterDeBruijnGraph.add(BloomFilterDeBruijnGraph.java:411)
        at rnabloom.RNABloom$FastqToGraphWorker.run(RNABloom.java:606)
        ... 1 more
java.lang.RuntimeException: java.lang.ArithmeticException: / by zero
        at rnabloom.RNABloom$FastqToGraphWorker.run(RNABloom.java:617)
        at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.ArithmeticException: / by zero
        at rnabloom.bloom.CountingBloomFilter.getIndex(CountingBloomFilter.java:103)
        at rnabloom.bloom.CountingBloomFilter.increment(CountingBloomFilter.java:132)
        at rnabloom.graph.BloomFilterDeBruijnGraph.add(BloomFilterDeBruijnGraph.java:411)
        at rnabloom.RNABloom$FastqToGraphWorker.run(RNABloom.java:606)
        ... 1 more
Parsed 3 sequences in 0.015s
DBG Bloom filter FPR:                 0.0452 %
DBG Bloom filter FPR:                 0.0452 %
ERROR: Infinite or NaN
java.lang.NumberFormatException: Infinite or NaN
        at java.base/java.math.BigDecimal.<init>(BigDecimal.java:923)
        at java.base/java.math.BigDecimal.<init>(BigDecimal.java:900)
        at rnabloom.util.Common.roundToSigFigs(Common.java:36)
        at rnabloom.util.Common.convertToRoundedPercent(Common.java:32)
        at rnabloom.RNABloom.populateGraph2(RNABloom.java:1322)
        at rnabloom.RNABloom.main(RNABloom.java:6823)
kmnip commented 2 years ago

Thanks for your report! This is indeed a bug where there are too few reads. I will fix it for the next release. For such a small FASTQ file, you can bypass the bug by using this option -mem 0.5 instead of -ntcard.

kmnip commented 2 years ago
Unique k-mers (k=17,c>1): 0

Since you have zero non-singleton k-mers in your reads, you will very likely run into errors in subsequent parts of the assembly workflow.

schorlton commented 2 years ago

Got it, thanks! Yes I expect this to fail, just expected a more graceful error/exit explaining too little data or whatever the root cause is.

kmnip commented 2 years ago

Yep, I agree with you. I have incorporated error message for this issue in the next release.

kmnip commented 2 years ago

This bug is fixed. Please see my new release of RNA-Bloom v2.0.0: https://github.com/bcgsc/RNA-Bloom/releases/tag/v2.0.0