From 60880b925ff894f3deb0c7068e210dc4fd4da40e Mon Sep 17 00:00:00 2001 From: depristo Date: Mon, 20 Dec 2010 16:33:14 +0000 Subject: [PATCH] VC utils prune method now will keep genotype attributes as well as info keys. RBP now emits a far reduce (NO INFO, only GT:GQ:PG) records, further reducing size of phasing output git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4882 348d0f76-0448-11de-a6fe-93d51630548a --- .../gatk/contexts/variantcontext/VariantContextUtils.java | 6 +++++- .../sting/gatk/walkers/phasing/ReadBackedPhasingWalker.java | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/java/src/org/broadinstitute/sting/gatk/contexts/variantcontext/VariantContextUtils.java b/java/src/org/broadinstitute/sting/gatk/contexts/variantcontext/VariantContextUtils.java index 1f0d732e5..f901a8f4e 100755 --- a/java/src/org/broadinstitute/sting/gatk/contexts/variantcontext/VariantContextUtils.java +++ b/java/src/org/broadinstitute/sting/gatk/contexts/variantcontext/VariantContextUtils.java @@ -293,7 +293,8 @@ public class VariantContextUtils { Map d = mvc.getAttributes(); mvc.clearAttributes(); for ( String key : keysToPreserve ) - mvc.putAttribute(key, d.get(key)); + if ( d.containsKey(key) ) + mvc.putAttribute(key, d.get(key)); } Collection gs = mvc.getGenotypes().values(); @@ -301,6 +302,9 @@ public class VariantContextUtils { for ( Genotype g : gs ) { MutableGenotype mg = new MutableGenotype(g); mg.clearAttributes(); + for ( String key : keysToPreserve ) + if ( g.hasAttribute(key) ) + mg.putAttribute(key, g.getAttribute(key)); mvc.addGenotype(mg); } diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/phasing/ReadBackedPhasingWalker.java b/java/src/org/broadinstitute/sting/gatk/walkers/phasing/ReadBackedPhasingWalker.java index c329e4bfc..edb6ec6e8 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/phasing/ReadBackedPhasingWalker.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/phasing/ReadBackedPhasingWalker.java @@ -241,13 +241,14 @@ public class ReadBackedPhasingWalker extends RodWalker KEYS_TO_KEEP_IN_REDUCED_VCF = new HashSet(Arrays.asList("PQ")); private VariantContext reduceVCToSamples(VariantContext vc, List samplesToPhase) { // for ( String sample : samplesToPhase ) // logger.debug(String.format(" Sample %s has genotype %s, het = %s", sample, vc.getGenotype(sample), vc.getGenotype(sample).isHet() )); VariantContext subvc = vc.subContextFromGenotypes(vc.getGenotypes(samplesToPhase).values()); // logger.debug("original VC = " + vc); // logger.debug("sub VC = " + subvc); - return subvc; + return VariantContextUtils.pruneVariantContext(subvc, KEYS_TO_KEEP_IN_REDUCED_VCF ); } private List processQueue(PhasingStats phaseStats, boolean processAll) {