insertions3.put(8, 3);
insertions3.put(105, 3);
+ SortedMap<Integer, Integer> insertions4 = new TreeMap<>();
+ insertions4.put(8, 3);
+ insertions4.put(105, 2);
+ insertions4.put(109, 3);
+ insertions4.put(112, 1);
+
String read = "CGAAGCTCTTTACCCGGAAACCATTGAAATCGGACGGTTTAGTGAAATGGAGGATCAAGTTGGGTTTGGGTTCCGTCCGAACGACGAGGAGCTCGTTGGTC";
return new Object[][] { { "1S84M2I14M", read, 21,
"-----------------------GAAGCTCTTTACCCGGAAACCATTGAAATCGGACGGTTTAGTGAAATGGAGGATCAAGTTGGGTTTGGGTTCCGTCCGAACGACGAGGAGCTCGTTGGTC",
- insertions },
+ insertions }, // first residue is G (accounting for C soft clip) at
+ // position 21 + 3 (insertions at position 8)
{ "1S84M2I14M", read, 21,
"-----------------------GAAGCTCTTTACCCGGAAACCATTGAAATCGGACGGTTTAGTGAAATGGAGGATCAAGTTGGGTTTGGGTTCCGTCCGAACGACGA-GGAGCTCGTTGGTC",
- insertions3 },
-
+ insertions3 }, // read has 2 insertions accounted for in
+ // insertions3, 3rd insertion is added as gap at
+ // position 105
+ { "1S84M2I14M", read, 21,
+ "-----------------------GAAGCTCTTTACCCGGAAACCATTGAAATCGGACGGTTTAGTGAAATGGAGGATCAAGTTGGGTTTGGGTTCCGTCCGAACGACGAGGAG---CTC-GTTGGTC",
+ insertions4 }, // 2 insertions in read accounted for at position
+ // 105; 3 insertions at 109 and 1 insertion at 112
{ "44M1D57M",
read,
3,
builder.addFrag("read_6", 22, 27000, false, false, "2M4I90M5S", "", 0);
builder.addFrag("read_7", 22, 27000, false, false, "2M1I98M", "", 0);
+ builder.addFrag("read_8", 22, 27000, false, false, "3M200N2I5M", "", 0);
+
Iterator<SAMRecord> it = builder.iterator();
CigarParser cp = new CigarParser('-');
SortedMap<Integer, Integer> insertions = cp.getInsertions(it);
- Assert.assertEquals(insertions.size(), 5);
+ Assert.assertEquals(insertions.size(), 6);
Assert.assertTrue(insertions.containsKey(28838));
Assert.assertEquals((int) insertions.get(28838), 1);
Assert.assertTrue(insertions.containsKey(28885));
Assert.assertEquals((int) insertions.get(28914), 3);
Assert.assertTrue(insertions.containsKey(27002));
Assert.assertEquals((int) insertions.get(27002), 4);
+ Assert.assertTrue(insertions.containsKey(27203));
+ Assert.assertEquals((int) insertions.get(27203), 2);
}
}