public Allele merge ( final Allele right , final long minimumOverlap ) throws IllegalSymbolException , IndexOutOfBoundsException , IllegalAlphabetException , AlleleException { Allele . Builder builder = Allele . builder ( ) ; Locus overlap = intersection ( right ) ; // System.out.println("overlap = " + overlap); // System.out.println("overlap.length() " + overlap.length() + " < " + startimumOverlap + "??"); if ( overlap . length ( ) < minimumOverlap ) { return builder . reset ( ) . build ( ) ; } Allele bit = builder . withContig ( overlap . getContig ( ) ) . withStart ( overlap . getStart ( ) ) . withEnd ( overlap . getEnd ( ) ) . withSequence ( SymbolList . EMPTY_LIST ) . withLesion ( Lesion . UNKNOWN ) . build ( ) ; // System.out.println("bit = " + bit + " " + bit.sequence.seqString()); Allele a = bit . doubleCrossover ( right ) ; // System.out.println("a = " + a + " " + a.sequence.seqString()); Allele b = bit . doubleCrossover ( this ) ; // System.out.println("b = " + b + " " + b.sequence.seqString()); if ( a . sequence . seqString ( ) . equals ( b . sequence . seqString ( ) ) ) { Locus union = union ( right ) ; return builder . withName ( right . getName ( ) ) . withContig ( union . getContig ( ) ) . withStart ( union . getStart ( ) ) . withEnd ( union . getEnd ( ) ) . withSequence ( SymbolList . EMPTY_LIST ) . withLesion ( Lesion . UNKNOWN ) . build ( ) . doubleCrossover ( right ) . doubleCrossover ( this ) ; } return builder . reset ( ) . build ( ) ; }
A method to simulate merging of two alleles strictly meaning the sequence in the overlapping regions must be equal .