X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FAnnotationFile.java;h=d4284a24e8612682f3b7492c856a3bc332c5f8e6;hb=bfc02f81d9bd87c62b204d0768b16b3efdca684e;hp=04861a265c7e22625966afe2a9f7c304f69a892d;hpb=4d2e0d36506302cc00677527725bcccbdf27d766;p=jalview.git diff --git a/src/jalview/io/AnnotationFile.java b/src/jalview/io/AnnotationFile.java index 04861a2..d4284a2 100755 --- a/src/jalview/io/AnnotationFile.java +++ b/src/jalview/io/AnnotationFile.java @@ -1,184 +1,627 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6) + * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.io; import java.io.*; -import jalview.datamodel.*; +import java.net.*; import java.util.*; -import jalview.schemes.UserColourScheme; -import java.net.URL; +import jalview.analysis.*; +import jalview.datamodel.*; +import jalview.schemes.*; public class AnnotationFile { + public AnnotationFile() + { + init(); + } + + /** + * character used to write newlines + */ + protected String newline = System.getProperty("line.separator"); + + /** + * set new line string and reset the output buffer + * + * @param nl + */ + public void setNewlineString(String nl) + { + newline = nl; + init(); + } + + public String getNewlineString() + { + return newline; + } + + StringBuffer text; + + private void init() + { + text = new StringBuffer("JALVIEW_ANNOTATION"+newline + "# Created: " + + new java.util.Date() + newline + newline); + refSeq = null; + refSeqId = null; + } - public String printAnnotations(AlignmentAnnotation [] annotations) + /** + * convenience method for pre-2.4 feature files which have no view, hidden + * columns or hidden row keywords. + * + * @param annotations + * @param groups + * @param properties + * @return feature file as a string. + */ + public String printAnnotations(AlignmentAnnotation[] annotations, + Vector groups, Hashtable properties) { - StringBuffer text = new StringBuffer( - "JALVIEW_ANNOTATION\n" - +"# Created: " - +new java.util.Date()+"\n\n"); + return printAnnotations(annotations, groups, properties, null); + + } - AlignmentAnnotation row; - String comma; - String seqref = null; + /** + * hold all the information about a particular view definition read from or + * written out in an annotations file. + */ + public class ViewDef + { + public String viewname; - StringBuffer colours = new StringBuffer(); - StringBuffer graphLine = new StringBuffer(); + public HiddenSequences hidseqs; - Hashtable graphGroup = new Hashtable(); + public ColumnSelection hiddencols; - java.awt.Color color; + public Vector visibleGroups; - for(int i=0; i