From c2e27729c79801afdcfd5e070e4bc5309f75b370 Mon Sep 17 00:00:00 2001 From: Eric Banks Date: Thu, 29 Mar 2012 17:08:25 -0400 Subject: [PATCH] Renaming PileupElement.isBeforeDeletion() to PileupElement.isBeforeDeletedBase() so that it's more clear that it can still be true while inside a deletion. Added PileupElement.isBeforeDeletionStart() to cover the case that I want where we only trigger before the actual deletion event. Similarly for after a deletion. Updated counting code in ConsensusAlleleCounter accordingly. --- .../genotyper/ConsensusAlleleCounter.java | 2 +- ...NPGenotypeLikelihoodsCalculationModel.java | 2 +- .../pileup/AbstractReadBackedPileup.java | 6 ++--- .../sting/utils/pileup/PileupElement.java | 24 ++++++++++++------- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/ConsensusAlleleCounter.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/ConsensusAlleleCounter.java index 2999c5249..c25517927 100644 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/ConsensusAlleleCounter.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/ConsensusAlleleCounter.java @@ -216,7 +216,7 @@ public class ConsensusAlleleCounter { } } - else if ( p.isBeforeDeletion() ) { + else if ( p.isBeforeDeletedBase() ) { indelString = String.format("D%d",p.getEventLength()); int cnt = consensusIndelStrings.containsKey(indelString)? consensusIndelStrings.get(indelString):0; consensusIndelStrings.put(indelString,cnt+1); diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/SNPGenotypeLikelihoodsCalculationModel.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/SNPGenotypeLikelihoodsCalculationModel.java index b787f8546..effcc39f0 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/SNPGenotypeLikelihoodsCalculationModel.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/SNPGenotypeLikelihoodsCalculationModel.java @@ -208,7 +208,7 @@ public class SNPGenotypeLikelihoodsCalculationModel extends GenotypeLikelihoodsC public class BAQedPileupElement extends PileupElement { public BAQedPileupElement( final PileupElement PE ) { - super(PE.getRead(), PE.getOffset(), PE.isDeletion(), PE.isBeforeDeletion(), PE.isAfterDeletion(), PE.isBeforeInsertion(), PE.isAfterInsertion(), PE.isNextToSoftClip()); + super(PE.getRead(), PE.getOffset(), PE.isDeletion(), PE.isBeforeDeletedBase(), PE.isAfterDeletedBase(), PE.isBeforeInsertion(), PE.isAfterInsertion(), PE.isNextToSoftClip()); } @Override diff --git a/public/java/src/org/broadinstitute/sting/utils/pileup/AbstractReadBackedPileup.java b/public/java/src/org/broadinstitute/sting/utils/pileup/AbstractReadBackedPileup.java index 5a7e0f1c5..ea6901bb3 100644 --- a/public/java/src/org/broadinstitute/sting/utils/pileup/AbstractReadBackedPileup.java +++ b/public/java/src/org/broadinstitute/sting/utils/pileup/AbstractReadBackedPileup.java @@ -876,8 +876,8 @@ public abstract class AbstractReadBackedPileup { protected final GATKSAMRecord read; // the read this base belongs to protected final int offset; // the offset in the bases array for this base protected final boolean isDeletion; // is this base a deletion - protected final boolean isBeforeDeletion; // is the base to the right of this base an deletion - protected final boolean isAfterDeletion; // is the base to the left of this base a deletion + protected final boolean isBeforeDeletedBase; // is the base to the right of this base an deletion + protected final boolean isAfterDeletedBase; // is the base to the left of this base a deletion protected final boolean isBeforeInsertion; // is the base to the right of this base an insertion protected final boolean isAfterInsertion; // is the base to the left of this base an insertion protected final boolean isNextToSoftClip; // is this base either before or after a soft clipped base @@ -59,8 +59,8 @@ public class PileupElement implements Comparable { this.read = read; this.offset = offset; this.isDeletion = isDeletion; - this.isBeforeDeletion = isBeforeDeletion; - this.isAfterDeletion = isAfterDeletion; + this.isBeforeDeletedBase = isBeforeDeletion; + this.isAfterDeletedBase = isAfterDeletion; this.isBeforeInsertion = isBeforeInsertion; this.isAfterInsertion = isAfterInsertion; this.isNextToSoftClip = isNextToSoftClip; @@ -81,12 +81,20 @@ public class PileupElement implements Comparable { return isDeletion; } - public boolean isBeforeDeletion() { - return isBeforeDeletion; + public boolean isBeforeDeletedBase() { + return isBeforeDeletedBase; } - public boolean isAfterDeletion() { - return isAfterDeletion; + public boolean isAfterDeletedBase() { + return isAfterDeletedBase; + } + + public boolean isBeforeDeletionStart() { + return isBeforeDeletedBase && !isDeletion; + } + + public boolean isAfterDeletionEnd() { + return isAfterDeletedBase && !isDeletion; } public boolean isBeforeInsertion() {