From c36010655019c2ef1f4f6f80738db0b7f2e14a08 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Fri, 7 Jul 2006 12:55:08 +0000 Subject: [PATCH] Replaced by AnnotationFile --- src/jalview/io/AnnotationReader.java | 281 ---------------------------------- 1 file changed, 281 deletions(-) delete mode 100755 src/jalview/io/AnnotationReader.java diff --git a/src/jalview/io/AnnotationReader.java b/src/jalview/io/AnnotationReader.java deleted file mode 100755 index cd7abfd..0000000 --- a/src/jalview/io/AnnotationReader.java +++ /dev/null @@ -1,281 +0,0 @@ -package jalview.io; - -import java.io.*; -import jalview.datamodel.*; -import java.util.StringTokenizer; -import jalview.schemes.UserColourScheme; -import java.net.URL; - -public class AnnotationReader -{ - public boolean readAnnotationFile(AlignmentI al, String file) - { - - try - { - BufferedReader in = null; - java.io.InputStream is = getClass().getResourceAsStream("/" + file); - if (is != null) - { - in = new BufferedReader(new java.io.InputStreamReader(is)); - } - else - { - try - { - URL url = new URL(file); - in = new BufferedReader(new InputStreamReader(url.openStream())); - } - catch (java.net.MalformedURLException ex) - { - in = new BufferedReader(new FileReader(file)); - } - } - - String line, label, description, token; - int graphStyle, index; - SequenceI refSeq = null; - int refSeqIndex = 1; - int existingAnnotations = 0; - if(al.getAlignmentAnnotation()!=null) - existingAnnotations = al.getAlignmentAnnotation().length; - - int alWidth = al.getWidth(); - - StringTokenizer st; - Annotation[] annotations; - AlignmentAnnotation annotation = null; - - // First confirm this is an Annotation file - boolean jvAnnotationFile = false; - while ( (line = in.readLine()) != null) - { - if (line.indexOf("#") == 0 ) - continue; - - if (line.indexOf("JALVIEW_ANNOTATION") > -1) - { - jvAnnotationFile = true; - break; - } - } - - if(!jvAnnotationFile) - { - in.close(); - return false; - } - - while ( (line = in.readLine()) != null) - { - if(line.indexOf("#")==0 - || line.indexOf("JALVIEW_ANNOTATION")>-1 - || line.length()==0) - continue; - - st = new StringTokenizer(line, "\t"); - token = st.nextToken(); - if(token.equalsIgnoreCase("COLOUR")) - { - colourAnnotations(al, st.nextToken(), st.nextToken()); - continue; - } - - if(token.equalsIgnoreCase("COMBINE") ) - { - combineAnnotations(al, st); - continue; - } - - if (token.equalsIgnoreCase("GRAPHLINE")) - { - addLine(al, st); - continue; - } - - - if(token.equalsIgnoreCase("SEQUENCE_REF") ) - { - refSeq = al.findName(st.nextToken()); - try{ - refSeqIndex = Integer.parseInt(st.nextToken()); - } - catch(Exception ex) - { - refSeqIndex = 1; - } - - continue; - } - - - graphStyle = AlignmentAnnotation.getGraphValueFromString(token); - label = description = st.nextToken(); - - line = st.nextToken(); - - st = new StringTokenizer(line, "|", true); - annotations = new Annotation[alWidth]; - - index = 0; - boolean emptyColumn = true; - - - while (st.hasMoreElements() && index