fastqp icon indicating copy to clipboard operation
fastqp copied to clipboard

ZeroDivisionError: division by zero

Open seyfim opened this issue 4 years ago • 1 comments

Hello @mdshw5 @ucpete @danielecook @tomsherborne @edawine , I am using python.2.7.12 and the following OS

CentOS release 6.5 (Final)
Cluster Manager v7.0
slave
LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
CentOS release 6.5 (Final)
CentOS release 6.5 (Final)

I am getting the error

657,845,172 reads in input file.
Bin size (-s) set to 328.
Traceback (most recent call last):
  File "/cm/shared/apps/python/2.7.12/bin/fastqp", line 10, in <module>
    sys.exit(main())
  File "/cm/shared/apps/python/2.7.12/lib/python2.7/site-packages/fastqp/cli.py", line 412, in main
    run(arguments)
  File "/cm/shared/apps/python/2.7.12/lib/python2.7/site-packages/fastqp/cli.py", line 352, in run
    mismatchplot(positions, cycle_mismatch, zip_archive, fig_kw)
  File "/cm/shared/apps/python/2.7.12/lib/python2.7/site-packages/fastqp/plots.py", line 659, in mismatchplot
    for pos in positions
ZeroDivisionError: division by zero 

I checked the issues board, specifically the closed #26

(https://github.com/mdshw5/fastqp/issues/26)

which had a "hack-ish" solution #28 . In the source code (current version) the plots.py does not contain the lines mentioned

(https://github.com/mdshw5/fastqp/pull/28/commits/3648187a2b567fb419b04239458d82b49d14c9f5)

. Please advise!

seyfim avatar May 27 '20 16:05 seyfim

Hey @seyfim thanks for reporting this. I'll have to take a closer look and see what's causing your issue, but I do see that the change from #28 is still present in plots.py: https://github.com/mdshw5/fastqp/blob/master/fastqp/plots.py#L528-L529. Your error is coming from the "mismatch plot" code path (https://github.com/mdshw5/fastqp/blob/master/fastqp/plots.py#L648) which should only be called when SAM/BAM files are provided. I can see that I implemented a check for SAM input files (https://github.com/mdshw5/fastqp/blob/master/fastqp/cli.py#L216), and count mismatches when the SAM format records are mapped, but it looks like when I call the mismatch plot code I don't have a check to make sure we encountered some mapped reads. Are you by any chance passing unaligned SAM/BAM files to fastqp? If so that would be something I didn't properly account for.

mdshw5 avatar May 29 '20 23:05 mdshw5