public static JannovarData loadJannovarData(Path transcriptFilePath){ //first try loading the file using the new protobuf-based format (larger file-size, but faster load-time) try { return JannovarDataProtoSerialiser.load(transcriptFilePath); } catch (Exception e) { logger.warn("Unable to load Jannovar data - {}", e.getMessage()); logger.warn("Incorrect Jannovar data format? Will try the old version..."); } try { // if we've got here, try again using the original java serializable-based format (small file-size, but slower load-time) return new JannovarDataSerializer(transcriptFilePath.toString()).load(); } catch (SerializationException e) { throw new ExomiserAutoConfigurationException("Could not load Jannovar data from " + transcriptFilePath, e); } } }
/** * Deserialize the transcript definition file from {@link pathToDataFile}. * * @param pathToDataFile * String with the path to the data file to deserialize * @throws JannovarException * when there is a problem with the deserialization * @throws HelpRequestedException * when the user requested the help page */ protected void deserializeTranscriptDefinitionFile(String pathToDataFile) throws JannovarException, HelpRequestedException { this.jannovarData = new JannovarDataSerializer(pathToDataFile).load(); this.refDict = this.jannovarData.getRefDict(); this.chromosomeMap = this.jannovarData.getChromosomes(); }
/** * Perform the downloading. */ @Override public void run() throws JannovarException { System.err.println("Options"); System.err.println(options.toString()); DatasourceOptions dsOptions = new DatasourceOptions(options.getHttpProxy(), options.getHttpsProxy(), options.getFtpProxy(), options.isReportProgress()); DataSourceFactory factory = new DataSourceFactory(dsOptions, Lists.reverse(options.dataSourceFiles)); for (String name : options.getDatabaseNames()) { System.err.println("Downloading/parsing for data source \"" + name + "\""); JannovarData data = factory.getDataSource(name).getDataFactory() .build(options.getDownloadDir(), options.isReportProgress()); String filename = PathUtil.join(options.getDownloadDir(), name.replace('/', '_').replace('\\', '_') + ".ser"); JannovarDataSerializer serializer = new JannovarDataSerializer(filename); serializer.save(data); } }