diff --git a/src/main/java/org/molgenis/capice/vcf/TsvToVcfMapperImpl.java b/src/main/java/org/molgenis/capice/vcf/TsvToVcfMapperImpl.java index 00ddaca1..730c5267 100644 --- a/src/main/java/org/molgenis/capice/vcf/TsvToVcfMapperImpl.java +++ b/src/main/java/org/molgenis/capice/vcf/TsvToVcfMapperImpl.java @@ -134,7 +134,7 @@ private float getPrediction(CSVRecord record) { } private static Reader createInputReader(Path inputTsvPath) throws IOException { - if (inputTsvPath.endsWith(".gz")) { + if (inputTsvPath.toString().endsWith(".gz")) { return new InputStreamReader( new GZIPInputStream(new FileInputStream(inputTsvPath.toFile())), UTF_8); } else { diff --git a/src/test/java/org/molgenis/capice/vcf/AppIT.java b/src/test/java/org/molgenis/capice/vcf/AppIT.java index fc9f61e8..e1c77145 100644 --- a/src/test/java/org/molgenis/capice/vcf/AppIT.java +++ b/src/test/java/org/molgenis/capice/vcf/AppIT.java @@ -51,4 +51,21 @@ void testPrecomputedScores() throws IOException { assertEquals(expected, actual); } + + @Test + void testPrecomputedScoresGzipped() throws IOException { + String inputFile = ResourceUtils.getFile("classpath:input_precomputed_scores.tsv.gz").toString(); + String outputFile = sharedTempDir.resolve("capice_precomputed_scores_actual.vcf.gz").toString(); + + String[] args = {"-i", inputFile, "-o", outputFile, "-f", "-t", "precomputed_scores"}; + SpringApplication.run(App.class, args); + + String actual = getVcfGzAsString(Path.of(outputFile)).replaceAll("##CAP=.*", "##CAP=test"); + Path expectedPath = Paths.get("src", "test", "resources", "capice_precomputed_scores.vcf"); + String expected = + Files.readString(expectedPath, StandardCharsets.UTF_8) + .replaceAll("\\n|\\r\\n", System.getProperty("line.separator")); + + assertEquals(expected, actual); + } } diff --git a/src/test/resources/input_precomputed_scores.tsv.gz b/src/test/resources/input_precomputed_scores.tsv.gz new file mode 100644 index 00000000..d703e851 Binary files /dev/null and b/src/test/resources/input_precomputed_scores.tsv.gz differ