Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Adding an overlaps function to IntervalList. #877
Conversation
yfarjoun
was assigned
by nh13
May 22, 2017
codecov-io
commented
May 22, 2017
•
Codecov Report
@@ Coverage Diff @@
## master #877 +/- ##
===============================================
+ Coverage 65.006% 65.115% +0.109%
- Complexity 7229 7283 +54
===============================================
Files 528 528
Lines 31894 31999 +105
Branches 5444 5478 +34
===============================================
+ Hits 20733 20836 +103
- Misses 9013 9021 +8
+ Partials 2148 2142 -6
|
| + * overlap with any interval in the second lists. | ||
| + */ | ||
| + public static IntervalList overlaps(final Collection<IntervalList> lists1, final Collection<IntervalList> lists2) { | ||
| + final SAMFileHeader header = lists1.iterator().next().getHeader().clone(); |
yfarjoun
May 26, 2017
Contributor
will break on empty list....but then you'll have no header to work with...you could then grab the header from an intervalList in lists2...but that might be empty as well..
Do you really need Collections of IntervalLists? Wouldn't it be better to make this robust on overlaps(final IntervalList lhs, final IntervalList rhs) and have the caller addAll outside?
nh13
Jun 3, 2017
Contributor
If you look at the rest of the "actions", you'll see either they return null (intersection) or throw an exception (concatenate). And then some of the other actions (ex. union) depend on these. So I think it's fine the way it is (albeit I need to add a check for an empty list).
| + } | ||
| + final OverlapDetector<Interval> detector = new OverlapDetector<>(0, 0); | ||
| + for (final Interval interval : overlapIntervals.sorted().uniqued()) { | ||
| + detector.addLhs(interval, interval); |
yfarjoun
May 26, 2017
Contributor
can put the same (dummy) Object in the second position of addLhs. Might be more efficient that way?
| + final IntervalList one_overlaps_three = new IntervalList(fileHeader); | ||
| + | ||
| + two_overlaps_one.add(new Interval("1", 50, 150)); | ||
| + //two_overlaps_one.add(new Interval("1", 301, 500)); |
nh13
Jun 3, 2017
•
Contributor
Will add this comment:
// NB: commented lines below are there to show the intervals in the first list that will not be in the resulting list
| + }; | ||
| + } | ||
| + | ||
| + @DataProvider(name = "overlapsData") |
yfarjoun
May 26, 2017
Contributor
please add a test with an empty collection on the lhs and another on the rhs.
nh13
referenced
this pull request
in nh13/picard
Jun 3, 2017
Closed
Supporting auxiliary baits for bait re-design #7
|
@yfarjoun back to you |
|
@yfarjoun bump |
nh13 commentedMay 22, 2017
Finds all intervals in the first list that overlap any interval in the
second list.
@yfarjoun would you have a chance to review? I know @tfenne is on vacation this week and I know you are familiar with this code. Otherwise, I can ask @lbergelson or @jacarey to review?
Relates to nh13/picard#7