From 2b471cabe37b986049780ed4bbb4c9838be9a321 Mon Sep 17 00:00:00 2001 From: David Roazen Date: Mon, 20 Jul 2015 12:42:59 -0400 Subject: [PATCH] Fix BQSR Dataflow test that was failing due to lack of sequence dictionary validation Now that sequence dictionary validation is in, we can re-enable this test, which was previously failing with a java.lang.OutOfMemoryError due to lack of upfront validation of the reads vs. reference sequence dictionaries. --- .../walkers/bqsr/BaseRecalibratorDataflow.java | 16 ++++++++++++---- .../BaseRecalibratorDataflowIntegrationTest.java | 5 ++--- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/broadinstitute/hellbender/dev/tools/walkers/bqsr/BaseRecalibratorDataflow.java b/src/main/java/org/broadinstitute/hellbender/dev/tools/walkers/bqsr/BaseRecalibratorDataflow.java index 96626b1ec37..a1977e39c10 100644 --- a/src/main/java/org/broadinstitute/hellbender/dev/tools/walkers/bqsr/BaseRecalibratorDataflow.java +++ b/src/main/java/org/broadinstitute/hellbender/dev/tools/walkers/bqsr/BaseRecalibratorDataflow.java @@ -22,10 +22,7 @@ import org.broadinstitute.hellbender.dev.BunnyLog; import org.broadinstitute.hellbender.dev.pipelines.bqsr.BaseRecalibratorDataflowUtils; import org.broadinstitute.hellbender.dev.pipelines.bqsr.DataflowReadFilter; -import org.broadinstitute.hellbender.engine.FeatureDataSource; -import org.broadinstitute.hellbender.engine.FeatureInput; -import org.broadinstitute.hellbender.engine.FeatureManager; -import org.broadinstitute.hellbender.engine.ReadsDataSource; +import org.broadinstitute.hellbender.engine.*; import org.broadinstitute.hellbender.engine.dataflow.DataflowCommandLineProgram; import org.broadinstitute.hellbender.engine.dataflow.ReadsSource; import org.broadinstitute.hellbender.engine.dataflow.coders.GATKReadCoder; @@ -34,6 +31,7 @@ import org.broadinstitute.hellbender.exceptions.UserException; import org.broadinstitute.hellbender.tools.recalibration.RecalibrationTables; import org.broadinstitute.hellbender.utils.IntervalUtils; +import org.broadinstitute.hellbender.utils.SequenceDictionaryUtils; import org.broadinstitute.hellbender.utils.SimpleInterval; import org.broadinstitute.hellbender.utils.dataflow.BucketUtils; import org.broadinstitute.hellbender.utils.dataflow.DataflowUtils; @@ -116,6 +114,7 @@ protected void setupPipeline(Pipeline pipeline) { BaseRecalibratorDataflowUtils.ensureReferenceIsReadable(pipeline.getOptions(), referencePath); baseRecalibratorWorker = BaseRecalibratorWorker.fromArgs(header, BRAC); baseRecalibratorWorker.checkClientArguments(); + checkSequenceDictionaries(); // 2. set up computation PCollection aggregated = @@ -142,6 +141,15 @@ protected void setupPipeline(Pipeline pipeline) { } } + private void checkSequenceDictionaries() { + try ( final ReferenceDataSource refSource = new ReferenceDataSource(new File(referencePath)) ) { + final SAMSequenceDictionary refDictionary = refSource.getSequenceDictionary(); + final SAMSequenceDictionary readsDictionary = header.getSequenceDictionary(); + + SequenceDictionaryUtils.validateDictionaries("reference", refDictionary, "reads", readsDictionary, true, null); + } + } + @Override protected void afterPipeline(Pipeline p) { bunny.stepEnd("dataflow"); diff --git a/src/test/java/org/broadinstitute/hellbender/tools/walkers/bqsr/BaseRecalibratorDataflowIntegrationTest.java b/src/test/java/org/broadinstitute/hellbender/tools/walkers/bqsr/BaseRecalibratorDataflowIntegrationTest.java index a309b2a8f92..6aa49055d81 100644 --- a/src/test/java/org/broadinstitute/hellbender/tools/walkers/bqsr/BaseRecalibratorDataflowIntegrationTest.java +++ b/src/test/java/org/broadinstitute/hellbender/tools/walkers/bqsr/BaseRecalibratorDataflowIntegrationTest.java @@ -238,8 +238,7 @@ public void testBQSRFailWithoutDBSNP() throws IOException { spec.executeTest("testBQSRFailWithoutDBSNP", this); } - // TODO: re-enable this once sequence dictionary validation is in - @Test(enabled = false) + @Test public void testBQSRFailWithIncompatibleReference() throws IOException { final String resourceDir = getTestDataDir() + "/" + "BQSR" + "/"; @@ -250,7 +249,7 @@ public void testBQSRFailWithIncompatibleReference() throws IOException { IntegrationTestSpec spec = new IntegrationTestSpec( params.getCommandLine(), 1, - UserException.MissingContigInSequenceDictionary.class); + UserException.IncompatibleSequenceDictionaries.class); spec.executeTest("testBQSRFailWithIncompatibleReference", this); } }