From 5dd811f84a060d39a37d969f36660c258d1577b7 Mon Sep 17 00:00:00 2001 From: Ryan Poplin Date: Wed, 30 May 2012 15:07:01 -0400 Subject: [PATCH] Adding genotype given alleles mode to the HaplotypeCaller. --- .../src/org/broadinstitute/sting/utils/Haplotype.java | 8 ++++---- .../org/broadinstitute/sting/utils/HaplotypeUnitTest.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/public/java/src/org/broadinstitute/sting/utils/Haplotype.java b/public/java/src/org/broadinstitute/sting/utils/Haplotype.java index 03c7d279b..cadec5347 100755 --- a/public/java/src/org/broadinstitute/sting/utils/Haplotype.java +++ b/public/java/src/org/broadinstitute/sting/utils/Haplotype.java @@ -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 makeHaplotypeListFromAlleles(List alleleList, int startPos, ReferenceContext ref, diff --git a/public/java/test/org/broadinstitute/sting/utils/HaplotypeUnitTest.java b/public/java/test/org/broadinstitute/sting/utils/HaplotypeUnitTest.java index 87852f9ca..ec08d97c5 100644 --- a/public/java/test/org/broadinstitute/sting/utils/HaplotypeUnitTest.java +++ b/public/java/test/org/broadinstitute/sting/utils/HaplotypeUnitTest.java @@ -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); }