TsvGeneResultsWriter implements ResultsWriter { @Override public void writeFile(ModeOfInheritance modeOfInheritance, Analysis analysis, AnalysisResults analysisResults, OutputSettings settings) { String outFileName = ResultsWriterUtils.makeOutputFilename(analysis.getVcfPath(), settings.getOutputPrefix(), OUTPUT_FORMAT, modeOfInheritance); Path outFile = Paths.get(outFileName); try (CSVPrinter printer = new CSVPrinter(Files.newBufferedWriter(outFile, StandardCharsets.UTF_8), format)) { writeData(modeOfInheritance, analysisResults, printer); } catch (IOException ex) { logger.error("Unable to write results to file {}", outFileName, ex); } logger.debug("{} {} results written to file {}", OUTPUT_FORMAT, modeOfInheritance.getAbbreviation(), outFileName); } TsvGeneResultsWriter(); @Override void writeFile(ModeOfInheritance modeOfInheritance, Analysis analysis, AnalysisResults analysisResults, OutputSettings settings); @Override String writeString(ModeOfInheritance modeOfInheritance, Analysis analysis, AnalysisResults analysisResults, OutputSettings settings);  }
@Test public void testWrite() throws Exception { Path tempFolder = Files.createTempDirectory("exomiser_test"); String outPrefix = tempFolder.resolve("testWrite").toString(); OutputSettings settings = OutputSettings.builder() .outputPrefix(outPrefix) .outputFormats(EnumSet.of(OutputFormat.TSV_GENE)) .build(); instance.writeFile(ModeOfInheritance.AUTOSOMAL_DOMINANT, analysis, analysisResults, settings); Path outputPath = tempFolder.resolve("testWrite_AD.genes.tsv"); assertThat(outputPath.toFile().exists(), is(true)); assertThat(outputPath.toFile().delete(), is(true)); Files.delete(tempFolder); }