Skip to content

Commit

Permalink
Ensure VCF output appends appropriate gzip termination blocks.
Browse files Browse the repository at this point in the history
Several VCF writing commands were inconsistently in whether they
appended gzip termination blocks, producing warnings with third party
tools.
  • Loading branch information
Lenbok committed Jun 15, 2017
1 parent de8dd0f commit 2a3ee4b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/com/rtg/variant/cnv/segment/SegmentCliTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import com.rtg.util.io.TestDirectory;
import com.rtg.util.test.FileHelper;

import htsjdk.samtools.util.BlockCompressedInputStream;

/**
* Tests the corresponding class.
*/
Expand Down Expand Up @@ -82,10 +84,12 @@ public void testSimpleOperation() throws IOException {
final File output = new File(dir, "output");

// gc correction does not work well here because the regions are small, so turn it off
final MainResult result = MainResult.run(getCli(), "-t", reference.getPath(), "-o", output.getPath(), "--control", control.getPath(), "--case", sample.getPath(), "--sample", "foo", "-Z", "--beta", "0.1", "--Xgcbins", "0");
final MainResult result = MainResult.run(getCli(), "-t", reference.getPath(), "-o", output.getPath(), "--control", control.getPath(), "--case", sample.getPath(), "--sample", "foo", "--beta", "0.1", "--Xgcbins", "0");
assertEquals(0, result.rc());
mNano.check("expected.unsegmented.bed", FileUtils.fileToString(new File(output, "unsegmented.bed")));
mNano.check("expected.segments.vcf", TestUtils.sanitizeVcfHeader(FileUtils.fileToString(new File(output, "segments.vcf"))));
final File vcf = new File(output, "segments.vcf.gz");
assertEquals(BlockCompressedInputStream.FileTermination.HAS_TERMINATOR_BLOCK, BlockCompressedInputStream.checkTermination(vcf));
mNano.check("expected.unsegmented.bed", FileHelper.gzFileToString(new File(output, "unsegmented.bed.gz")));
mNano.check("expected.segments.vcf", TestUtils.sanitizeVcfHeader(FileHelper.gzFileToString(vcf)));
mNano.check("expected.summary.txt", FileUtils.fileToString(new File(output, "summary.txt")));
mNano.check("expected.out.txt", result.out());
}
Expand Down

0 comments on commit 2a3ee4b

Please sign in to comment.