use of org.monarchinitiative.loinc2hpo.io.Downloader in project loinc2hpo by monarch-initiative.
the class MainController method downloadHPO.
@FXML
public void downloadHPO(ActionEvent e) {
String dirpath = Loinc2HpoPlatform.getLOINC2HPODir().getAbsolutePath();
File f = new File(dirpath);
if (f == null || !(f.exists() && f.isDirectory())) {
logger.trace("Cannot download hp.obo, because directory not existing at " + f.getAbsolutePath());
return;
}
String BASENAME = "hp.obo";
String BASENAME_OWL = "hp.owl";
ProgressIndicator pb = new ProgressIndicator();
javafx.scene.control.Label label = new javafx.scene.control.Label("downloading hp.obo/.owl...");
FlowPane root = new FlowPane();
root.setPadding(new Insets(10));
root.setHgap(10);
root.getChildren().addAll(label, pb);
Scene scene = new Scene(root, 400, 100);
Stage window = new Stage();
window.setTitle("HPO download");
window.setScene(scene);
Task hpodownload = new Downloader(dirpath, HP_OBO_URL, BASENAME, pb);
new Thread(hpodownload).start();
hpodownload = new Downloader(dirpath, HP_OWL_URL, BASENAME_OWL, pb);
new Thread(hpodownload).start();
window.show();
hpodownload.setOnSucceeded(event -> {
window.close();
logger.trace(String.format("Successfully downloaded hpo to %s", dirpath));
String fullpath = String.format("%s%shp.obo", dirpath, File.separator);
String fullpath_owl = String.format("%s%shp.owl", dirpath, File.separator);
model.setPathToHpOboFile(fullpath);
model.setPathToHpOwlFile(fullpath_owl);
model.writeSettings();
configurationComplete.set(isConfigurationCompleted());
});
hpodownload.setOnFailed(event -> {
window.close();
logger.error("Unable to download HPO obo file");
});
// Thread thread = new Thread(hpodownload);
// thread.start();
e.consume();
}
Aggregations