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
21 public class AlignmentAnnotation {
\r
22 public String label;
\r
23 public String description;
\r
24 public Annotation[] annotations;
\r
25 public boolean isGraph = false;
\r
26 public float graphMin;
\r
27 public float graphMax;
\r
28 public int windowLength;
\r
30 // Graphical hints and tips
\r
31 public boolean editable = false;
\r
32 public boolean hasIcons; //
\r
33 public boolean hasText;
\r
34 public boolean visible = true;
\r
35 public int height = 0;
\r
37 public AlignmentAnnotation(String label, String description,
\r
38 Annotation[] annotations) {
\r
42 this.description = description;
\r
43 this.annotations = annotations;
\r
45 for (int i = 0; i < annotations.length; i++) {
\r
46 if ((annotations[i] != null) &&
\r
47 ((annotations[i].secondaryStructure == 'H') ||
\r
48 (annotations[i].secondaryStructure == 'E'))) {
\r
52 if ((annotations[i] != null) &&
\r
53 (annotations[i].displayCharacter.length() > 0)) {
\r
59 public AlignmentAnnotation(String label, String description,
\r
60 Annotation[] annotations, float min, float max, int winLength) {
\r
61 // graphs are not editable
\r
63 this.description = description;
\r
64 this.annotations = annotations;
\r
68 for (int i = 0; i < annotations.length; i++) {
\r
69 if (annotations[i] == null) {
\r
73 if (annotations[i].value > max) {
\r
74 max = annotations[i].value;
\r
77 if (annotations[i].value < min) {
\r
78 min = annotations[i].value;
\r
85 windowLength = winLength;
\r
87 for (int i = 0; i < annotations.length; i++) {
\r
88 if ((annotations[i] != null) &&
\r
89 ((annotations[i].secondaryStructure == 'H') ||
\r
90 (annotations[i].secondaryStructure == 'E'))) {
\r
94 if ((annotations[i] != null) &&
\r
95 (annotations[i].displayCharacter.length() > 0)) {
\r
101 public String toString() {
\r
102 StringBuffer buffer = new StringBuffer();
\r
104 for (int i = 0; i < annotations.length; i++) {
\r
105 if (annotations[i] != null) {
\r
107 buffer.append(annotations[i].value);
\r
108 } else if (hasIcons) {
\r
109 buffer.append(annotations[i].secondaryStructure);
\r
111 buffer.append(annotations[i].displayCharacter);
\r
115 buffer.append(", ");
\r
118 if (label.equals("Consensus")) {
\r
119 buffer.append("\n");
\r
121 for (int i = 0; i < annotations.length; i++) {
\r
122 if (annotations[i] != null) {
\r
123 buffer.append(annotations[i].description);
\r
126 buffer.append(", ");
\r
130 return buffer.toString();
\r