From 24f62de7c601e30c3bae6fe025c226b58221d52a Mon Sep 17 00:00:00 2001 From: meganshand Date: Thu, 23 Feb 2023 12:37:11 -0500 Subject: [PATCH] =?UTF-8?q?add=20error=20message=20for=20when=20tree-score?= =?UTF-8?q?-threshold=20is=20set=20in=20ReblockGVCF=E2=80=A6=20(#8218)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add error message for when tree-score-threshold is set in ReblockGVCFs without TREE_SCORE present --- .../tools/walkers/variantutils/ReblockGVCF.java | 6 ++++++ .../variantutils/ReblockGVCFIntegrationTest.java | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/variantutils/ReblockGVCF.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/variantutils/ReblockGVCF.java index ecdef97cf72..36a0bc8fd1c 100644 --- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/variantutils/ReblockGVCF.java +++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/variantutils/ReblockGVCF.java @@ -211,6 +211,12 @@ public void onTraversalStart() { } final VCFHeader inputHeader = getHeaderForVariants(); + + if (treeScoreThreshold > 0 && inputHeader.getInfoHeaderLine(GATKVCFConstants.TREE_SCORE) == null) { + throw new UserException("-" + TREE_SCORE_THRESHOLD_LONG_NAME + " is set to value greater than 0: " + treeScoreThreshold + + ", but the " + GATKVCFConstants.TREE_SCORE + " annotation is not present in the input GVCF."); + } + final Set inputHeaders = inputHeader.getMetaDataInSortedOrder(); final Set headerLines = new HashSet<>(inputHeaders); diff --git a/src/test/java/org/broadinstitute/hellbender/tools/walkers/variantutils/ReblockGVCFIntegrationTest.java b/src/test/java/org/broadinstitute/hellbender/tools/walkers/variantutils/ReblockGVCFIntegrationTest.java index 10fa72aa4a5..8ead53254e0 100644 --- a/src/test/java/org/broadinstitute/hellbender/tools/walkers/variantutils/ReblockGVCFIntegrationTest.java +++ b/src/test/java/org/broadinstitute/hellbender/tools/walkers/variantutils/ReblockGVCFIntegrationTest.java @@ -503,4 +503,18 @@ public void testFirstPositionOnContigNotDropped() { Assert.assertEquals(outVCs.get(1).getContig(), "chr13"); Assert.assertEquals(outVCs.get(1).getStart(), 18173860); } + + @Test + public void testTreeScoreWithNoAnnotation() { + final File output = createTempFile("reblockedgvcf", ".vcf"); + + final ArgumentsBuilder args = new ArgumentsBuilder(); + args.add("V", largeFileTestDir + "NA12878.prod.chr20snippet.g.vcf.gz") + .addOutput(output) + .addReference(b37_reference_20_21) + .add(ReblockGVCF.TREE_SCORE_THRESHOLD_LONG_NAME, 0.3) + .add("do-qual-approx", true); + + Assert.assertThrows(UserException.class, () -> runCommandLine(args)); + } }