public int checkExportedVCF(Path originalVcf, Path exportedVcf, Region region) throws IOException { return checkExportedVCF(originalVcf, null, exportedVcf, region, null); }
@Test public void testVcfHtsExportSingleFile() throws Exception { Query query = new Query() .append(VariantQueryParam.STUDY.key(), STUDY_NAME) .append(VariantQueryParam.FILE.key(), 1); Path outputVcf = getTmpRootDir().resolve("hts_sf_" + EXPORTED_FILE_NAME); QueryOptions options = new QueryOptions(QueryOptions.SORT, true); int failedVariants = export(outputVcf, query, options); assertEquals(0, failedVariants); // compare VCF_TEST_FILE_NAME and EXPORTED_FILE_NAME checkExportedVCF(Paths.get(getResourceUri("1000g_batches/1-500.filtered.10k.chr22.phase3_shapeit2_mvncall_integrated_v5.20130502.genotypes.vcf" + ".gz")), outputVcf, new Region("22")); }
@Test public void testVcfHtsExportMultiFile() throws Exception { Query query = new Query(); query.append(VariantQueryParam.STUDY.key(), STUDY_NAME); // .append(VariantDBAdaptor.VariantQueryParams.REGION.key(), region); Path outputVcf = getTmpRootDir().resolve("hts_mf_" + EXPORTED_FILE_NAME); int failedVariants = export(outputVcf, query, new QueryOptions(QueryOptions.SORT, true)); assertEquals(0, failedVariants); // compare VCF_TEST_FILE_NAME and EXPORTED_FILE_NAME Path originalVcf = Paths.get(getResourceUri("filtered.10k.chr22.phase3_shapeit2_mvncall_integrated_v5.20130502.genotypes.vcf.gz")); VariantReader variantReader = new VariantVcfHtsjdkReader( originalVcf, getMetadata(originalVcf), VARIANT_NORMALIZER); variantReader.open(); variantReader.pre(); Region region = new Region("22", 16000000); int batchSize = 2000; while (checkExportedVCF(originalVcf, variantReader, outputVcf, region, batchSize) != batchSize) { region = new Region("22", region.getEnd()); } variantReader.post(); variantReader.close(); }