2 * Jalview - A Sequence Alignment Editor and Viewer
\r
3 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
\r
5 * This program is free software; you can redistribute it and/or
\r
6 * modify it under the terms of the GNU General Public License
\r
7 * as published by the Free Software Foundation; either version 2
\r
8 * of the License, or (at your option) any later version.
\r
10 * This program is distributed in the hope that it will be useful,
\r
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 * GNU General Public License for more details.
\r
15 * You should have received a copy of the GNU General Public License
\r
16 * along with this program; if not, write to the Free Software
\r
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
\r
19 package jalview.datamodel;
\r
26 * @version $Revision$
\r
28 public class AlignmentAnnotation
\r
30 /** DOCUMENT ME!! */
\r
31 public String label;
\r
33 /** DOCUMENT ME!! */
\r
34 public String description;
\r
36 /** DOCUMENT ME!! */
\r
37 public Annotation[] annotations;
\r
40 /** DOCUMENT ME!! */
\r
41 public float graphMin;
\r
43 /** DOCUMENT ME!! */
\r
44 public float graphMax;
\r
47 // Graphical hints and tips
\r
49 /** DOCUMENT ME!! */
\r
50 public boolean editable = false;
\r
52 /** DOCUMENT ME!! */
\r
53 public boolean hasIcons; //
\r
55 /** DOCUMENT ME!! */
\r
56 public boolean hasText;
\r
58 /** DOCUMENT ME!! */
\r
59 public boolean visible = true;
\r
61 /** DOCUMENT ME!! */
\r
62 public int height = 0;
\r
64 public int graph = 0;
\r
66 public static int NO_GRAPH = 0;
\r
68 public static int BAR_GRAPH = 1;
\r
70 public static int LINE_GRAPH = 2;
\r
73 * Creates a new AlignmentAnnotation object.
\r
75 * @param label DOCUMENT ME!
\r
76 * @param description DOCUMENT ME!
\r
77 * @param annotations DOCUMENT ME!
\r
79 public AlignmentAnnotation(String label, String description,
\r
80 Annotation[] annotations)
\r
85 this.description = description;
\r
86 this.annotations = annotations;
\r
88 for (int i = 0; i < annotations.length; i++)
\r
90 if ((annotations[i] != null) &&
\r
91 ((annotations[i].secondaryStructure == 'H') ||
\r
92 (annotations[i].secondaryStructure == 'E')))
\r
97 if ((annotations[i] != null) &&
\r
98 (annotations[i].displayCharacter.length() > 0))
\r
106 * Creates a new AlignmentAnnotation object.
\r
108 * @param label DOCUMENT ME!
\r
109 * @param description DOCUMENT ME!
\r
110 * @param annotations DOCUMENT ME!
\r
111 * @param min DOCUMENT ME!
\r
112 * @param max DOCUMENT ME!
\r
113 * @param winLength DOCUMENT ME!
\r
115 public AlignmentAnnotation(String label, String description,
\r
116 Annotation[] annotations, float min, float max, int graphType)
\r
118 // graphs are not editable
\r
119 this.label = label;
\r
120 this.description = description;
\r
121 this.annotations = annotations;
\r
126 for (int i = 0; i < annotations.length; i++)
\r
128 if (annotations[i] == null)
\r
133 if (annotations[i].value > max)
\r
135 max = annotations[i].value;
\r
138 if (annotations[i].value < min)
\r
140 min = annotations[i].value;
\r
148 for (int i = 0; i < annotations.length; i++)
\r
150 if ((annotations[i] != null) &&
\r
151 ((annotations[i].secondaryStructure == 'H') ||
\r
152 (annotations[i].secondaryStructure == 'E')))
\r
157 if ((annotations[i] != null) &&
\r
158 (annotations[i].displayCharacter.length() > 0))
\r
168 * @return DOCUMENT ME!
\r
170 public String toString()
\r
172 StringBuffer buffer = new StringBuffer();
\r
174 for (int i = 0; i < annotations.length; i++)
\r
176 if (annotations[i] != null)
\r
180 buffer.append(annotations[i].value);
\r
184 buffer.append(annotations[i].secondaryStructure);
\r
188 buffer.append(annotations[i].displayCharacter);
\r
192 buffer.append(", ");
\r
195 if (label.equals("Consensus"))
\r
197 buffer.append("\n");
\r
199 for (int i = 0; i < annotations.length; i++)
\r
201 if (annotations[i] != null)
\r
203 buffer.append(annotations[i].description);
\r
206 buffer.append(", ");
\r
210 return buffer.toString();
\r