From f092e1438d4385dc3b06b385cc0d64045a2e0748 Mon Sep 17 00:00:00 2001 From: Ron Levine Date: Fri, 6 Jan 2017 09:19:21 -0500 Subject: [PATCH] Allow disabling of BadMateFilter in HaplotypeCaller --- .../tools/walkers/haplotypecaller/HaplotypeCaller.java | 10 ++++++++-- .../HaplotypeCallerIntegrationTest.java | 7 ++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCaller.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCaller.java index 491abf6fc..8bf63f494 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCaller.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCaller.java @@ -530,7 +530,6 @@ public class HaplotypeCaller extends ActiveRegionWalker, In */ private static final int MINIMUM_PUTATIVE_PLOIDY_FOR_ACTIVE_REGION_DISCOVERY = 2; - /** * Reads with length lower than this number, after clipping off overhands outside the active region, * won't be considered for genotyping. @@ -550,6 +549,11 @@ public class HaplotypeCaller extends ActiveRegionWalker, In ReferenceConfidenceModel referenceConfidenceModel = null; + /* + * Is the bad mate filter disabled by the argument -drf BadMate? + */ + private boolean isBadMateFilterDisabled = false; + //////////////////////////////////////////////////////////////////////// //// Deprecated Arguments //// @@ -735,6 +739,8 @@ public class HaplotypeCaller extends ActiveRegionWalker, In trimmer.initialize(getToolkit().getGenomeLocParser(), HCAC.DEBUG, HCAC.genotypingOutputMode == GenotypingOutputMode.GENOTYPE_GIVEN_ALLELES,emitReferenceConfidence()); + + isBadMateFilterDisabled = toolkit.getArguments().disabledReadFilters.contains("BadMate"); } private void initializeReferenceConfidenceModel(final SampleList samples, final Set headerInfo) { @@ -1226,7 +1232,7 @@ public class HaplotypeCaller extends ActiveRegionWalker, In private Set filterNonPassingReads( final ActiveRegion activeRegion ) { final Set readsToRemove = new LinkedHashSet<>(); for( final GATKSAMRecord rec : activeRegion.getReads() ) { - if( rec.getReadLength() < READ_LENGTH_FILTER_THRESHOLD || rec.getMappingQuality() < READ_QUALITY_FILTER_THRESHOLD || BadMateFilter.hasBadMate(rec) || (keepRG != null && !rec.getReadGroup().getId().equals(keepRG)) ) { + if( rec.getReadLength() < READ_LENGTH_FILTER_THRESHOLD || rec.getMappingQuality() < READ_QUALITY_FILTER_THRESHOLD || (!isBadMateFilterDisabled && BadMateFilter.hasBadMate(rec)) || (keepRG != null && !rec.getReadGroup().getId().equals(keepRG)) ) { readsToRemove.add(rec); } } diff --git a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCallerIntegrationTest.java b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCallerIntegrationTest.java index 9cb90c06e..befb87b39 100644 --- a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCallerIntegrationTest.java +++ b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCallerIntegrationTest.java @@ -117,6 +117,11 @@ public class HaplotypeCallerIntegrationTest extends WalkerTest { HCTest(CEUTRIO_BAM, "", "ad472fbd63864caacf5bc018dcae9df9"); } + @Test + public void testHaplotypeCallerMultiSampleNoBadMateFilter() throws IOException { + HCTest(CEUTRIO_BAM, "-drf BadMate", "bb6b14675d62ff5b86430508ed688776"); + } + @Test public void testHaplotypeCallerSingleSample() throws IOException { @@ -471,7 +476,7 @@ public class HaplotypeCallerIntegrationTest extends WalkerTest { 1, UserException.CommandLineException.class)); } - @Test + @Test public void testHaplotypeCallerMergeVariantsViaLDException(){ executeTest("HaplotypeCallerMergeVariantsViaLDException", new WalkerTest.WalkerTestSpec(