InframeIndelHotspots { @NotNull static Set<VariantHotspot> findInframeIndelsWithIncorrectRefs(@NotNull final SAMRecord record) { Set<VariantHotspot> result = Sets.newHashSet(); if (containsInframeIndel(record)) { for (int refPosition = record.getAlignmentStart(); refPosition <= record.getAlignmentEnd(); refPosition++) { int readPosition = record.getReadPositionAtReferencePosition(refPosition); if (readPosition != 0) { int basesInserted = SAMRecords.basesInsertedAfterPosition(record, refPosition); if (basesInserted > 0 && basesInserted % 3 == 0) { result.add(createInsert(record, readPosition, refPosition, basesInserted + 1)); continue; } int basesDeleted = SAMRecords.basesDeletedAfterPosition(record, refPosition); if (basesDeleted > 0 && basesDeleted % 3 == 0) { result.add(createDelete(record, readPosition, refPosition, basesDeleted + 1)); } } } } return result; } InframeIndelHotspots(final int minMappingQuality, @NotNull final Collection<GenomeRegion> regions,
            @NotNull final IndexedFastaSequenceFile sequenceFile); @NotNull Set<VariantHotspot> findInframeIndels(@NotNull final SamReader samReader);  }
@Test public void testDelLength6() { final SAMRecord record = VariantHotspotEvidenceFactoryTest.buildSamRecord(100, "1M6D4M", "GATACA"); final Set<VariantHotspot> indels = InframeIndelHotspots.findInframeIndelsWithIncorrectRefs(record); assertContains(indels, 100, "GNNNNNN", "G"); }
@Test public void testDelLength3() { final SAMRecord record = VariantHotspotEvidenceFactoryTest.buildSamRecord(100, "1M3D4M", "GATACA"); final Set<VariantHotspot> indels = InframeIndelHotspots.findInframeIndelsWithIncorrectRefs(record); assertContains(indels, 100, "GNNN", "G"); }
@Test public void testDelLength2() { final SAMRecord record = VariantHotspotEvidenceFactoryTest.buildSamRecord(100, "1M2D4M", "GATACA"); final Set<VariantHotspot> indels = InframeIndelHotspots.findInframeIndelsWithIncorrectRefs(record); assertTrue(indels.isEmpty()); }
@Test public void testInsLength6() { final SAMRecord record = VariantHotspotEvidenceFactoryTest.buildSamRecord(100, "1M6I4M", "GGATCATTACA"); final Set<VariantHotspot> indels = InframeIndelHotspots.findInframeIndelsWithIncorrectRefs(record); assertContains(indels, 100, "G", "GGATCAT"); }
@Test public void testInsLength5() { final SAMRecord record = VariantHotspotEvidenceFactoryTest.buildSamRecord(100, "1M5I4M", "GGATCATACA"); final Set<VariantHotspot> indels = InframeIndelHotspots.findInframeIndelsWithIncorrectRefs(record); assertTrue(indels.isEmpty()); }
@Test public void testInsLength3() { final SAMRecord record = VariantHotspotEvidenceFactoryTest.buildSamRecord(100, "1M3I4M", "GGATTACA"); final Set<VariantHotspot> indels = InframeIndelHotspots.findInframeIndelsWithIncorrectRefs(record); assertContains(indels, 100, "G", "GGAT"); }
@Test public void testIndel() { final SAMRecord record = VariantHotspotEvidenceFactoryTest.buildSamRecord(100, "1M3I1M3D1M", "GGATAT"); final Set<VariantHotspot> indels = InframeIndelHotspots.findInframeIndelsWithIncorrectRefs(record); assertContains(indels, 100, "G", "GGAT"); assertContains(indels, 101, "ANNN", "A"); }