public void testExplosion() throws Exception { try (TestDirectory td = new TestDirectory()) { final File f = FileHelper.resourceToGzFile( "com/rtg/vcf/resources/vcfsubset.vcf", new File(td, "vcf.vcf.gz")); final File out = new File(td, "out.vcf"); assertEquals( "Records skipped due to invalid or incompatible sample fields: 1" + StringUtils.LS, checkMainInitWarn( "-i", f.getPath(), "-o", out.getPath(), "--remove-format", "GT", "--remove-format", "DS", "-Z")); final String content = FileHelper.fileToString(out); final String nonheader = StringUtils.grepMinusV(content, "^#"); assertTrue(nonheader.startsWith("X\t60052")); } }
public void testRemoveMulti() throws Exception { try (TestDirectory td = new TestDirectory()) { final File f = FileHelper.resourceToGzFile( "com/rtg/vcf/resources/vcfsubset.vcf", new File(td, "vcf.vcf.gz")); final File out = new File(td, "out.vcf"); checkMainInitOk( "-i", f.getPath(), "-o", out.getPath(), "--remove-samples", "--keep-info", "AN", "--keep-info", "AC", "--keep-filter", "YEA", "-Z"); final String content = FileHelper.fileToString(out); final String editedContent = StringUtils.grepMinusV(StringUtils.grepMinusV(content, "^##RUN-ID"), "^##CL"); mNano.check("vcfsubset-multi.vcf", editedContent); } }
public void testKeepSamples() throws Exception { try (TestDirectory td = new TestDirectory()) { final File f = FileHelper.resourceToGzFile( "com/rtg/vcf/resources/vcfsubset.vcf", new File(td, "vcf.vcf.gz")); final File out = new File(td, "out.vcf"); checkMainInitOk( "-i", f.getPath(), "-o", out.getPath(), "--keep-sample", "HG00096", "--keep-sample", "HG00100", "-Z"); final String content = FileHelper.fileToString(out); final String editedContent = StringUtils.grepMinusV(StringUtils.grepMinusV(content, "^##RUN-ID"), "^##CL"); mNano.check("vcfsubset-keepsamples.vcf", editedContent); } }