Skip to content

Commit

Permalink
Mutect2: fixed bug with unpaired reads that pass all the M2 read filt…
Browse files Browse the repository at this point in the history
…ers and show evidence of a SNV (#5121)

* fixed bug
* added test
  • Loading branch information
davidbenjamin authored and droazen committed Aug 16, 2018
1 parent df3fb9d commit bc98370
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ private static List<Byte> altQuals(final ReadPileup pileup, final byte refBase,
result.add(indelQual(1));
} else if (pe.getBase() != refBase && pe.getQual() > MINIMUM_BASE_QUALITY) {
final GATKRead read = pe.getRead();
final int mateStart = read.mateIsUnmapped() ? Integer.MAX_VALUE : read.getMateStart();
final int mateStart = (!read.isProperlyPaired() || read.mateIsUnmapped()) ? Integer.MAX_VALUE : read.getMateStart();
final boolean overlapsMate = mateStart <= position && position < mateStart + read.getLength();
result.add(overlapsMate ? (byte) FastMath.min(pe.getQual(), pcrErrorQual/2) : pe.getQual());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,21 @@ public void testReadsThatConsumeZeroReferenceReads() throws Exception {
runCommandLine(args);
}

// make sure that unpaired reads that pass filtering do not cause errors
// in particular, the read HAVCYADXX150109:1:1109:11610:46575 with SAM flag 16 fails without the patch
@Test
public void testUnpairedReads() throws Exception {
final String bamWithUnpairedReads = toolsTestDir + "unpaired.bam";
final File outputVcf = createTempFile("output", ".vcf");
final String[] args = {
"-I", bamWithUnpairedReads,
"-" + M2ArgumentCollection.TUMOR_SAMPLE_SHORT_NAME, "SM-612V3",
"-R", b37_reference_20_21,
"-O", outputVcf.getAbsolutePath()
};
runCommandLine(args);
}

// some bams from external pipelines use faulty adapter trimming programs that introduce identical repeated reads
// into bams. Although these bams fail the Picard tool ValidateSamFile, one can run HaplotypeCaller and Mutect on them
// and get fine results. This test ensures that this remains the case. The test bam is a small chunk of reads surrounding
Expand Down
Binary file not shown.
Binary file not shown.

0 comments on commit bc98370

Please sign in to comment.