+ assertArrayEquals(new int[] { 9, 13 }, overlaps.get(0));
+
+ /*
+ * EMBL:MN908947 https://www.ebi.ac.uk/ena/browser/api/embl/MN908947
+ * (Covid-SARS-2) CDS mapping with 'slippage'
+ * (base 13468 is used twice in transcription)
+ */
+ ranges.clear();
+ ranges.add(new int[] { 266, 13468 });
+ ranges.add(new int[] { 13468, 21555 });
+
+ // 13468 occupies two offsets in the range list
+ overlaps = MapList.findOverlapPositions(ranges, 13468, 13468);
+ assertEquals(1, overlaps.size());
+ assertArrayEquals(new int[] { 13202, 13203 }, overlaps.get(0));
+ overlaps = MapList.findOverlapPositions(ranges, 13469, 13470);
+ assertEquals(1, overlaps.size());
+ assertArrayEquals(new int[] { 13204, 13205 }, overlaps.get(0));
+
+ /*
+ * EMBL:J03321 https://www.ebi.ac.uk/ena/browser/api/embl/J03321
+ * circular dna: CDS at [7022-7502, 1-437]
+ * = 481 + 437 = 918 bases = 305 aa's + stop codon
+ */
+ ranges.clear();
+ ranges.add(new int[] { 7022, 7502 });
+ ranges.add(new int[] { 1, 437 });
+
+ overlaps = MapList.findOverlapPositions(ranges, 438, 7021);
+ assertTrue(overlaps.isEmpty());
+
+ // overlap first exon only:
+ overlaps = MapList.findOverlapPositions(ranges, 7000, 7100);
+ assertEquals(1, overlaps.size());
+ assertArrayEquals(new int[] { 0, 78 }, overlaps.get(0));
+
+ // overlap second exon only: offset to mapping includes first exon
+ overlaps = MapList.findOverlapPositions(ranges, 400, 500);
+ assertEquals(1, overlaps.size());
+ assertArrayEquals(new int[] { 880, 917 }, overlaps.get(0));
+
+ // overlap both exons: first exon overlap precedes second exon overlap
+ // offsets of overlaps are not contiguous
+ overlaps = MapList.findOverlapPositions(ranges, 200, 7500);
+ assertEquals(2, overlaps.size());
+ // first overlap is offsets of 7022-7500 in exon 1 (7022-7502):
+ assertArrayEquals(new int[] { 0, 478 }, overlaps.get(0));
+ // second overlap offsets is (first exon length = 481) + (200-437)
+ assertArrayEquals(new int[] { 680, 917 }, overlaps.get(1));