X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FAnnotationFile.java;h=44c7f2e5efb53845de2b60d2c17bf48249c4c8bf;hb=797df64fa2a0a30773d0f48f5494d4155e5a8be3;hp=749d2a7fa5fbc9588a7a0e184b3bcf9690a6089b;hpb=1b7d493c78a364ec44ba125554a09aa317e7ad2c;p=jalview.git diff --git a/src/jalview/io/AnnotationFile.java b/src/jalview/io/AnnotationFile.java index 749d2a7..44c7f2e 100755 --- a/src/jalview/io/AnnotationFile.java +++ b/src/jalview/io/AnnotationFile.java @@ -1,199 +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.7) + * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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; + } + + /** + * 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) + { + return printAnnotations(annotations, groups, properties, null); + + } - public String printAnnotations(AlignmentAnnotation [] annotations) + /** + * hold all the information about a particular view definition read from or + * written out in an annotations file. + */ + public class ViewDef { - StringBuffer text = new StringBuffer( - "JALVIEW_ANNOTATION\n" - +"# Created: " - +new java.util.Date()+"\n\n"); + public String viewname; - AlignmentAnnotation row; - String comma; - SequenceI seqref = null; + public HiddenSequences hidseqs; - StringBuffer colours = new StringBuffer(); - StringBuffer graphLine = new StringBuffer(); + public ColumnSelection hiddencols; - Hashtable graphGroup = new Hashtable(); + public Vector visibleGroups; - java.awt.Color color; + public Hashtable hiddenRepSeqs; - for(int i=0; i