From e34ca0acb14162965cc6eb2df56bd51aece135b1 Mon Sep 17 00:00:00 2001 From: Mark DePristo Date: Wed, 13 Jun 2012 20:28:23 -0400 Subject: [PATCH] Passing all unittests -- Final merge conflicts resolved -- BCF2Writer now supports case where a sample is present in the header but the sample isn't in the VC, in which case we create an empty sample and encode that --- .../sting/utils/variantcontext/writer/BCF2Writer.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/public/java/src/org/broadinstitute/sting/utils/variantcontext/writer/BCF2Writer.java b/public/java/src/org/broadinstitute/sting/utils/variantcontext/writer/BCF2Writer.java index 3beb101fa..f72cb81ec 100644 --- a/public/java/src/org/broadinstitute/sting/utils/variantcontext/writer/BCF2Writer.java +++ b/public/java/src/org/broadinstitute/sting/utils/variantcontext/writer/BCF2Writer.java @@ -291,7 +291,10 @@ class BCF2Writer extends IndexingVariantContextWriter { writer.start(encoder, vc); for ( final String name : header.getGenotypeSamples() ) { // todo -- can we optimize this get (string -> genotype) which can be expensive - final Genotype g = vc.getGenotype(name); + Genotype g = vc.getGenotype(name); + if ( g == null ) + // we don't have any data about g at all + g = new GenotypeBuilder(name).make(); writer.addGenotype(encoder, vc, g); } writer.done(encoder, vc);