Microhomology { @NotNull public static String microhomologyAtInsert(int position, @NotNull final String refSequence, @NotNull final String alt) { if (refSequence.length() < position) { LOGGER.warn("Attempt to determine microhomology outside of sequence length"); return Strings.EMPTY; } if (alt.contains(",")) { return Strings.EMPTY; } final String readSequence = refSequence.substring(0, position) + alt + refSequence.substring(position + 1); return microhomologyAtInsert(position, alt.length(), readSequence.getBytes()).toString(); } 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 testMicrohomologyOnInsert() { final String refSequence = "ATGCGATCTTCC"; assertEquals("TC", Microhomology.microhomologyAtInsert(7, refSequence, "CTC")); assertEquals("TT", Microhomology.microhomologyAtInsert(7, refSequence, "CTT")); assertEquals("", Microhomology.microhomologyAtInsert(7, refSequence, "CATG")); assertEquals("TT", Microhomology.microhomologyAtInsert(7, refSequence, "CTTA")); assertEquals("ATC", Microhomology.microhomologyAtInsert(4, refSequence, "GATCA")); assertEquals("ATC", Microhomology.microhomologyAtInsert(5, refSequence, "ATCAA")); assertEquals("ATC", Microhomology.microhomologyAtInsert(6, refSequence, "TCAAT")); assertEquals("ATC", Microhomology.microhomologyAtInsert(7, refSequence, "CAATC")); }
@Test public void testMicrohomologyOnInsertWithReadSequence() { final String readSequence = "ATGCGATCAATCTTCC"; assertEquals("ATC", Microhomology.microhomologyAtInsert(4, 5, readSequence.getBytes()).toString()); assertEquals("ATC", Microhomology.microhomologyAtInsert(5, 5, readSequence.getBytes()).toString()); assertEquals("ATC", Microhomology.microhomologyAtInsert(6, 5, readSequence.getBytes()).toString()); assertEquals("ATC", Microhomology.microhomologyAtInsert(7, 5, readSequence.getBytes()).toString()); }