jenniferlu717 / KrakenTools

KrakenTools provides individual scripts to analyze Kraken/Kraken2/Bracken/KrakenUniq output files
GNU General Public License v3.0
321 stars 90 forks source link

beta_diversity.py error #96

Open Kamouyiaraki opened 5 months ago

Kamouyiaraki commented 5 months ago

Hey,

I've got this error popping up when I run this:

python ../../bin/KrakenTools-master/DiversityTools/beta_diversity.py -i input1.kreport input2.kreport.... --type kreport2 --level G > betadiv.out

Traceback (most recent call last):
  File "/mnt/shared/scratch/PWD/../../bin/KrakenTools-master/DiversityTools/beta_diversity.py", line 242, in <module>
    main()
  File "/mnt/shared/scratch/PWD/../../bin/KrakenTools-master/DiversityTools/beta_diversity.py", line 209, in main
    bc_ij = 1.0 - (2.0*C_ij)/float(i_tot+j_tot))
ZeroDivisionError: float division by zero

It works fine when I remove --level G and when I remove samples with only a single hit to a lower level (S). I've attached an example. This leads me to believe that it's not collapsing lower levels into counts when you specify level. looks like when specifying level it doesn't include any counts from lower ranks.

Any chance there is a quick way to fix this or this has been encountered and solved before? I am losing out on counts when I want to collapse taxonomy to Genus level or Family level which is less than ideal.

Many thanks! input1.kreport.txt