Skip to content

Commit bc98370

Browse files
davidbenjamindroazen
authored andcommitted
Mutect2: fixed bug with unpaired reads that pass all the M2 read filters and show evidence of a SNV (#5121)
* fixed bug * added test
1 parent df3fb9d commit bc98370

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

src/main/java/org/broadinstitute/hellbender/tools/walkers/mutect/Mutect2Engine.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ private static List<Byte> altQuals(final ReadPileup pileup, final byte refBase,
309309
result.add(indelQual(1));
310310
} else if (pe.getBase() != refBase && pe.getQual() > MINIMUM_BASE_QUALITY) {
311311
final GATKRead read = pe.getRead();
312-
final int mateStart = read.mateIsUnmapped() ? Integer.MAX_VALUE : read.getMateStart();
312+
final int mateStart = (!read.isProperlyPaired() || read.mateIsUnmapped()) ? Integer.MAX_VALUE : read.getMateStart();
313313
final boolean overlapsMate = mateStart <= position && position < mateStart + read.getLength();
314314
result.add(overlapsMate ? (byte) FastMath.min(pe.getQual(), pcrErrorQual/2) : pe.getQual());
315315
}

src/test/java/org/broadinstitute/hellbender/tools/walkers/mutect/Mutect2IntegrationTest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,21 @@ public void testReadsThatConsumeZeroReferenceReads() throws Exception {
403403
runCommandLine(args);
404404
}
405405

406+
// make sure that unpaired reads that pass filtering do not cause errors
407+
// in particular, the read HAVCYADXX150109:1:1109:11610:46575 with SAM flag 16 fails without the patch
408+
@Test
409+
public void testUnpairedReads() throws Exception {
410+
final String bamWithUnpairedReads = toolsTestDir + "unpaired.bam";
411+
final File outputVcf = createTempFile("output", ".vcf");
412+
final String[] args = {
413+
"-I", bamWithUnpairedReads,
414+
"-" + M2ArgumentCollection.TUMOR_SAMPLE_SHORT_NAME, "SM-612V3",
415+
"-R", b37_reference_20_21,
416+
"-O", outputVcf.getAbsolutePath()
417+
};
418+
runCommandLine(args);
419+
}
420+
406421
// some bams from external pipelines use faulty adapter trimming programs that introduce identical repeated reads
407422
// into bams. Although these bams fail the Picard tool ValidateSamFile, one can run HaplotypeCaller and Mutect on them
408423
// and get fine results. This test ensures that this remains the case. The test bam is a small chunk of reads surrounding
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)