/** * Returned an independent IntervalList that is sorted and uniquified. */ public IntervalList uniqued() { return uniqued(true); }
/** * Returned an independent IntervalList that is sorted and uniquified. */ public IntervalList uniqued() { return uniqued(true); }
@Override public IntervalList preprocessIntervalList(IntervalList inputList) { return inputList.uniqued(); }
/** Returned an independent IntervalList that is sorted and uniquified. */ public IntervalList uniqued() { return uniqued(true); }
/** * A utility function for finding the union of a list of IntervalLists, checks for equal dictionaries. * also looks for overlapping intervals, uniquifies, and sorts (by coordinate) * * @param lists the list of IntervalList * @return the union of all the IntervalLists in lists. */ public static IntervalList union(final Collection<IntervalList> lists) { final IntervalList merged = concatenate(lists); return merged.uniqued(); }
/** * A utility function for finding the union of a list of IntervalLists, checks for equal dictionaries. * also looks for overlapping intervals, uniquifies, and sorts (by coordinate) * * @param lists the list of IntervalList * @return the union of all the IntervalLists in lists. */ public static IntervalList union(final Collection<IntervalList> lists) { final IntervalList merged = concatenate(lists); return merged.uniqued(); }
/** * A utility function for finding the union of a list of IntervalLists, checks for equal dictionaries. * also looks for overlapping intervals, uniquifies, and sorts (by coordinate) * * @param lists the list of IntervalList * @return the union of all the IntervalLists in lists. */ public static IntervalList union(final Collection<IntervalList> lists) { final IntervalList merged = concatenate(lists); return merged.uniqued(); }
/** * Gets the count of unique bases represented by the intervals in the list. */ public long getUniqueBaseCount() { return uniqued().getBaseCount(); }
/** * Gets the count of unique bases represented by the intervals in the list. */ public long getUniqueBaseCount() { return uniqued().getBaseCount(); }
/** * @param reader the source of variants. * @param intervals the intervals to which to restrict variants. */ public ByIntervalListVariantContextIterator(final VCFFileReader reader, final IntervalList intervals) { this.reader = reader; this.intervals = intervals.uniqued().iterator(); this.advance(); }
/** Return true if the sequence/position lie in the provided interval list. */ public static boolean contains(final IntervalList intervalList, final String sequenceName, final long position) { for (final Interval interval : intervalList.uniqued().getIntervals()) { if (contains(interval, sequenceName, position)) return true; } return false; }
/** * @param reader the source of variants. * @param intervals the intervals to which to restrict variants. */ public ByIntervalListVariantContextIterator(final VCFFileReader reader, final IntervalList intervals) { this.reader = reader; this.intervals = intervals.uniqued().iterator(); this.advance(); }
/** Return true if the sequence/position lie in the provided interval list. */ public static boolean contains(final IntervalList intervalList, final String sequenceName, final long position) { for (final Interval interval : intervalList.uniqued().getIntervals()) { if (contains(interval, sequenceName, position)) return true; } return false; }
@Override protected int doWork() { IOUtil.assertFileIsReadable(INPUT); IOUtil.assertFileIsWritable(OUTPUT); final IntervalList intervalList = VCFFileReader.fromVcf(INPUT, INCLUDE_FILTERED); // Sort and write the output intervalList.uniqued().write(OUTPUT); return 0; } }
static OverlapDetector<Interval> getOverlapDetectorFromIntervalListFile(File intervalList, int lhsBuffer, int rhsBuffer) { if (intervalList == null) { return null; } List<Interval> intervals = IntervalList.fromFile(intervalList).uniqued().getIntervals(); OverlapDetector<Interval> detector = new OverlapDetector<>(lhsBuffer, rhsBuffer); detector.addAll(intervals, intervals); return detector; }
@Override protected int doWork() { IOUtil.assertFileIsReadable(INPUT); IOUtil.assertFileIsWritable(OUTPUT); final IntervalList intervalList = VCFFileReader.fromVcf(INPUT, INCLUDE_FILTERED); // Sort and write the output intervalList.uniqued().write(OUTPUT); return 0; } }
static OverlapDetector<Interval> getOverlapDetectorFromIntervalListFile(File intervalList, int lhsBuffer, int rhsBuffer) { if (intervalList == null) { return null; } List<Interval> intervals = IntervalList.fromFile(intervalList).uniqued().getIntervals(); OverlapDetector<Interval> detector = new OverlapDetector<>(lhsBuffer, rhsBuffer); detector.addAll(intervals, intervals); return detector; }
@Test public void testUnionSamePosition() { final IntervalList iList= new IntervalList(fileHeader); final List<Interval> intervals = Arrays.asList( new Interval("1", 2, 100, true, "test1"), new Interval("1", 2, 100, true, "test2") ); iList.addall(intervals); final List<Interval> uniqued = iList.uniqued().getIntervals(); Assert.assertEquals(uniqued.size(),1); Assert.assertEquals(uniqued.get(0).getName(),"test1|test2"); }
@Test public void uniqueIntervalsWithoutNames() { final IntervalList test = new IntervalList(this.fileHeader); test.add(new Interval("1", 100, 200)); test.add(new Interval("1", 500, 600)); test.add(new Interval("1", 550, 700)); for (final boolean concat : new boolean[]{true, false}) { final IntervalList unique = test.uniqued(concat); Assert.assertEquals(unique.size(), 2); } }
@Test(dataProvider = "invertData") public void testInvertSquared(final IntervalList list, @SuppressWarnings("UnusedParameters") final IntervalList ignored) throws Exception { final IntervalList inverseSquared = IntervalList.invert(IntervalList.invert(list)); final IntervalList originalClone = new IntervalList(list.getHeader()); for (final Interval interval : list) { originalClone.add(interval); } Assert.assertEquals( CollectionUtil.makeCollection(inverseSquared.iterator()), CollectionUtil.makeCollection(originalClone.uniqued().iterator())); }