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.

This commit is contained in:
Eric Banks 2012-03-29 17:08:25 -04:00
parent e4469a83ee
commit c2e27729c7
4 changed files with 21 additions and 13 deletions

View File

@ -216,7 +216,7 @@ public class ConsensusAlleleCounter {
} }
} }
else if ( p.isBeforeDeletion() ) { else if ( p.isBeforeDeletedBase() ) {
indelString = String.format("D%d",p.getEventLength()); indelString = String.format("D%d",p.getEventLength());
int cnt = consensusIndelStrings.containsKey(indelString)? consensusIndelStrings.get(indelString):0; int cnt = consensusIndelStrings.containsKey(indelString)? consensusIndelStrings.get(indelString):0;
consensusIndelStrings.put(indelString,cnt+1); consensusIndelStrings.put(indelString,cnt+1);

View File

@ -208,7 +208,7 @@ public class SNPGenotypeLikelihoodsCalculationModel extends GenotypeLikelihoodsC
public class BAQedPileupElement extends PileupElement { public class BAQedPileupElement extends PileupElement {
public BAQedPileupElement( final PileupElement PE ) { 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 @Override

View File

@ -876,8 +876,8 @@ public abstract class AbstractReadBackedPileup<RBP extends AbstractReadBackedPil
@Override @Override
public int getNumberOfDeletionsAfterThisElement() { public int getNumberOfDeletionsAfterThisElement() {
int count = 0; int count = 0;
for (PileupElement p: this) { for (PileupElement p : this) {
if (p.isBeforeDeletion()) if (p.isBeforeDeletionStart())
count++; count++;
} }
return count; return count;
@ -886,7 +886,7 @@ public abstract class AbstractReadBackedPileup<RBP extends AbstractReadBackedPil
@Override @Override
public int getNumberOfInsertionsAfterThisElement() { public int getNumberOfInsertionsAfterThisElement() {
int count = 0; int count = 0;
for (PileupElement p: this) { for (PileupElement p : this) {
if (p.isBeforeInsertion()) if (p.isBeforeInsertion())
count++; count++;
} }

View File

@ -24,8 +24,8 @@ public class PileupElement implements Comparable<PileupElement> {
protected final GATKSAMRecord read; // the read this base belongs to 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 int offset; // the offset in the bases array for this base
protected final boolean isDeletion; // is this base a deletion 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 isBeforeDeletedBase; // 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 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 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 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 protected final boolean isNextToSoftClip; // is this base either before or after a soft clipped base
@ -59,8 +59,8 @@ public class PileupElement implements Comparable<PileupElement> {
this.read = read; this.read = read;
this.offset = offset; this.offset = offset;
this.isDeletion = isDeletion; this.isDeletion = isDeletion;
this.isBeforeDeletion = isBeforeDeletion; this.isBeforeDeletedBase = isBeforeDeletion;
this.isAfterDeletion = isAfterDeletion; this.isAfterDeletedBase = isAfterDeletion;
this.isBeforeInsertion = isBeforeInsertion; this.isBeforeInsertion = isBeforeInsertion;
this.isAfterInsertion = isAfterInsertion; this.isAfterInsertion = isAfterInsertion;
this.isNextToSoftClip = isNextToSoftClip; this.isNextToSoftClip = isNextToSoftClip;
@ -81,12 +81,20 @@ public class PileupElement implements Comparable<PileupElement> {
return isDeletion; return isDeletion;
} }
public boolean isBeforeDeletion() { public boolean isBeforeDeletedBase() {
return isBeforeDeletion; return isBeforeDeletedBase;
} }
public boolean isAfterDeletion() { public boolean isAfterDeletedBase() {
return isAfterDeletion; return isAfterDeletedBase;
}
public boolean isBeforeDeletionStart() {
return isBeforeDeletedBase && !isDeletion;
}
public boolean isAfterDeletionEnd() {
return isAfterDeletedBase && !isDeletion;
} }
public boolean isBeforeInsertion() { public boolean isBeforeInsertion() {