From b4d15601e50bafd396bce2af9dded397e63cc8b8 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Wed, 5 Oct 2016 12:51:11 +0100 Subject: [PATCH] JAL-1191 use full SO in desktop application --- src/jalview/ext/so/SequenceOntology.java | 5 ++++- src/jalview/io/gff/SequenceOntologyFactory.java | 23 +++++++++++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/jalview/ext/so/SequenceOntology.java b/src/jalview/ext/so/SequenceOntology.java index af80b7a..28ddfd9 100644 --- a/src/jalview/ext/so/SequenceOntology.java +++ b/src/jalview/ext/so/SequenceOntology.java @@ -77,11 +77,11 @@ public class SequenceOntology implements SequenceOntologyI */ protected void loadOntologyZipFile(String ontologyFile) { + long now = System.currentTimeMillis(); ZipInputStream zipStream = null; try { String zipFile = ontologyFile + ".zip"; - System.out.println("Loading Sequence Ontology from " + zipFile); InputStream inStream = this.getClass().getResourceAsStream( "/" + zipFile); zipStream = new ZipInputStream(new BufferedInputStream(inStream)); @@ -93,6 +93,9 @@ public class SequenceOntology implements SequenceOntologyI loadOboFile(zipStream); } } + long elapsed = System.currentTimeMillis() - now; + System.out.println("Loaded Sequence Ontology from " + zipFile + " (" + + elapsed + "ms)"); } catch (Exception e) { e.printStackTrace(); diff --git a/src/jalview/io/gff/SequenceOntologyFactory.java b/src/jalview/io/gff/SequenceOntologyFactory.java index 3eaa5d1..acf90e7 100644 --- a/src/jalview/io/gff/SequenceOntologyFactory.java +++ b/src/jalview/io/gff/SequenceOntologyFactory.java @@ -1,5 +1,18 @@ package jalview.io.gff; +import jalview.bin.Cache; +import jalview.ext.so.SequenceOntology; + +/** + * A factory class that returns a model of the Sequence Ontology. If the user's + * Jalview properties file has the line
+ * USE_SO_LITE = true
+ * then a hard-coded subset will be used, otherwise the full ontology (as + * downloaded at a point in time). + * + * @author gmcarstairs + * + */ public class SequenceOntologyFactory { private static SequenceOntologyI instance; @@ -8,8 +21,14 @@ public class SequenceOntologyFactory { if (instance == null) { - // instance = new SequenceOntology(); - instance = new SequenceOntologyLite(); + if (Cache.getDefault("USE_SO_LITE", false)) + { + instance = new SequenceOntologyLite(); + } + else + { + instance = new SequenceOntology(); + } } return instance; } -- 1.7.10.2