From 9f3e56e487226ee6f2e0d8747ea8f6b0c3e573cd Mon Sep 17 00:00:00 2001 From: ebanks Date: Thu, 16 Dec 2010 04:05:47 +0000 Subject: [PATCH] VariantAnnotator shouldn't die when multiple records occur at the same position git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4853 348d0f76-0448-11de-a6fe-93d51630548a --- .../gatk/walkers/annotator/VariantAnnotator.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotator.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotator.java index f3b5097c6..b9cddb91f 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotator.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotator.java @@ -202,12 +202,13 @@ public class VariantAnnotator extends RodWalker { if ( tracker == null ) return 0; - VariantContext vc = tracker.getVariantContext(ref, "variant", null, context.getLocation(), true); - if ( vc == null ) + Collection VCs = tracker.getVariantContexts(ref, "variant", null, context.getLocation(), true, false); + if ( VCs.size() == 0 ) return 0; + Collection annotatedVCs = VCs; + // if the reference base is not ambiguous, we can annotate - Collection annotatedVCs = Arrays.asList(vc); Map stratifiedContexts; if ( BaseUtils.simpleBaseToBaseIndex(ref.getBase()) != -1 ) { if ( ! context.hasExtendedEventPileup() ) { @@ -216,7 +217,9 @@ public class VariantAnnotator extends RodWalker { stratifiedContexts = StratifiedAlignmentContext.splitContextBySampleName(context.getExtendedEventPileup(), ASSUME_SINGLE_SAMPLE); } if ( stratifiedContexts != null ) { - annotatedVCs = engine.annotateContext(tracker, ref, stratifiedContexts, vc); + annotatedVCs = new ArrayList(VCs.size()); + for ( VariantContext vc : VCs ) + annotatedVCs.addAll(engine.annotateContext(tracker, ref, stratifiedContexts, vc)); } }