MixedSomaticGermlineDedup extends BufferedPostProcessor { static int codonDifferences(@NotNull final GenomeRegion codon, @NotNull final VariantHotspot variant) { if (codon.start() > variant.end() || variant.position() > codon.end()) { return 0; } int overlapStart = (int) Math.max(codon.start(), variant.position()); int overlapEnd = (int) Math.min(codon.end(), variant.end()); int difference = 0; for (int position = overlapStart; position <= overlapEnd; position++) { int variantIndex = (int) (position - variant.position()); if (variant.ref().charAt(variantIndex) != variant.alt().charAt(variantIndex)) { difference++; } } return difference; } MixedSomaticGermlineDedup(final Consumer<SageVariant> consumer, final List<HmfTranscriptRegion> transcripts);   }
@Test public void testCodonDifferences() { final GenomeRegion codon = GenomeRegions.create("1", 100, 102); final VariantHotspot snvBefore = create(99, "A", "T"); final VariantHotspot snvOne = create(100, "A", "T"); final VariantHotspot snvTwo = create(101, "A", "T"); final VariantHotspot snvThree = create(102, "A", "T"); final VariantHotspot snvAfter = create(103, "A", "T"); assertEquals(0, codonDifferences(codon, snvBefore)); assertEquals(0, codonDifferences(codon, snvAfter)); assertEquals(1, codonDifferences(codon, snvOne)); assertEquals(1, codonDifferences(codon, snvTwo)); assertEquals(1, codonDifferences(codon, snvThree)); assertEquals(1, codonDifferences(codon, create(102, "AA", "TT"))); assertEquals(1, codonDifferences(codon, create(101, "AAA", "TAT"))); assertEquals(2, codonDifferences(codon, create(100, "AAA", "TAT"))); assertEquals(3, codonDifferences(codon, create(100, "AAA", "TTT"))); }