SAMRecords { public static int basesInsertedAfterPosition(@NotNull final SAMRecord record, int position) { int startReadPosition = record.getReadPositionAtReferencePosition(position); assert (startReadPosition != 0); int nextReadPosition = record.getReadPositionAtReferencePosition(position + 1); return nextReadPosition == 0 && record.getAlignmentEnd() == position ? record.getReadString().length() - startReadPosition : Math.max(0, nextReadPosition - startReadPosition - 1); } private  SAMRecords(); static int leftSoftClip(@NotNull final SAMRecord record); static int rightSoftClip(@NotNull final SAMRecord record); static int getBaseQuality(final char quality); static int getBaseQuality(@NotNull final SAMRecord record, int readPosition); static int getAvgBaseQuality(@NotNull final SAMRecord record, int readPosition, int length); static int getMinBaseQuality(@NotNull final SAMRecord record, int readPosition, int length); static boolean containsInsert(@NotNull final SAMRecord record, int position, @NotNull final String alt); static boolean containsDelete(@NotNull final SAMRecord record, int position, @NotNull final String ref); static int basesInsertedAfterPosition(@NotNull final SAMRecord record, int position); static int basesDeletedAfterPosition(@NotNull final SAMRecord record, int position); @NotNull static GenomeRegion alignmentRegion(@NotNull final SAMRecord record); static final int PHRED_OFFSET; }
@Test public void testInsertedBasesAfterPosition() { assertEquals(0, SAMRecords.basesInsertedAfterPosition(buildSamRecord(98, "6M", "GATACA"), 100)); assertEquals(1, SAMRecords.basesInsertedAfterPosition(buildSamRecord(98, "3M1I3M", "GATTACA"), 100)); assertEquals(2, SAMRecords.basesInsertedAfterPosition(buildSamRecord(98, "3M2I3M", "GATTTACA"), 100)); assertEquals(3, SAMRecords.basesInsertedAfterPosition(buildSamRecord(98, "3M3I", "GATTTT"), 100)); assertEquals(0, SAMRecords.basesInsertedAfterPosition(buildSamRecord(98, "6M", "GATACA"), 100)); assertEquals(0, SAMRecords.basesInsertedAfterPosition(buildSamRecord(98, "3M1D2M", "GATCA"), 100)); assertEquals(0, SAMRecords.basesInsertedAfterPosition(buildSamRecord(98, "3M2D1M", "GATA"), 100)); assertEquals(0, SAMRecords.basesInsertedAfterPosition(buildSamRecord(98, "3M3D", "GAT"), 100)); }