Bug fix for NPE in HC with --dbsnp argument.
- I had added the framework in the VA engine but should not have hooked it up to the HC yet since the RefMetaDataTracker is always null. - Added contracts and docs to the relevant methods in the VA engine so that this doesn't happen in the future.
This commit is contained in:
parent
e7c35a907f
commit
4e5ff3d6f1
|
|
@ -509,7 +509,8 @@ public class HaplotypeCaller extends ActiveRegionWalker<Integer, Integer> implem
|
||||||
activeRegion.getLocation(),
|
activeRegion.getLocation(),
|
||||||
getToolkit().getGenomeLocParser(),
|
getToolkit().getGenomeLocParser(),
|
||||||
activeAllelesToGenotype ) ) {
|
activeAllelesToGenotype ) ) {
|
||||||
annotationEngine.annotateDBs(metaDataTracker, getToolkit().getGenomeLocParser().createGenomeLoc(call), call);
|
// TODO -- uncomment this line once ART-based walkers have a proper RefMetaDataTracker.
|
||||||
|
// annotationEngine.annotateDBs(metaDataTracker, getToolkit().getGenomeLocParser().createGenomeLoc(call), call);
|
||||||
vcfWriter.add( call );
|
vcfWriter.add( call );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@
|
||||||
|
|
||||||
package org.broadinstitute.sting.gatk.walkers.annotator;
|
package org.broadinstitute.sting.gatk.walkers.annotator;
|
||||||
|
|
||||||
|
import com.google.java.contract.Ensures;
|
||||||
|
import com.google.java.contract.Requires;
|
||||||
import org.broadinstitute.sting.commandline.RodBinding;
|
import org.broadinstitute.sting.commandline.RodBinding;
|
||||||
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
||||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||||
|
|
@ -235,6 +237,16 @@ public class VariantAnnotatorEngine {
|
||||||
return builder.genotypes(annotateGenotypes(null, null, null, vc, perReadAlleleLikelihoodMap)).make();
|
return builder.genotypes(annotateGenotypes(null, null, null, vc, perReadAlleleLikelihoodMap)).make();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Annotate the ID field and other DBs for the given Variant Context
|
||||||
|
*
|
||||||
|
* @param tracker ref meta data tracker (cannot be null)
|
||||||
|
* @param loc location of the vc
|
||||||
|
* @param vc variant context to annotate
|
||||||
|
* @return non-null annotated version of vc
|
||||||
|
*/
|
||||||
|
@Requires({"tracker != null && loc != null && vc != null"})
|
||||||
|
@Ensures("result != null")
|
||||||
public VariantContext annotateDBs(final RefMetaDataTracker tracker, final GenomeLoc loc, VariantContext vc) {
|
public VariantContext annotateDBs(final RefMetaDataTracker tracker, final GenomeLoc loc, VariantContext vc) {
|
||||||
final Map<String, Object> newInfoAnnotations = new HashMap<String, Object>(0);
|
final Map<String, Object> newInfoAnnotations = new HashMap<String, Object>(0);
|
||||||
vc = annotateDBs(tracker, loc, vc, newInfoAnnotations);
|
vc = annotateDBs(tracker, loc, vc, newInfoAnnotations);
|
||||||
|
|
@ -247,6 +259,17 @@ public class VariantAnnotatorEngine {
|
||||||
return vc;
|
return vc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Annotate the ID field and other DBs for the given Variant Context
|
||||||
|
*
|
||||||
|
* @param tracker ref meta data tracker (cannot be null)
|
||||||
|
* @param loc location of the vc
|
||||||
|
* @param vc variant context to annotate
|
||||||
|
* @param infoAnnotations info annotation map to populate
|
||||||
|
* @return non-null annotated version of vc
|
||||||
|
*/
|
||||||
|
@Requires({"tracker != null && loc != null && vc != null && infoAnnotations != null"})
|
||||||
|
@Ensures("result != null")
|
||||||
private VariantContext annotateDBs(final RefMetaDataTracker tracker, final GenomeLoc loc, VariantContext vc, final Map<String, Object> infoAnnotations) {
|
private VariantContext annotateDBs(final RefMetaDataTracker tracker, final GenomeLoc loc, VariantContext vc, final Map<String, Object> infoAnnotations) {
|
||||||
for ( Map.Entry<RodBinding<VariantContext>, String> dbSet : dbAnnotations.entrySet() ) {
|
for ( Map.Entry<RodBinding<VariantContext>, String> dbSet : dbAnnotations.entrySet() ) {
|
||||||
if ( dbSet.getValue().equals(VCFConstants.DBSNP_KEY) ) {
|
if ( dbSet.getValue().equals(VCFConstants.DBSNP_KEY) ) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue