/** * Lift over the given interval to the new genome build using the liftOverMinMatch set for this * LiftOver object. * @param interval Interval to be lifted over. * @return Interval in the output build coordinates, or null if it cannot be lifted over. */ public Interval liftOver(final Interval interval) { return liftOver(interval, liftOverMinMatch); }
/** * Lift over the given interval to the new genome build using the liftOverMinMatch set for this * LiftOver object. * @param interval Interval to be lifted over. * @return Interval in the output build coordinates, or null if it cannot be lifted over. */ public Interval liftOver(final Interval interval) { return liftOver(interval, liftOverMinMatch); }
/** * Lift over the given interval to the new genome build using the liftOverMinMatch set for this * LiftOver object. * @param interval Interval to be lifted over. * @return Interval in the output build coordinates, or null if it cannot be lifted over. */ public Interval liftOver(final Interval interval) { return liftOver(interval, liftOverMinMatch); }
@Test(dataProvider = "testIntervals") public void testBasic(final Interval in, final Interval expected) { Assert.assertEquals(liftOver.liftOver(in), expected); }
@Test(dataProvider = "testIntervalsSubset") public void testLiftoverCounter(final Interval in, final Interval expected) { liftOver.resetFailedIntervalsBelowThresholdCounter(); final Interval out = liftOver.liftOver(in); Assert.assertEquals(out, expected); Assert.assertEquals(liftOver.getFailedIntervalsBelowThreshold(), expected == null ? 1 : 0); }
oneBasedClosedEnd, !currRange.isPositiveStrand(), currRange.getName()); Interval liftedInterval = liftOverTool.liftOver(currInterval, ARGS.minMatch); if (liftedInterval == null) { logger.log(Level.FINE, "failed to liftover an interval");
@Test(dataProvider = "noCallAndSymbolicData") public void testLiftOverNoCallAndSymbolic(final LiftOver liftOver, final VariantContext source, final VariantContext result, final boolean expectReversed) { final Interval target = liftOver.liftOver(new Interval(source.getContig(), source.getStart(), source.getEnd()), .95); Assert.assertEquals(target.isNegativeStrand(), expectReversed); VariantContext vc = LiftoverUtils.liftVariant(source, target, REFERENCE, true, true); VcfTestUtils.assertEquals(vc, result); Assert.assertEquals(vc.getAttribute(LiftoverVcf.ORIGINAL_CONTIG), source.getContig()); Assert.assertEquals(vc.getAttribute(LiftoverVcf.ORIGINAL_START), source.getStart()); Assert.assertTrue(source.getAlleles().equals(result.getAlleles()) != result.hasAttribute(LiftoverVcf.ORIGINAL_ALLELES)); if (!source.getAlleles().equals(result.getAlleles())) { List<String> resultAlleles = new ArrayList<>(); source.getAlleles().forEach(a -> resultAlleles.add(a.getDisplayString())); Assert.assertEquals(resultAlleles, result.getAttributeAsStringList(LiftoverVcf.ORIGINAL_ALLELES, null)); } }
@Test(dataProvider = "indelFlipData") public void testFlipIndel(final VariantContext source, final ReferenceSequence reference, final VariantContext result) { final LiftOver liftOver = new LiftOver(CHAIN_FILE); final Interval originalLocus = new Interval(source.getContig(), source.getStart(), source.getEnd()); final Interval target = liftOver.liftOver(originalLocus); if (target != null && !target.isNegativeStrand()) { throw new RuntimeException("not reversed"); } final VariantContext flipped = LiftoverUtils.liftVariant(source, target, reference, false, false); VcfTestUtils.assertEquals(flipped, result); }
@Test(dataProvider = "indelFlipDataWithOriginalAllele") public void testFlipIndelWithOriginalAlleles(final VariantContext source, final ReferenceSequence reference, final VariantContext result) { final LiftOver liftOver = new LiftOver(CHAIN_FILE); final Interval originalLocus = new Interval(source.getContig(), source.getStart(), source.getEnd()); final Interval target = liftOver.liftOver(originalLocus); if (target != null && !target.isNegativeStrand()) { throw new RuntimeException("not reversed"); } final VariantContext flipped = LiftoverUtils.liftVariant(source, target, reference, false, true); VcfTestUtils.assertEquals(flipped, result); }
@Test(dataProvider = "snpWithChangedRef") public void snpWithChangedRef(final VariantContext source, final ReferenceSequence reference, final VariantContext result) { final LiftOver liftOver = new LiftOver(POSITIVE_CHAIN_FILE); final Interval originalLocus = new Interval(source.getContig(), source.getStart(), source.getEnd()); final Interval target = liftOver.liftOver(originalLocus); final VariantContext flipped = LiftoverUtils.swapRefAlt(source, LiftoverUtils.DEFAULT_TAGS_TO_REVERSE, LiftoverUtils.DEFAULT_TAGS_TO_DROP); VcfTestUtils.assertEquals(flipped, result); }
@Test(dataProvider = "indelNoFlipData") public void testLiftOverSimpleIndels(final LiftOver liftOver, final ReferenceSequence reference, final VariantContext source, final VariantContext result) { final Interval target = liftOver.liftOver(new Interval(source.getContig(), source.getStart(), source.getEnd()), .95); VariantContextBuilder vcb = LiftoverUtils.liftSimpleVariantContext(source, target); VcfTestUtils.assertEquals(vcb == null ? null : vcb.make(), result); }
final IntervalList toIntervals = new IntervalList(toHeader); for (final Interval fromInterval : intervalList) { final Interval toInterval = liftOver.liftOver(fromInterval); if (toInterval != null) { toIntervals.add(toInterval);
final IntervalList toIntervals = new IntervalList(toHeader); for (final Interval fromInterval : intervalList) { final Interval toInterval = liftOver.liftOver(fromInterval); if (toInterval != null) { toIntervals.add(toInterval);
++total; final Interval source = new Interval(ctx.getContig(), ctx.getStart(), ctx.getEnd(), false, ctx.getContig() + ":" + ctx.getStart() + "-" + ctx.getEnd()); final Interval target = liftOver.liftOver(source, LIFTOVER_MIN_MATCH);
++total; final Interval source = new Interval(ctx.getContig(), ctx.getStart(), ctx.getEnd(), false, ctx.getContig() + ":" + ctx.getStart() + "-" + ctx.getEnd()); final Interval target = liftOver.liftOver(source, LIFTOVER_MIN_MATCH);