From e41747a5e655c4d87cceb863bffb602c9cc68540 Mon Sep 17 00:00:00 2001 From: Ilya Soifer Date: Mon, 13 Nov 2023 20:05:38 +0200 Subject: [PATCH] Removes unnecessary and buggy validation check (#8580) * Additional fix + logging fixes * Added missing initialization --- .../haplotypecaller/AlleleFiltering.java | 2 +- .../hellbender/utils/read/FlowBasedRead.java | 17 +++-------------- .../utils/read/FlowBasedReadUtils.java | 2 +- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/AlleleFiltering.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/AlleleFiltering.java index 17728fa6035..ebc0f61d3f6 100644 --- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/AlleleFiltering.java +++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/AlleleFiltering.java @@ -340,7 +340,7 @@ private AlleleLikelihoods getAlleleLikelihoodMatrix(final Alle .forEach(alleleHaplotypeMap.get(notAllele)::add); final AlleleLikelihoods alleleLikelihoods = readLikelihoods.marginalize(alleleHaplotypeMap); - logger.debug(() -> String.format("GALM: %s %d %d", allele.toString(), alleleHaplotypeMap.get(allele).size(), alleleHaplotypeMap.get(notAllele).size())); + logger.debug(() -> String.format("GALM: %s %d %d", allele, alleleHaplotypeMap.get(allele.altAllele()).size(), alleleHaplotypeMap.get(notAllele).size())); return alleleLikelihoods; } diff --git a/src/main/java/org/broadinstitute/hellbender/utils/read/FlowBasedRead.java b/src/main/java/org/broadinstitute/hellbender/utils/read/FlowBasedRead.java index 75a30c2a8d3..273761b0318 100644 --- a/src/main/java/org/broadinstitute/hellbender/utils/read/FlowBasedRead.java +++ b/src/main/java/org/broadinstitute/hellbender/utils/read/FlowBasedRead.java @@ -41,7 +41,7 @@ public class FlowBasedRead extends SAMRecordToGATKReadAdapter implements GATKRea public static final int MAX_CLASS = 12; //note - this is a historical value to support files with max class is not defined in the header, it is expected that mc tag exists in the CRAM public static final String DEFAULT_FLOW_ORDER = "TGCA"; private static final long serialVersionUID = 42L; - private final Logger logger = LogManager.getLogger(this.getClass()); + private static final Logger logger = LogManager.getLogger(FlowBasedRead.class); private static final OneShotLogger vestigialOneShotLogger = new OneShotLogger(FlowBasedRead.class); // constants @@ -117,7 +117,7 @@ public class FlowBasedRead extends SAMRecordToGATKReadAdapter implements GATKRea * The validity status of the key. Certain operations may produce undefined/errornous results. This is signaled by * the read being marked with a validKey == false */ - private boolean validKey; + private boolean validKey = true; /** * The direction of this read. After being red, the direction will also swing to be REFERENCE @@ -248,7 +248,6 @@ public FlowBasedRead(final SAMRecord samRecord, final String flowOrder, final in logger.debug(" key: " + FlowBasedKeyCodec.keyAsString(key)); } - validateSequence(); } //since the last unclipped flow is uncertain (we give high probabilities to @@ -428,16 +427,6 @@ private int[] getAttributeAsIntArray(final String attributeName, final boolean i } } - - private void validateSequence(){ - for (final int b : key) { - if (b > maxHmer - 1) { - validKey = false; - } - } - validKey = true; - } - public boolean isValid() { return validKey; } @@ -584,6 +573,7 @@ public void applyBaseClipping(final int clipLeftBase, final int clipRightBase, b } else { applyClipping(clipLeft, leftHmerClip, clipRight, rightHmerClip, spread); baseClipped = true; + validKey = true; trimLeftBase = clipLeftBase; trimRightBase = clipRightBase; } @@ -1109,7 +1099,6 @@ private void readVestigialFlowMatrixFromKR(final String _flowOrder) { final double [] kdProbs = phredToProb(kd); fillFlowMatrix( kh, kf, kdProbs); applyFilteringFlowMatrix(); - validateSequence(); } } diff --git a/src/main/java/org/broadinstitute/hellbender/utils/read/FlowBasedReadUtils.java b/src/main/java/org/broadinstitute/hellbender/utils/read/FlowBasedReadUtils.java index d7a7a76faaf..ff009611521 100644 --- a/src/main/java/org/broadinstitute/hellbender/utils/read/FlowBasedReadUtils.java +++ b/src/main/java/org/broadinstitute/hellbender/utils/read/FlowBasedReadUtils.java @@ -303,7 +303,7 @@ public static int getMarkDupReadStart(final GATKRead gatkRead, final boolean end hmersLeft--; } - int hmerSize = 1; + int hmerSize = 1; for ( ; hmerSize < bases.length ; hmerSize++ ) if (bases[hmerSize] != hmerBase) { if ( --hmersLeft <= 0 )