From bc983703202e76a8ba91f2e7f3b36d6d08865388 Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Thu, 16 Aug 2018 15:03:52 -0400 Subject: [PATCH] Mutect2: fixed bug with unpaired reads that pass all the M2 read filters and show evidence of a SNV (#5121) * fixed bug * added test --- .../tools/walkers/mutect/Mutect2Engine.java | 2 +- .../walkers/mutect/Mutect2IntegrationTest.java | 15 +++++++++++++++ .../broadinstitute/hellbender/tools/unpaired.bam | Bin 0 -> 8581 bytes .../hellbender/tools/unpaired.bam.bai | Bin 0 -> 2848 bytes 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 src/test/resources/org/broadinstitute/hellbender/tools/unpaired.bam create mode 100644 src/test/resources/org/broadinstitute/hellbender/tools/unpaired.bam.bai diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/mutect/Mutect2Engine.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/mutect/Mutect2Engine.java index 40aae82e6c0..4375fcd2b98 100644 --- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/mutect/Mutect2Engine.java +++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/mutect/Mutect2Engine.java @@ -309,7 +309,7 @@ private static List 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()); } diff --git a/src/test/java/org/broadinstitute/hellbender/tools/walkers/mutect/Mutect2IntegrationTest.java b/src/test/java/org/broadinstitute/hellbender/tools/walkers/mutect/Mutect2IntegrationTest.java index 08576deed9d..7df93f63b2c 100644 --- a/src/test/java/org/broadinstitute/hellbender/tools/walkers/mutect/Mutect2IntegrationTest.java +++ b/src/test/java/org/broadinstitute/hellbender/tools/walkers/mutect/Mutect2IntegrationTest.java @@ -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 diff --git a/src/test/resources/org/broadinstitute/hellbender/tools/unpaired.bam b/src/test/resources/org/broadinstitute/hellbender/tools/unpaired.bam new file mode 100644 index 0000000000000000000000000000000000000000..ea166f4d50c610717c4635104ce571726668cd80 GIT binary patch literal 8581 zcmZXaRZtvUlZFYwJp|9-0}Sr2gS)#2m*5Tw?(Xgmg9LYX2=4CgEFIVb;m|&E8ymH3A3x6U35Ixn4!TWSKY%4ClqL9hrCTI zHjme)2`N23KJIaa5rVSKz#Nkp_*7pvyWhTiaaM<&$H?0^6$B(%MrAo+z<{Oay5=O*AJ10>}S*)u%eRM zMKj@!)03OtNPe>kKCkC})e#+a)g~;FYI?4TS>o6MR3D2lKIbb5&R1 zc!6u63hRq7M({1Qv->z6y}ZmigtoY6N;bkoQmYXNp&Dy=Z<#_L3`^jfldIe?S(2$* zXxKVnisBJjOiLD<6~3;P=d@@wv+AwQw?$|sRg@00uK;?j0%PFi?o%a!4qKMF%ByjBwFVFH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X{_lSm|8f5XJ;Q>E literal 0 HcmV?d00001 diff --git a/src/test/resources/org/broadinstitute/hellbender/tools/unpaired.bam.bai b/src/test/resources/org/broadinstitute/hellbender/tools/unpaired.bam.bai new file mode 100644 index 0000000000000000000000000000000000000000..85a16628109d340ff1a1da212d44088e6d60cb17 GIT binary patch literal 2848 zcmZ>A^kigWU|;~@1;Pvrj6j-!L5~AWF=Q%&Xs<~Sd313@h$66F5HkX-8K!rXh6K-O lIE;n^C