Bugfix for doNotWriteGenotypes mode

-- Was outputing GT ./. in sites only mode.  Fixed
This commit is contained in:
Mark DePristo 2012-05-17 13:20:16 -04:00
parent 64d4238e2f
commit d52bc31a47
2 changed files with 11 additions and 10 deletions

View File

@ -62,8 +62,6 @@ class BCF2Writer extends IndexingVariantContextWriter {
@Override @Override
public void writeHeader(final VCFHeader header) { public void writeHeader(final VCFHeader header) {
this.header = header;
// create the config offsets map // create the config offsets map
for ( final VCFContigHeaderLine contig : header.getContigLines()) for ( final VCFContigHeaderLine contig : header.getContigLines())
contigDictionary.put(contig.getID(), contig.getContigIndex()); contigDictionary.put(contig.getID(), contig.getContigIndex());
@ -78,7 +76,7 @@ class BCF2Writer extends IndexingVariantContextWriter {
// write out the header into a byte stream, get it's length, and write everything to the file // write out the header into a byte stream, get it's length, and write everything to the file
final ByteArrayOutputStream capture = new ByteArrayOutputStream(); final ByteArrayOutputStream capture = new ByteArrayOutputStream();
final OutputStreamWriter writer = new OutputStreamWriter(capture); final OutputStreamWriter writer = new OutputStreamWriter(capture);
VCFWriter.writeHeader(header, writer, doNotWriteGenotypes, VCFWriter.getVersionLine(), "BCF2 stream"); this.header = VCFWriter.writeHeader(header, writer, doNotWriteGenotypes, VCFWriter.getVersionLine(), "BCF2 stream");
writer.append('\0'); // the header is null terminated by a byte writer.append('\0'); // the header is null terminated by a byte
writer.close(); writer.close();

View File

@ -90,8 +90,9 @@ class VCFWriter extends IndexingVariantContextWriter {
@Override @Override
public void writeHeader(VCFHeader header) { public void writeHeader(VCFHeader header) {
mHeader = header; // note we need to update the mHeader object after this call because they header
writeHeader(mHeader, mWriter, doNotWriteGenotypes, getVersionLine(), getStreamName()); // may have genotypes trimmed out of it, if doNotWriteGenotypes is true
mHeader = writeHeader(header, mWriter, doNotWriteGenotypes, getVersionLine(), getStreamName());
// determine if we use filters, so we should FORCE pass the records // determine if we use filters, so we should FORCE pass the records
// TODO -- this might not be necessary any longer as we have unfiltered, filtered, and PASS VCs // TODO -- this might not be necessary any longer as we have unfiltered, filtered, and PASS VCs
@ -105,7 +106,7 @@ class VCFWriter extends IndexingVariantContextWriter {
return VERSION_LINE; return VERSION_LINE;
} }
public static void writeHeader(VCFHeader header, public static VCFHeader writeHeader(VCFHeader header,
final Writer writer, final Writer writer,
final boolean doNotWriteGenotypes, final boolean doNotWriteGenotypes,
final String versionLine, final String versionLine,
@ -151,6 +152,8 @@ class VCFWriter extends IndexingVariantContextWriter {
catch (IOException e) { catch (IOException e) {
throw new ReviewedStingException("IOException writing the VCF header to " + streamNameForError, e); throw new ReviewedStingException("IOException writing the VCF header to " + streamNameForError, e);
} }
return header;
} }
/** /**