Better error message for Petr's null pointer exception. Also added an exception integration test because I'm certain this used to work.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4319 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
rpoplin 2010-09-21 13:44:40 +00:00
parent 8719dde59d
commit 547763b230
2 changed files with 31 additions and 1 deletions

View File

@ -426,7 +426,7 @@ public final class VariantGaussianMixtureModel extends VariantOptimizationModel
} else {
try {
value = Double.parseDouble( (String)vc.getAttribute( annotationKey ) );
} catch( NumberFormatException e ) {
} catch( Exception e ) {
throw new UserException.MalformedFile(vc.getName(), "No double value detected for annotation = " + annotationKey + " in variant at " + VariantContextUtils.getLocation(vc) + ", reported annotation value = " + vc.getAttribute( annotationKey ), e );
}
}

View File

@ -1,6 +1,7 @@
package org.broadinstitute.sting.gatk.walkers.variantrecalibration;
import org.broadinstitute.sting.WalkerTest;
import org.broadinstitute.sting.utils.exceptions.UserException;
import org.junit.Test;
import java.util.*;
@ -109,4 +110,33 @@ public class VariantRecalibrationWalkersIntegrationTest extends WalkerTest {
}
}
}
@Test
public void testFailWithBadAnnotation() {
HashMap<String, String> e = new HashMap<String, String>();
e.put( validationDataLocation + "lowpass.N3.chr1.raw.vcf", "" );
for ( Map.Entry<String, String> entry : e.entrySet() ) {
String vcf = entry.getKey();
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
"-R " + b36KGReference +
" -NO_HEADER" +
" --DBSNP " + GATKDataLocation + "dbsnp_129_b36.rod" +
" -B:hapmap,VCF " + comparisonDataLocation + "Validated/HapMap/3.2/genotypes_r27_nr.b36_fwd.vcf" +
" -weightDBSNP 0.2 -weightHapMap 1.0" +
" -T GenerateVariantClusters" +
" -B:input,VCF " + vcf +
" -L 1:50,000,000-200,000,000" +
" -qual 50.0" +
" --ignore_filter GATK_STANDARD" +
" -an QD -an HRun -an ThisAnnotationIsBAD" + // There is a bad annotation here
" -clusterFile %s",
1, // just one output file
UserException.MalformedFile.class);
executeTest("testFailWithBadAnnotation", spec);
}
}
}