Adding genotype given alleles mode to the HaplotypeCaller.
This commit is contained in:
parent
f987d5487e
commit
5dd811f84a
|
|
@ -158,12 +158,12 @@ public class Haplotype {
|
|||
}
|
||||
|
||||
@Requires({"refInsertLocation >= 0"})
|
||||
public byte[] insertAllele( final Allele refAllele, final Allele altAllele, int refInsertLocation ) {
|
||||
public Haplotype insertAllele( final Allele refAllele, final Allele altAllele, int refInsertLocation ) {
|
||||
|
||||
if( refAllele.length() != altAllele.length() ) { refInsertLocation++; }
|
||||
int haplotypeInsertLocation = ReadUtils.getReadCoordinateForReferenceCoordinate(alignmentStartHapwrtRef, cigar, refInsertLocation, ReadUtils.ClippingTail.RIGHT_TAIL, true);
|
||||
if( haplotypeInsertLocation == -1 ) { // desired change falls inside deletion so don't bother creating a new haplotype
|
||||
return bases.clone();
|
||||
return new Haplotype(bases.clone());
|
||||
}
|
||||
byte[] newHaplotype;
|
||||
|
||||
|
|
@ -196,10 +196,10 @@ public class Haplotype {
|
|||
}
|
||||
}
|
||||
} catch (Exception e) { // event already on haplotype is too large/complex to insert another allele, most likely because of not enough reference padding
|
||||
return bases.clone();
|
||||
return new Haplotype(bases.clone());
|
||||
}
|
||||
|
||||
return newHaplotype;
|
||||
return new Haplotype(newHaplotype);
|
||||
}
|
||||
|
||||
public static LinkedHashMap<Allele,Haplotype> makeHaplotypeListFromAlleles(List<Allele> alleleList, int startPos, ReferenceContext ref,
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ public class HaplotypeUnitTest extends BaseTest {
|
|||
final Allele h1altAllele = Allele.create(alt, false);
|
||||
h.setAlignmentStartHapwrtRef(0);
|
||||
h.setCigar(cigar);
|
||||
final Haplotype h1 = new Haplotype( h.insertAllele(h1refAllele, h1altAllele, loc - INDEL_PADDING_BASE) );
|
||||
final Haplotype h1 = h.insertAllele(h1refAllele, h1altAllele, loc - INDEL_PADDING_BASE);
|
||||
final Haplotype h1expected = new Haplotype(newHap.getBytes());
|
||||
Assert.assertEquals(h1, h1expected);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue