From 611a395783c861f70b25157368045ffb257e762b Mon Sep 17 00:00:00 2001 From: Ryan Poplin Date: Sat, 5 Nov 2011 12:18:56 -0400 Subject: [PATCH] Now properly extending candidate haplotypes with bases from the reference context instead of filling with padding bases. Functionality in the private Haplotype class is no longer necessary so removing it. No need to have four different Haplotype classes in the GATK. --- .../gatk/walkers/annotator/HaplotypeScore.java | 10 +++++----- .../indels/HaplotypeIndelErrorModel.java | 18 +++++++++--------- .../walkers/indels/PairHMMIndelErrorModel.java | 4 ++-- .../broadinstitute/sting/utils/Haplotype.java | 12 ++++++++---- 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HaplotypeScore.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HaplotypeScore.java index c142109fa..803bf514c 100644 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HaplotypeScore.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HaplotypeScore.java @@ -180,12 +180,12 @@ public class HaplotypeScore extends InfoFieldAnnotation implements StandardAnnot final Haplotype haplotype1 = consensusHaplotypeQueue.poll(); Listhlist = new ArrayList(); - hlist.add(new Haplotype(haplotype1.getBasesAsBytes(), 60)); + hlist.add(new Haplotype(haplotype1.getBases(), 60)); for (int k=1; k < haplotypesToCompute; k++) { Haplotype haplotype2 = consensusHaplotypeQueue.poll(); if(haplotype2 == null ) { haplotype2 = haplotype1; } // Sometimes only the reference haplotype can be found - hlist.add(new Haplotype(haplotype2.getBasesAsBytes(), 20)); + hlist.add(new Haplotype(haplotype2.getBases(), 20)); } return hlist; } else @@ -229,8 +229,8 @@ public class HaplotypeScore extends InfoFieldAnnotation implements StandardAnnot } private Haplotype getConsensusHaplotype(final Haplotype haplotypeA, final Haplotype haplotypeB) { - final byte[] a = haplotypeA.getBasesAsBytes(); - final byte[] b = haplotypeB.getBasesAsBytes(); + final byte[] a = haplotypeA.getBases(); + final byte[] b = haplotypeB.getBases(); if (a.length != b.length) { throw new ReviewedStingException("Haplotypes a and b must be of same length"); @@ -313,7 +313,7 @@ public class HaplotypeScore extends InfoFieldAnnotation implements StandardAnnot // actually be a miscall in a matching direction, which would happen at a e / 3 rate. If b != c, then // the chance that it is actually a mismatch is 1 - e, since any of the other 3 options would be a mismatch. // so the probability-weighted mismatch rate is sum_i ( matched ? e_i / 3 : 1 - e_i ) for i = 1 ... n - final byte[] haplotypeBases = haplotype.getBasesAsBytes(); + final byte[] haplotypeBases = haplotype.getBases(); final SAMRecord read = p.getRead(); byte[] readBases = read.getReadBases(); diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/indels/HaplotypeIndelErrorModel.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/indels/HaplotypeIndelErrorModel.java index 3b3f54b05..200a250f2 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/indels/HaplotypeIndelErrorModel.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/indels/HaplotypeIndelErrorModel.java @@ -205,7 +205,7 @@ public class HaplotypeIndelErrorModel { byte haplotypeBase; if (haplotypeIndex < RIGHT_ALIGN_INDEX) - haplotypeBase = haplotype.getBasesAsBytes()[haplotypeIndex]; + haplotypeBase = haplotype.getBases()[haplotypeIndex]; else haplotypeBase = (byte)0; // dummy @@ -217,7 +217,7 @@ public class HaplotypeIndelErrorModel { if (readQual > 3) pRead += pBaseRead; haplotypeIndex++; - if (haplotypeIndex >= haplotype.getBasesAsBytes().length) + if (haplotypeIndex >= haplotype.getBases().length) haplotypeIndex = RIGHT_ALIGN_INDEX; //System.out.format("H:%c R:%c RQ:%d HI:%d %4.5f %4.5f\n", haplotypeBase, readBase, (int)readQual, haplotypeIndex, pBaseRead, pRead); } @@ -227,8 +227,8 @@ public class HaplotypeIndelErrorModel { System.out.println(read.getReadName()); System.out.print("Haplotype:"); - for (int k=0; k LEFT_ALIGN_INDEX && indX < RIGHT_ALIGN_INDEX) - haplotypeBase = haplotype.getBasesAsBytes()[indX-1]; + haplotypeBase = haplotype.getBases()[indX-1]; else haplotypeBase = readBase; @@ -296,8 +296,8 @@ public class HaplotypeIndelErrorModel { System.out.println(read.getReadName()); System.out.print("Haplotype:"); - for (int k=0; k