From 8623830267b2bb89c07d1d7eda27e665189a02eb Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Thu, 31 Mar 2016 22:46:42 -0400 Subject: [PATCH] Fixed bug in which consecutive SPAN_DELS were merged into a ** MNP.# --- .../tools/walkers/phasing/PhasingUtils.java | 4 ++-- .../ReadBackedPhasingIntegrationTest.java | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/phasing/PhasingUtils.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/phasing/PhasingUtils.java index 6d66dc015..8dbf65730 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/phasing/PhasingUtils.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/phasing/PhasingUtils.java @@ -297,8 +297,8 @@ class PhasingUtils { */ static boolean mergeIntoMNPvalidationCheck(GenomeLocParser genomeLocParser, VariantContext vc1, VariantContext vc2) { // Can only merge "simple" base strings (i.e., SNPs or MNPs, but not indels): - final boolean vc1CanBeMerged = vc1.isSNP() || vc1.isMNP(); - final boolean vc2CanBeMerged = vc2.isSNP() || vc2.isMNP(); + final boolean vc1CanBeMerged = (vc1.isSNP() || vc1.isMNP()) && !vc1.hasAllele(Allele.SPAN_DEL); + final boolean vc2CanBeMerged = (vc2.isSNP() || vc2.isMNP()) && !vc2.hasAllele(Allele.SPAN_DEL); if (!vc1CanBeMerged || !vc2CanBeMerged) return false; diff --git a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/phasing/ReadBackedPhasingIntegrationTest.java b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/phasing/ReadBackedPhasingIntegrationTest.java index 9dfc49913..7539b23e2 100644 --- a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/phasing/ReadBackedPhasingIntegrationTest.java +++ b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/phasing/ReadBackedPhasingIntegrationTest.java @@ -70,7 +70,6 @@ public class ReadBackedPhasingIntegrationTest extends WalkerTest { " --no_cmdline_in_header"; } - @Test public void test1() { WalkerTestSpec spec = new WalkerTestSpec( @@ -170,4 +169,22 @@ public class ReadBackedPhasingIntegrationTest extends WalkerTest { Arrays.asList("630816da701b9ea8674c23c91fa61bec")); executeTest("Merge SNPs if on the same read", spec); } + + @Test + public void testDontMergeSpanningDeletions() { + WalkerTestSpec spec = new WalkerTestSpec( + "-T ReadBackedPhasing" + + " -R " + b37KGReferenceWithDecoy + + " -I " + privateTestDir + "phasing_test_with_span_del_1.bam" + + " -I " + privateTestDir + "phasing_test_with_span_del_2.bam" + + " -I " + privateTestDir + "phasing_test_with_span_del_3.bam" + + " -I " + privateTestDir + "phasing_test_with_span_del_4.bam" + + " --variant " + privateTestDir + "phasing_test_with_span_del.vcf" + + " -enableMergeToMNP" + + " -o %s" + + " --no_cmdline_in_header", + 1, + Arrays.asList("b334de5ad35665f0d65034197ac05b32")); + executeTest("Don't merge symbolic SPAN_DEL (*) alleles (into the nonexistent ** MNP).", spec); + } }