Support separate odgi depth -b for arbitrary interval depth - #266
Merged
Merged
Conversation
Just trying to implement *half* of the window-depth computation. Starting with an initial implementation that involves a lot of code duplication, and hoping to clean it up next.
We now have one struct to represent the result of both `window_depth` and the more general `interval_depth`, and they use the `Emit` trait to share the printing logic between them.
As part of the quest to further unify the "windowed" and "arbitrary
depth" paths, this makes the former use a FlatBED data structure instead
of a plain `Vec<(usize, usize>)`. Now the data interchange format is
identical between the two.
This comes with some overhead (we now have to needlessly keep track of a
"name" field for the windows), but some quick measurement suggests it's
not a big deal. I ran this experiment:
hyperfine 'fgfa -i chr8.flatgfa window-depth "chm13#chr8" 5000 > /dev/null'
With these results:
old: 953.9 ms ± 11.7 ms
new: 940.0 ms ± 9.6 ms
So I'm calling that "no change" (solidly within the margin of error).
Now `window_depth` and `bed_depth` can be very short because they only differ by a little bit.
We will need this for `odgi depth -b`, so let's finally cross that bridge.
It just feels better!
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In #259, we added an end-to-end
fgfa window-depthcommand that both calculates evenly-sized windows and then computes their average depth. The original script we're working from does this in two commands, though, so I was interested in implementing them separately too. What we needed was a drop-in replacement forodgi depth -b something.bed, which I have now added.I refactored the stuff in
window_deptha bit so that we could share almost all of the implementation across the "fixed-function" window version and the arbitrary-interval version.I then added
odgi depth -bto flash. Following the benchmarks in #259, we can now compare odgi and fgfa against a slightly adapted shell script. Here's that three-way comparison:As expected, flash pays some overhead w/r/t the all-in-one fgfa invocation in order to write that BED file and then parse it back, but it's not too much (1.34x ain't bad). The goal is to mostly eliminate this through optimizations.
As a reminder, here's the script for odgi:
Here's the flash script:
Some notes on the shell syntax:
.oginput file and not pay for it.--threads 2doesn't do anything; it's silently ignored.bedtools sort, which is a little unfair.