Allele extends Locus { public Allele leftHardClip(final String pattern) throws IllegalAlphabetException, AlleleException, IllegalSymbolException { int start = this.getStart(); SymbolList copy = DNATools.createDNA(sequence.seqString()); while (copy.seqString().startsWith(pattern)) { copy.edit(new Edit(1, pattern.length(), SymbolList.EMPTY_LIST)); start += pattern.length(); } return builder() .withContig(this.getContig()) .withStart(start) .withEnd(this.getEnd()) .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 testLeftHardClip() throws IllegalSymbolException, IndexOutOfBoundsException, IllegalAlphabetException, AlleleException { temp = allele4.leftHardClip("a"); assertEquals(temp.getStart(), 15); assertEquals(temp.getEnd(), 20); assertEquals(temp.sequence.seqString(), "ttttt"); temp = allele4.leftHardClip("aa"); assertEquals(temp.getStart(), 14); assertEquals(temp.getEnd(), 20); assertEquals(temp.sequence.seqString(), "attttt"); temp = allele4.leftHardClip("aaaaa"); assertEquals(temp.getStart(), 15); assertEquals(temp.getEnd(), 20); assertEquals(temp.sequence.seqString(), "ttttt"); temp = allele4.leftHardClip("aaaaat"); assertEquals(temp.getStart(), 16); assertEquals(temp.getEnd(), 20); assertEquals(temp.sequence.seqString(), "tttt"); temp = allele4.leftHardClip("ttttt"); assertEquals(temp.getStart(), 10); assertEquals(temp.getEnd(), 20); assertEquals(temp.sequence.seqString(), "aaaaattttt"); }