Skip to content

Commit

Permalink
add error message for when tree-score-threshold is set in ReblockGVCF…
Browse files Browse the repository at this point in the history
…s without TREE_SCORE present
  • Loading branch information
meganshand committed Feb 22, 2023
1 parent b7f24ff commit b8c39dd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,12 @@ public void onTraversalStart() {
}

final VCFHeader inputHeader = getHeaderForVariants();

if (treeScoreThreshold > 0 && !inputHeader.getInfoHeaderLines().contains(GATKVCFConstants.TREE_SCORE)) {
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<VCFHeaderLine> inputHeaders = inputHeader.getMetaDataInSortedOrder();

final Set<VCFHeaderLine> headerLines = new HashSet<>(inputHeaders);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}

0 comments on commit b8c39dd

Please sign in to comment.