In AlleleCount stratification, check to make sure the AC (or MLEAC) is valid (i.e. not higher than number of chromosomes) and throw a User Error if it isn't. Added a test for bad AC.
This commit is contained in:
parent
8e3774fb0e
commit
87e41c83c5
|
|
@ -51,6 +51,10 @@ public class AlleleCount extends VariantStratifier {
|
|||
AC = Math.max(AC, eval.getCalledChrCount(allele));
|
||||
}
|
||||
|
||||
// make sure that the AC isn't invalid
|
||||
if ( AC > eval.getCalledChrCount() )
|
||||
throw new UserException.MalformedVCF(String.format("The AC or MLEAC value (%d) at position %s:%d is larger than the possible called chromosome count (%d)", AC, eval.getChr(), eval.getStart(), eval.getCalledChrCount()));
|
||||
|
||||
return Collections.singletonList((Object) AC);
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
|
|
|
|||
|
|
@ -585,6 +585,21 @@ public class VariantEvalIntegrationTest extends WalkerTest {
|
|||
executeTest("testStandardIndelEval", spec);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBadACValue() {
|
||||
WalkerTestSpec spec = new WalkerTestSpec(
|
||||
buildCommandLine(
|
||||
"-T VariantEval",
|
||||
"-R " + b37KGReference,
|
||||
"-eval " + privateTestDir + "vcfexample.withBadAC.vcf",
|
||||
"-noST -ST AlleleCount",
|
||||
"-noEV -EV VariantSummary"
|
||||
),
|
||||
0,
|
||||
UserException.class);
|
||||
executeTest("testBadACValue", spec);
|
||||
}
|
||||
|
||||
|
||||
@Test()
|
||||
public void testIncompatibleEvalAndStrat() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue