JannovarDataFactory { public JannovarData buildData(GenomeAssembly assembly, TranscriptSource source) { String name = createJannovarName(assembly, source); try{ logger.info("Downloading/parsing for data source {}", name); DataSource dataSource = dataSourceFactory.getDataSource(name); return dataSource.getDataFactory().build(downloadDir.toString(), printProgressBars, Collections.emptyList()); } catch (Exception e) { throw new JannovarException(e); } } private  JannovarDataFactory(Builder builder); void buildAndWrite(GenomeAssembly assembly, TranscriptSource source, Path outPath); JannovarData buildData(GenomeAssembly assembly, TranscriptSource source); static Builder builder(Path iniFile);  }
@Disabled @Test void testBuildData(@TempDir Path tempDir) { Path jannovarOutputDir = Paths.get("C:/Users/hhx640/Documents/Jannovar/data"); JannovarDataFactory instance = JannovarDataFactory.builder(iniFile).downloadDir(jannovarOutputDir).build(); JannovarData jannovarData = instance.buildData(GenomeAssembly.HG19, TranscriptSource.ENSEMBL); JannovarDataProtoSerialiser.save(jannovarOutputDir.resolve("1902_transcripts_ensembl.ser"), jannovarData); JannovarData roundTripped = JannovarDataSourceLoader.loadJannovarData(jannovarOutputDir.resolve("1902_transcripts_ensembl.ser")); roundTripped.getChromosomes() .values() .forEach(chromosome -> System.out.printf("Chrom: %d %s num genes: %d%n", chromosome.getChrID(), chromosome .getChromosomeName(), chromosome.getNumberOfGenes())); VariantAnnotator variantAnnotator = new JannovarVariantAnnotator(GenomeAssembly.HG19, roundTripped, ChromosomalRegionIndex .empty()); VariantAnnotation variantAnnotation = variantAnnotator.annotate("19", 36227863, "C", "T"); System.out.println(variantAnnotation); GeneFactory geneFactory = new GeneFactory(roundTripped); for (Gene gene : geneFactory.createKnownGenes()) { if (gene.getGeneSymbol().equals(variantAnnotation.getGeneSymbol())) { System.out.println(gene.getGeneIdentifier()); } if (!gene.getGeneSymbol().contains(".") && !gene.getGeneIdentifier().hasEntrezId()) { System.out.println(gene.getGeneIdentifier()); } } }