From 11ed8e61c963fe9ff5e732ebbe08990efa0a4e62 Mon Sep 17 00:00:00 2001 From: Joel Thibault Date: Wed, 11 Apr 2012 16:11:07 -0400 Subject: [PATCH] Add referenceBaseForIndel to the Mongo VariantContext objects --- .../gatk/walkers/variantutils/SelectVariants.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/SelectVariants.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/SelectVariants.java index 208de044e..458f16092 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/SelectVariants.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/SelectVariants.java @@ -479,7 +479,7 @@ public class SelectVariants extends RodWalker implements TreeR return 0; //Collection vcs = tracker.getValues(variantCollection.variants, context.getLocation()); - Collection vcs = getMongoVariants(context.getLocation()); + Collection vcs = getMongoVariants(ref, context.getLocation()); if ( vcs == null || vcs.size() == 0) { return 0; @@ -552,7 +552,7 @@ public class SelectVariants extends RodWalker implements TreeR return 1; } - private Collection getMongoVariants(GenomeLoc location) { + private Collection getMongoVariants(ReferenceContext ref, GenomeLoc location) { String contig = location.getContig(); long start = location.getStart(); long stop = location.getStop(); @@ -639,6 +639,13 @@ public class SelectVariants extends RodWalker implements TreeR builder.attributes(attributes); builder.filters(filters); + long index = start - ref.getWindow().getStart() - 1; + if ( index >= 0 ) { + // we were given enough reference context to create the VariantContext + builder.referenceBaseForIndel(ref.getBases()[(int)index]); + } + + builder.referenceBaseForIndel(ref.getBases()[0]); vcs.add(builder.make()); }