@Override IntervalList act(final List<IntervalList> list1, final List<IntervalList> list2) { return IntervalList.overlaps(list1, list2); } };
@Override IntervalList act(final List<IntervalList> list1, final List<IntervalList> list2) { return IntervalList.overlaps(list1, list2); } };
/** * A utility function for finding the intervals in the first list that have at least 1bp overlap with any interval * in the second list. * * @param lhs the first collection of IntervalLists * @param rhs the second collection of IntervalLists * @return an IntervalList comprising of all intervals in the first IntervalList that have at least 1bp overlap with * any interval in the second. */ public static IntervalList overlaps(final IntervalList lhs, final IntervalList rhs) { return overlaps(Collections.singletonList(lhs), Collections.singletonList(rhs)); }
/** * A utility function for finding the intervals in the first list that have at least 1bp overlap with any interval * in the second list. * * @param lhs the first collection of IntervalLists * @param rhs the second collection of IntervalLists * @return an IntervalList comprising of all intervals in the first IntervalList that have at least 1bp overlap with * any interval in the second. */ public static IntervalList overlaps(final IntervalList lhs, final IntervalList rhs) { return overlaps(Collections.singletonList(lhs), Collections.singletonList(rhs)); }
@Test(expectedExceptions = SAMException.class) public void testOverlapsEmptyFirstList() { IntervalList.overlaps(Collections.emptyList(), Collections.singletonList(list1)); }
@Test public void testOverlapsEmptySecondList() { Assert.assertEquals( CollectionUtil.makeCollection(IntervalList.overlaps(Collections.singletonList(list1), Collections.emptyList()).iterator()), Collections.emptyList()); }
@Test(dataProvider = "overlapsSingletonData") public void testOverlapsSingletonAsListIntervalList(final IntervalList fromLists, final IntervalList whatLists, final IntervalList list) { Assert.assertEquals( CollectionUtil.makeCollection(IntervalList.overlaps(Collections.singletonList(fromLists), Collections.singletonList(whatLists)).iterator()), CollectionUtil.makeCollection(list.iterator())); }
@Test(dataProvider = "overlapsData") public void testOverlapsIntervalLists(final List<IntervalList> fromLists, final List<IntervalList> whatLists, final IntervalList list) { Assert.assertEquals( CollectionUtil.makeCollection(IntervalList.overlaps(fromLists, whatLists).iterator()), CollectionUtil.makeCollection(list.iterator())); }
@Test(dataProvider = "overlapsSingletonData") public void testOverlapsSingletonIntervalLists(final IntervalList fromLists, final IntervalList whatLists, final IntervalList list) { Assert.assertEquals( CollectionUtil.makeCollection(IntervalList.overlaps(fromLists, whatLists).iterator()), CollectionUtil.makeCollection(list.iterator())); }
Collections.singletonList(IntervalList.overlaps(LIST_TO_SCATTER_MANY, full)))); testCases.add(new Testcase( SCATTER_MANY_INTERVAL_FILE, 2, IntervalListScatterMode.INTERVAL_COUNT, Arrays.asList(IntervalList.overlaps(LIST_TO_SCATTER_MANY, half), IntervalList.overlaps(LIST_TO_SCATTER_MANY, IntervalList.invert(half))))); testCases.add(new Testcase( SCATTER_MANY_INTERVAL_FILE, 3, IntervalListScatterMode.INTERVAL_COUNT, Arrays.asList(IntervalList.overlaps(LIST_TO_SCATTER_MANY, third), IntervalList.overlaps(LIST_TO_SCATTER_MANY, secondThird), IntervalList.overlaps(LIST_TO_SCATTER_MANY, IntervalList.invert(IntervalList.concatenate(Arrays.asList( IntervalList.overlaps(LIST_TO_SCATTER_MANY, third), IntervalList.overlaps(LIST_TO_SCATTER_MANY, secondThird)) ))))));