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 public SequenceI refSequence;
\r
32 /** DOCUMENT ME!! */
\r
33 public String label;
\r
35 /** DOCUMENT ME!! */
\r
36 public String description;
\r
38 /** DOCUMENT ME!! */
\r
39 public Annotation[] annotations;
\r
42 /** DOCUMENT ME!! */
\r
43 public float graphMin;
\r
45 /** DOCUMENT ME!! */
\r
46 public float graphMax;
\r
48 public java.util.Vector graphLines;
\r
50 // Graphical hints and tips
\r
52 /** DOCUMENT ME!! */
\r
53 public boolean editable = false;
\r
55 /** DOCUMENT ME!! */
\r
56 public boolean hasIcons; //
\r
58 /** DOCUMENT ME!! */
\r
59 public boolean hasText;
\r
61 /** DOCUMENT ME!! */
\r
62 public boolean visible = true;
\r
64 public int graphGroup = -1;
\r
66 /** DOCUMENT ME!! */
\r
67 public int height = 0;
\r
69 public int graph = 0;
\r
71 public int graphHeight = 40;
\r
73 public static final int NO_GRAPH = 0;
\r
75 public static final int BAR_GRAPH = 1;
\r
77 public static final int LINE_GRAPH = 2;
\r
79 public static int getGraphValueFromString(String string)
\r
81 if(string.equalsIgnoreCase("BAR_GRAPH"))
\r
83 else if(string.equalsIgnoreCase("LINE_GRAPH"))
\r
90 * Creates a new AlignmentAnnotation object.
\r
92 * @param label DOCUMENT ME!
\r
93 * @param description DOCUMENT ME!
\r
94 * @param annotations DOCUMENT ME!
\r
96 public AlignmentAnnotation(String label, String description,
\r
97 Annotation[] annotations)
\r
101 this.label = label;
\r
102 this.description = description;
\r
103 this.annotations = annotations;
\r
105 for (int i = 0; i < annotations.length; i++)
\r
107 if ((annotations[i] != null) &&
\r
108 ((annotations[i].secondaryStructure == 'H') ||
\r
109 (annotations[i].secondaryStructure == 'E')))
\r
114 if ((annotations[i] != null) &&
\r
115 (annotations[i].displayCharacter.length() > 0))
\r
123 * Creates a new AlignmentAnnotation object.
\r
125 * @param label DOCUMENT ME!
\r
126 * @param description DOCUMENT ME!
\r
127 * @param annotations DOCUMENT ME!
\r
128 * @param min DOCUMENT ME!
\r
129 * @param max DOCUMENT ME!
\r
130 * @param winLength DOCUMENT ME!
\r
132 public AlignmentAnnotation(String label, String description,
\r
133 Annotation[] annotations, float min, float max, int graphType)
\r
135 // graphs are not editable
\r
136 this.label = label;
\r
137 this.description = description;
\r
138 this.annotations = annotations;
\r
144 for (int i = 0; i < annotations.length; i++)
\r
146 if (annotations[i] == null)
\r
151 if (annotations[i].value > max)
\r
153 max = annotations[i].value;
\r
156 if (annotations[i].value < min)
\r
158 min = annotations[i].value;
\r
166 for (int i = 0; i < annotations.length; i++)
\r
168 if ((annotations[i] != null) &&
\r
169 ((annotations[i].secondaryStructure == 'H') ||
\r
170 (annotations[i].secondaryStructure == 'E')))
\r
175 if ((annotations[i] != null) &&
\r
176 (annotations[i].displayCharacter.length() > 0))
\r
186 * @return DOCUMENT ME!
\r
188 public String toString()
\r
190 StringBuffer buffer = new StringBuffer();
\r
192 for (int i = 0; i < annotations.length; i++)
\r
194 if (annotations[i] != null)
\r
198 buffer.append(annotations[i].value);
\r
202 buffer.append(annotations[i].secondaryStructure);
\r
206 buffer.append(annotations[i].displayCharacter);
\r
210 buffer.append(", ");
\r
213 if (label.equals("Consensus"))
\r
215 buffer.append("\n");
\r
217 for (int i = 0; i < annotations.length; i++)
\r
219 if (annotations[i] != null)
\r
221 buffer.append(annotations[i].description);
\r
224 buffer.append(", ");
\r
228 return buffer.toString();
\r
231 public void addGraphLine(GraphLine line)
\r
233 if(graphLines==null)
\r
234 graphLines = new java.util.Vector();
\r
236 graphLines.add(line);
\r
239 public GraphLine getGraphLine(int index)
\r
241 if(graphLines!=null && index<graphLines.size())
\r
242 return (GraphLine)graphLines.elementAt(index);
\r