-
Notifications
You must be signed in to change notification settings - Fork 602
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
Kraken ZeroDivisionError #1276
Comments
Hi there, |
Hi both! I've just encountered the same issue and found the reason for this behaviour. If you run Kraken2 on data and supply the parameter https://github.com/nf-core/viralrecon/blob/master/main.nf#L2076--L2085 (as an example code). When I remove that Solution/Bugfix would be that we add a pseudo-count to zero-counts (?) and thus the division cannot go wrong here: https://github.com/ewels/MultiQC/blob/7584e64e10885f38367628a5a4a9033d48e82011/multiqc/modules/kraken/kraken.py#L134 @ewels what do you think? I can probably take this on then for an upcoming MultiQC release.... |
Sorry if that wasn't clear: For me it was the |
Thanks, Alexander, for the verification and tip! I'll make some tests asap! Cheers, Antonio. |
I encountered the same error using kraken2 2.0.9-beta without the option is quite dangerous since they include only two decimal digits and can potentially be Files that trigger the error: |
Thanks all! Sounds sensible @apeltzer though I would prefer to simply catch the exception - that's what I usually do in these circumstances. eg: try:
self.kraken_sample_total_readcounts[s_name] = round(float(row['counts_rooted']) / (row['percent'] / 100.0))
except ZeroDivisionError:
self.kraken_sample_total_readcounts[s_name] = 0 @davidealbanese - is there an alternative to using the percentages? I would assume from looking at the code snippet that this is a workaround to get the total counts which would be impossible by other means. If we have actual total counts then I agree that it would be better. I have a vague, vague memory that the report might truncate off some categories which meant that they couldn't be summed to a library total or something? But I could be confusing this with another MultiQC module. Phil |
Should now be fixed 👍🏻 Thanks @davidealbanese ! |
Description of bug:
Some of our samples reporting following Kraken module error in multiqc 1.9. we are using the kraken2/2.0.7.
MultiQC Error log:
File that triggers the error:
MultiQC run details (please complete the following):
Additional context
The text was updated successfully, but these errors were encountered: