-
Notifications
You must be signed in to change notification settings - Fork 13
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
Another ZeroDivisionError: float division by zero #38
Comments
Oh wait hold on... reading through old bugs and stuff, I realized that I'm operating on an old version of mathstats:
Let me try and get that updated. Then hopefully I can close this issue! |
Okay, unfortunately, updating to mathstats 0.2.5 and retrying the command did not work, resulting in exactly the same error. Here's the problematic code: https://github.com/ksahlin/BESST/blob/master/BESST/GenerateOutput.py#L63 Specifically, this part of the code is where the problem is coming from: round(cont_obj.coverage/param.mean_coverage,0) Replicating the error in IPython: In [10]: round(1.0/0,0)
---------------------------------------------------------------------------
ZeroDivisionError Traceback (most recent call last)
<ipython-input-10-87eba751f4c6> in <module>()
----> 1 round(1.0/0,0)
ZeroDivisionError: float division by zero
In [11]: round(1/0.0,0)
---------------------------------------------------------------------------
ZeroDivisionError Traceback (most recent call last)
<ipython-input-11-11b0b1965d8a> in <module>()
----> 1 round(1/0.0,0)
ZeroDivisionError: float division by zero Therefore
This parameter is set here: Line 253 in f38c8d2
Where we see Line 252 in f38c8d2
mean_cov, std_dev_cov = CalculateMeanCoverage(Contigs, Information, param) This leads us to the CalculateMeanCoverage function: Line 883 in f38c8d2
It looks like something is going wrong in this section of the function: Line 903 in f38c8d2
The Line 908 in f38c8d2
It is dependent on the Line 925 in f38c8d2
Nothing really jumps out at me in the code as to what is going wrong, but perhaps it will be more obvious to you, Kristoffer! Hopefully my bit of digging around is helpful to you. I'd like to get this fixed ASAP, because I need to finish scaffolding this assembly! :P |
Very good digging indeed. This is indeed an issue of the filtering of outliers in the coverage histogram of contigs -- something I reported here butnever fixed. It would be helpful to see how your particular contig coverage histogram looks -- Do you have a coverage histogram of the contigs (can be obtained e.g. by running besst with the |
Here is the coverage histogram: The assembly was made with FALCON using only PacBio sequencing data. I'm using BESST to scaffold it with the Illumina libs I've got. I've done this before on a different PacBio assembly, without issue. Here's the coverage histogram from that run: And the resulting gap predictions: I'm thinking the coverage data is just too skewed in the new assembly, so that essentially everything is considered an outlier? Maybe I can manually specify the coverage cutoff with |
Well, I got it to work with this setup:
Output attached: |
Hi Kristoffer, I copy-cut my text from issue #42 that is now closed. I get exactly the same error with version 2.2.5 that Ryan Chikhi in issue #42. I'm using BESST 2.2.5 with option "-z 10000". I get two kinds of error:
Traceback (most recent call last):
Traceback (most recent call last): What should I do to avoid tehse errors? Thanks you in advance for your answer, |
Hi Yoann, I implemented a fix for this in the latest develop version 7a0efa6. Would you mind trying this commit and see if it fixes your issue? The fix removes all contigs with 0 in coverage before calculating average coverage. Contigs with 0 coverage (no mappings) will, by definition, not be scaffolded anyway. I consequently needed to change the output to be coverage estimates of "all contigs with at least one good mapping". Hopefully this will also fix Dan's issue with the first histogram shown above. Too many contigs with 0 coverage will make the "Removing outlier" algorithm converge to 0. |
Hi Kristoffer, Thanks for this fix, I will try it on my experiments that returned a "float division by zero" error. Before your reply, I modified the parameters use for my experiments: Does "-z_min 1" option is equivalent to not consider contigs with 0 coverage (and then avoid "ZeroDivisionError")? |
Ok great! No it doesn't. Because contigs can have coverage between 0 and 1. |
I implemented so that -z_min now can take a float value, with default of 0.001 in 92a81f7 |
Encountered a new error while running a scaffold job yesterday. Here's the setup:
And the output:
The text was updated successfully, but these errors were encountered: