public Allele doubleCrossover ( final Allele right ) throws IllegalSymbolException , IndexOutOfBoundsException , IllegalAlphabetException { if ( this . overlaps ( right ) ) { //System.out.println("this range" + this.toString() + " sequence = " + this.sequence.seqString() + "sequence length = " + sequence.length()); Locus homologue = intersection ( right ) ; //System.out.println("homologue = " + homologue); SymbolList copy = DNATools . createDNA ( this . sequence . seqString ( ) ) ; int length = homologue . getEnd ( ) - homologue . getStart ( ) ; int target = homologue . getStart ( ) - right . getStart ( ) + 1 ; int from = homologue . getStart ( ) - this . getStart ( ) + 1 ; //System.out.println("length = " + length); //System.out.println("target = " + target); //System.out.println("from = " + from); //System.out.println("copy = " + copy.seqString()); try { SymbolList replace = right . sequence . subList ( target , target + length - 1 ) ; //System.out.println("replace = " + replace.seqString()); copy . edit ( new Edit ( from , length , replace ) ) ; } catch ( ChangeVetoException e ) { //System.out.println("CHANGE VETO EXCEPTON" + e.getMessage()); } //System.out.println("CROSSEDOVER SEQUENCE = " + copy.seqString()); //copy.edit(new Edit()); //Sequence left = this.sequence.subList(0, homologue.getStart()); //Sequence middle = right.sequence.subList(homologue.getStart() - right.getStart(), i1); return new Allele ( this . name , this . contig , this . getStart ( ) , this . getEnd ( ) , copy , Lesion . UNKNOWN ) ; } return new Allele ( this . name , this . contig , this . getStart ( ) , this . getEnd ( ) , this . sequence , Lesion . UNKNOWN ) ; }
A method to simulate double crossover between Allele objects whereby the sequence from one allele is joined to the other within a specific region of overlap .