IOUtil.assertFileIsReadable(INPUT);
IOUtil.assertFileIsReadable(SEQUENCE_DICTIONARY);
IOUtil.assertFileIsReadable(CHAIN);
IOUtil.assertFileIsWritable(OUTPUT);
final LiftOver liftOver = new LiftOver(CHAIN);
liftOver.setLiftOverMinMatch(MIN_LIFTOVER_PCT);
final IntervalList fromIntervals = IntervalList.fromFile(INPUT);
final SAMFileHeader toHeader = new SAMFileReader(SEQUENCE_DICTIONARY).getFileHeader();
liftOver.validateToSequences(toHeader.getSequenceDictionary());
final IntervalList toIntervals = new IntervalList(toHeader);
boolean anyFailed = false;
for (final Interval fromInterval : fromIntervals) {
final Interval toInterval = liftOver.liftOver(fromInterval);
if (toInterval != null) {
toIntervals.add(toInterval);
} else {
anyFailed = true;
LOG.warn("Liftover failed for ", fromInterval, "(len ", fromInterval.length(), ")");
final List<LiftOver.PartialLiftover> partials = liftOver.diagnosticLiftover(fromInterval);
for (final LiftOver.PartialLiftover partial : partials) {
LOG.info(partial);
}
}
}