Allele extends Locus { public Allele rightHardClip(final String pattern) throws IllegalSymbolException, IndexOutOfBoundsException, IllegalAlphabetException, AlleleException { int end = this.getEnd(); SymbolList copy = DNATools.createDNA(sequence.seqString()); while (copy.seqString().endsWith(pattern)) { copy.edit(new Edit(copy.length() - pattern.length() + 1, pattern.length(), SymbolList.EMPTY_LIST)); end -= pattern.length(); } return builder() .withContig(this.getContig()) .withStart(this.getStart()) .withEnd(end) .withSequence(copy) .withLesion(this.lesion) .build(); } Allele(final String name, final String contig, final int start, final int end, final SymbolList sequence, final Lesion lesion); String getName(); void setName(final String name); static Builder builder(); @Override boolean equals(final Object right); @Override int hashCode(); Allele doubleCrossover(final Allele right); Allele merge(final Allele right, final long minimumOverlap); Allele leftHardClip(final String pattern); Allele rightHardClip(final String pattern); final SymbolList sequence; final Lesion lesion; }
@Test public void testRightHardClip() throws IllegalAlphabetException, AlleleException, IllegalSymbolException { temp = allele4.rightHardClip("t"); assertEquals(temp.getStart(), 10); assertEquals(temp.getEnd(), 15); assertEquals(temp.sequence.seqString(), "aaaaa"); temp = allele4.rightHardClip("tt"); assertEquals(temp.getStart(), 10); assertEquals(temp.getEnd(), 16); assertEquals(temp.sequence.seqString(), "aaaaat"); temp = allele4.rightHardClip("ttttt"); assertEquals(temp.getStart(), 10); assertEquals(temp.getEnd(), 15); assertEquals(temp.sequence.seqString(), "aaaaa"); temp = allele4.rightHardClip("attttt"); assertEquals(temp.getStart(), 10); assertEquals(temp.getEnd(), 14); assertEquals(temp.sequence.seqString(), "aaaa"); temp = allele4.rightHardClip("aaaaa"); assertEquals(temp.getStart(), 10); assertEquals(temp.getEnd(), 20); assertEquals(temp.sequence.seqString(), "aaaaattttt"); }