UnifiedGenotyper now correctly initializes the VariantAnnotator engine.

This allows the annotation classes to perform any necessary initialization/validation.
For example, it allows the SnpEff annotator to (among other things) validate its rod binding.
This will prevent a NullPointerException when SnpEff annotation is requested but no rod binding
is present.

Added an integration test to cover this case so that it doesn't break again.
This commit is contained in:
David Roazen 2011-10-11 11:32:27 -04:00
parent 1c485d8b5e
commit 24b72334b3
2 changed files with 17 additions and 3 deletions

View File

@ -214,7 +214,13 @@ public class UnifiedGenotyper extends LocusWalker<VariantCallContext, UnifiedGen
UG_engine = new UnifiedGenotyperEngine(getToolkit(), UAC, logger, verboseWriter, annotationEngine, samples);
// initialize the header
writer.writeHeader(new VCFHeader(getHeaderInfo(), samples)) ;
Set<VCFHeaderLine> headerInfo = getHeaderInfo();
// invoke initialize() method on each of the annotation classes, allowing them to add their own header lines
// and perform any necessary initialization/validation steps
annotationEngine.invokeAnnotationInitializationMethods(headerInfo);
writer.writeHeader(new VCFHeader(headerInfo, samples));
}
private Set<VCFHeaderLine> getHeaderInfo() {

View File

@ -2,6 +2,7 @@ package org.broadinstitute.sting.gatk.walkers.genotyper;
import org.broadinstitute.sting.WalkerTest;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.utils.exceptions.UserException;
import org.testng.annotations.Test;
import java.io.File;
@ -285,6 +286,13 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest {
}
@Test
public void testSnpEffAnnotationRequestedWithoutRodBinding() {
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
baseCommand + " -I " + validationDataLocation + "low_coverage_CEU.chr1.10k-11k.bam -o %s -L 1:10,022,000-10,025,000 " +
"-A SnpEff",
1,
UserException.class);
executeTest("testSnpEffAnnotationRequestedWithoutRodBinding", spec);
}
}