From 5f8a96e101d9e8bd2a35767588398ace4f3022ad Mon Sep 17 00:00:00 2001 From: jprocter Date: Sun, 14 Nov 2010 14:58:04 +0000 Subject: [PATCH] import annotation file from datasource --- src/jalview/io/AnnotationFile.java | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/jalview/io/AnnotationFile.java b/src/jalview/io/AnnotationFile.java index ef2673a..3459517 100755 --- a/src/jalview/io/AnnotationFile.java +++ b/src/jalview/io/AnnotationFile.java @@ -461,13 +461,9 @@ public class AnnotationFile public boolean readAnnotationFile(AlignmentI al, String file, String protocol) { - String groupRef = null; - Hashtable groupRefRows = new Hashtable(); - - Hashtable autoAnnots = new Hashtable(); + BufferedReader in = null; try { - BufferedReader in = null; if (protocol.equals(AppletFormatAdapter.FILE)) { in = new BufferedReader(new FileReader(file)); @@ -489,7 +485,28 @@ public class AnnotationFile in = new BufferedReader(new java.io.InputStreamReader(is)); } } + if (in != null) + { + return parseAnnotationFrom(al, in); + } + } catch (Exception ex) + { + ex.printStackTrace(); + System.out.println("Problem reading annotation file: " + ex); + return false; + } + return false; + } + + public boolean parseAnnotationFrom(AlignmentI al, BufferedReader in) + throws Exception + { + String groupRef = null; + Hashtable groupRefRows = new Hashtable(); + + Hashtable autoAnnots = new Hashtable(); + { String line, label, description, token; int graphStyle, index; int refSeqIndex = 1; @@ -826,11 +843,6 @@ public class AnnotationFile } ((Vector) groupRefRows.get(groupRef)).removeAllElements(); } - } catch (Exception ex) - { - ex.printStackTrace(); - System.out.println("Problem reading annotation file: " + ex); - return false; } return true; } -- 1.7.10.2