diff --git a/.travis.yml b/.travis.yml index 86264d80b6e..34f82892f7a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,7 @@ env: - TEST_TYPE=cloud UPLOAD=true - TEST_TYPE=integration TEST_DOCKER=true TEST_VERBOSITY=minimal - TEST_TYPE=unit TEST_DOCKER=true TEST_VERBOSITY=minimal + - TEST_TYPE=variantcalling TEST_DOCKER=true TEST_VERBOSITY=minimal - TEST_TYPE=python TEST_DOCKER=true TEST_VERBOSITY=minimal - RUN_CNV_GERMLINE_WDL=true - RUN_CNV_SOMATIC_WDL=true diff --git a/build.gradle b/build.gradle index a80a2d11a76..ece53e63269 100644 --- a/build.gradle +++ b/build.gradle @@ -408,13 +408,16 @@ test { includeGroups 'cloud', 'bucket' } else if (TEST_TYPE == "integration"){ include "**/*IntegrationTest.class" - excludeGroups "cloud", "bucket", "python", "funcotatorValidation" + excludeGroups "cloud", "bucket", "python", "funcotatorValidation", "variantcalling" } else if (TEST_TYPE == "unit") { exclude "**/*IntegrationTest.class" + excludeGroups "cloud", "bucket", "python", "funcotatorValidation", "variantcalling" + } else if (TEST_TYPE == "variantcalling") { + includeGroups "variantcalling" excludeGroups "cloud", "bucket", "python", "funcotatorValidation" } else if (TEST_TYPE == "spark") { includeGroups "spark" - excludeGroups "cloud", "bucket", "python", "funcotatorValidation" + excludeGroups "cloud", "bucket", "python", "funcotatorValidation", "variantcalling" } else if (TEST_TYPE == "python") { includeGroups "python" } else if (TEST_TYPE == "all"){ diff --git a/src/test/java/org/broadinstitute/hellbender/tools/HaplotypeCallerSparkIntegrationTest.java b/src/test/java/org/broadinstitute/hellbender/tools/HaplotypeCallerSparkIntegrationTest.java index 4124dc76207..8e8631314a3 100644 --- a/src/test/java/org/broadinstitute/hellbender/tools/HaplotypeCallerSparkIntegrationTest.java +++ b/src/test/java/org/broadinstitute/hellbender/tools/HaplotypeCallerSparkIntegrationTest.java @@ -24,6 +24,7 @@ import org.broadinstitute.hellbender.tools.walkers.haplotypecaller.HaplotypeCallerIntegrationTest; +@Test(groups = {"variantcalling"}) public class HaplotypeCallerSparkIntegrationTest extends CommandLineProgramTest { private static final String TEST_FILES_DIR = toolsTestDir + "haplotypecaller/"; diff --git a/src/test/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/HaplotypeCallerIntegrationTest.java b/src/test/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/HaplotypeCallerIntegrationTest.java index 690df5ff5e7..3378734d686 100644 --- a/src/test/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/HaplotypeCallerIntegrationTest.java +++ b/src/test/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/HaplotypeCallerIntegrationTest.java @@ -44,6 +44,7 @@ import java.util.stream.Collectors; import java.util.stream.StreamSupport; +@Test(groups = {"variantcalling"}) public class HaplotypeCallerIntegrationTest extends CommandLineProgramTest { public static final String TEST_FILES_DIR = toolsTestDir + "haplotypecaller/"; @@ -398,7 +399,7 @@ public void testBamoutOnGcs() { innerTestBamoutProducesReasonablySizedOutput(bamOutput); } - public void innerTestBamoutProducesReasonablySizedOutput(Path bamOutput) { + private void innerTestBamoutProducesReasonablySizedOutput(Path bamOutput) { Utils.resetRandomGenerator(); // We will test that when running with -bamout over the testInterval, we produce @@ -767,7 +768,50 @@ public void testMnps() throws Exception { "-" + HaplotypeCallerArgumentCollection.MAX_MNP_DISTANCE_SHORT_NAME, Integer.toString(maxMnpDistance)); runCommandLine(args); - Mutect2IntegrationTest.checkMnpOutput(maxMnpDistance, outputVcf); + checkMnpOutput(maxMnpDistance, outputVcf); + } + } + + // this is particular to our particular artificial MNP bam -- we extract a method in order to use it for HaplotypeCaller + private static void checkMnpOutput(int maxMnpDistance, File outputVcf) { + // note that for testing HaplotypeCaller GVCF mode we will always have the symbolic allele + final Map> alleles = StreamSupport.stream(new FeatureDataSource(outputVcf).spliterator(), false) + .collect(Collectors.toMap(VariantContext::getStart, vc -> vc.getAlternateAlleles().stream().filter(a -> !a.isSymbolic()).map(Allele::getBaseString).collect(Collectors.toList()))); + + // phased, two bases apart + if (maxMnpDistance < 2) { + Assert.assertEquals(alleles.get(10019968), Arrays.asList("G")); + Assert.assertEquals(alleles.get(10019970), Arrays.asList("G")); + } else { + Assert.assertEquals(alleles.get(10019968), Arrays.asList("GAG")); + Assert.assertTrue(!alleles.containsKey(10019970)); + } + + // adjacent and out of phase + Assert.assertEquals(alleles.get(10020229), Arrays.asList("A")); + Assert.assertEquals(alleles.get(10020230), Arrays.asList("G")); + + // 4-substitution MNP w/ spacings 2, 3, 4 + if (maxMnpDistance < 2) { + Assert.assertEquals(alleles.get(10020430), Arrays.asList("G")); + Assert.assertEquals(alleles.get(10020432), Arrays.asList("G")); + Assert.assertEquals(alleles.get(10020435), Arrays.asList("G")); + Assert.assertEquals(alleles.get(10020439), Arrays.asList("G")); + } else if (maxMnpDistance < 3) { + Assert.assertEquals(alleles.get(10020430), Arrays.asList("GAG")); + Assert.assertEquals(alleles.get(10020435), Arrays.asList("G")); + Assert.assertEquals(alleles.get(10020439), Arrays.asList("G")); + } else if (maxMnpDistance < 4) { + Assert.assertEquals(alleles.get(10020430), Arrays.asList("GAGTTG")); + Assert.assertEquals(alleles.get(10020439), Arrays.asList("G")); + } else { + Assert.assertEquals(alleles.get(10020430), Arrays.asList("GAGTTGTCTG")); + } + + // two out of phase DNPs that overlap and have a base in common + if (maxMnpDistance > 0) { + Assert.assertEquals(alleles.get(10020680), Arrays.asList("TA")); + Assert.assertEquals(alleles.get(10020681), Arrays.asList("AT")); } } diff --git a/src/test/java/org/broadinstitute/hellbender/tools/walkers/mutect/CreateSomaticPanelOfNormalsIntegrationTest.java b/src/test/java/org/broadinstitute/hellbender/tools/walkers/mutect/CreateSomaticPanelOfNormalsIntegrationTest.java index d5ce3c8560c..04af47d2e6a 100644 --- a/src/test/java/org/broadinstitute/hellbender/tools/walkers/mutect/CreateSomaticPanelOfNormalsIntegrationTest.java +++ b/src/test/java/org/broadinstitute/hellbender/tools/walkers/mutect/CreateSomaticPanelOfNormalsIntegrationTest.java @@ -20,6 +20,7 @@ /** * Created by David Benjamin on 2/17/17. */ +@Test(groups = {"variantcalling"}) public class CreateSomaticPanelOfNormalsIntegrationTest extends CommandLineProgramTest { private static final File PON_VCFS_DIR = new File(toolsTestDir, "mutect/createpon/"); 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 4c266098b38..de5c0fc2e6f 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 @@ -34,6 +34,7 @@ /** * Created by davidben on 9/1/16. */ +@Test(groups = {"variantcalling"}) public class Mutect2IntegrationTest extends CommandLineProgramTest { // positions 10,000,000 - 11,000,000 of chr 20 and with most annotations removed private static final File GNOMAD = new File(largeFileTestDir, "very-small-gnomad.vcf"); @@ -252,7 +253,7 @@ public void testMnps() throws Exception { } // this is particular to our particular artificial MNP bam -- we extract a method in order to use it for HaplotypeCaller - public static void checkMnpOutput(int maxMnpDistance, File outputVcf) { + private static void checkMnpOutput(int maxMnpDistance, File outputVcf) { // note that for testing HaplotypeCaller GVCF mode we will always have the symbolic allele final Map> alleles = StreamSupport.stream(new FeatureDataSource(outputVcf).spliterator(), false) .collect(Collectors.toMap(VariantContext::getStart, vc -> vc.getAlternateAlleles().stream().filter(a -> !a.isSymbolic()).map(Allele::getBaseString).collect(Collectors.toList())));