Skip to content

Commit

Permalink
Removes unnecessary and buggy validation check (#8580)
Browse files Browse the repository at this point in the history
* Additional fix + logging fixes
* Added missing initialization
  • Loading branch information
ilyasoifer committed Nov 13, 2023
1 parent 683eaa8 commit e6e4dea
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ private AlleleLikelihoods<GATKRead, Allele> getAlleleLikelihoodMatrix(final Alle
.forEach(alleleHaplotypeMap.get(notAllele)::add);

final AlleleLikelihoods<GATKRead, Allele> 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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -1109,7 +1099,6 @@ private void readVestigialFlowMatrixFromKR(final String _flowOrder) {
final double [] kdProbs = phredToProb(kd);
fillFlowMatrix( kh, kf, kdProbs);
applyFilteringFlowMatrix();
validateSequence();
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down

0 comments on commit e6e4dea

Please sign in to comment.