Microhomology { @VisibleForTesting static byte[] reconstructDeletedSequence(int position, @NotNull final byte[] readSequence, @NotNull final String ref) { final byte[] refBytes = ref.getBytes(); final byte[] completeSequence = new byte[readSequence.length + ref.length() - 1]; int tailLength = readSequence.length - position - 1; System.arraycopy(readSequence, 0, completeSequence, 0, position + 1); System.arraycopy(refBytes, 1, completeSequence, position + 1, ref.length() - 1); System.arraycopy(readSequence, position + 1, completeSequence, completeSequence.length - tailLength, tailLength); return completeSequence; } private  Microhomology(); @NotNull static String microhomologyAtInsert(int position, @NotNull final String refSequence, @NotNull final String alt); @NotNull static String microhomologyAtDelete(int position, @NotNull final String refSequence, @NotNull final String ref); @NotNull static MicrohomologyContext microhomologyAtDeleteFromReadSequence(int position, @NotNull final String ref, @NotNull final byte[] readSequence); @NotNull static MicrohomologyContext microhomologyAtInsert(int position, int altLength, @NotNull final byte[] readSequence); @NotNull static MicrohomologyContext microhomologyAtDelete(int position, int refLength, @NotNull final byte[] sequence); @NotNull static MicrohomologyContext expandMicrohomologyRepeats(@NotNull final MicrohomologyContext result);  }
@Test public void testReconstructDeletedSequence() { assertEquals("GATCAA", new String(Microhomology.reconstructDeletedSequence(0, "GTCAA".getBytes(), "GA"))); assertEquals("GATCAA", new String(Microhomology.reconstructDeletedSequence(1, "GACAA".getBytes(), "AT"))); assertEquals("GATCAA", new String(Microhomology.reconstructDeletedSequence(2, "GATAA".getBytes(), "TC"))); assertEquals("GATCAA", new String(Microhomology.reconstructDeletedSequence(3, "GATCA".getBytes(), "CA"))); assertEquals("GATCAA", new String(Microhomology.reconstructDeletedSequence(4, "GATCA".getBytes(), "AA"))); }
@Test public void testReconstructDeletedSequenceWithDelCombinedWithSnv() { assertEquals("GATCAA", new String(Microhomology.reconstructDeletedSequence(1, "GACAA".getBytes(), "TT"))); assertEquals("GATCAA", new String(Microhomology.reconstructDeletedSequence(1, "GACAA".getBytes(), "AT"))); }