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
39 /** DOCUMENT ME!! */
\r
40 public boolean isGraph = false;
\r
42 /** DOCUMENT ME!! */
\r
43 public float graphMin;
\r
45 /** DOCUMENT ME!! */
\r
46 public float graphMax;
\r
48 /** DOCUMENT ME!! */
\r
49 public int windowLength;
\r
51 // Graphical hints and tips
\r
53 /** DOCUMENT ME!! */
\r
54 public boolean editable = false;
\r
56 /** DOCUMENT ME!! */
\r
57 public boolean hasIcons; //
\r
59 /** DOCUMENT ME!! */
\r
60 public boolean hasText;
\r
62 /** DOCUMENT ME!! */
\r
63 public boolean visible = true;
\r
65 /** DOCUMENT ME!! */
\r
66 public int height = 0;
\r
69 * Creates a new AlignmentAnnotation object.
\r
71 * @param label DOCUMENT ME!
\r
72 * @param description DOCUMENT ME!
\r
73 * @param annotations DOCUMENT ME!
\r
75 public AlignmentAnnotation(String label, String description,
\r
76 Annotation[] annotations)
\r
81 this.description = description;
\r
82 this.annotations = annotations;
\r
84 for (int i = 0; i < annotations.length; i++)
\r
86 if ((annotations[i] != null) &&
\r
87 ((annotations[i].secondaryStructure == 'H') ||
\r
88 (annotations[i].secondaryStructure == 'E')))
\r
93 if ((annotations[i] != null) &&
\r
94 (annotations[i].displayCharacter.length() > 0))
\r
102 * Creates a new AlignmentAnnotation object.
\r
104 * @param label DOCUMENT ME!
\r
105 * @param description DOCUMENT ME!
\r
106 * @param annotations DOCUMENT ME!
\r
107 * @param min DOCUMENT ME!
\r
108 * @param max DOCUMENT ME!
\r
109 * @param winLength DOCUMENT ME!
\r
111 public AlignmentAnnotation(String label, String description,
\r
112 Annotation[] annotations, float min, float max, int winLength)
\r
114 // graphs are not editable
\r
115 this.label = label;
\r
116 this.description = description;
\r
117 this.annotations = annotations;
\r
122 for (int i = 0; i < annotations.length; i++)
\r
124 if (annotations[i] == null)
\r
129 if (annotations[i].value > max)
\r
131 max = annotations[i].value;
\r
134 if (annotations[i].value < min)
\r
136 min = annotations[i].value;
\r
143 windowLength = winLength;
\r
145 for (int i = 0; i < annotations.length; i++)
\r
147 if ((annotations[i] != null) &&
\r
148 ((annotations[i].secondaryStructure == 'H') ||
\r
149 (annotations[i].secondaryStructure == 'E')))
\r
154 if ((annotations[i] != null) &&
\r
155 (annotations[i].displayCharacter.length() > 0))
\r
165 * @return DOCUMENT ME!
\r
167 public String toString()
\r
169 StringBuffer buffer = new StringBuffer();
\r
171 for (int i = 0; i < annotations.length; i++)
\r
173 if (annotations[i] != null)
\r
177 buffer.append(annotations[i].value);
\r
181 buffer.append(annotations[i].secondaryStructure);
\r
185 buffer.append(annotations[i].displayCharacter);
\r
189 buffer.append(", ");
\r
192 if (label.equals("Consensus"))
\r
194 buffer.append("\n");
\r
196 for (int i = 0; i < annotations.length; i++)
\r
198 if (annotations[i] != null)
\r
200 buffer.append(annotations[i].description);
\r
203 buffer.append(", ");
\r
207 return buffer.toString();
\r