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
20 package jalview.datamodel;
\r
22 public class AlignmentAnnotation
\r
24 public String label;
\r
25 public String description;
\r
26 public Annotation [] annotations;
\r
27 public boolean isGraph = false;
\r
28 public float graphMin, graphMax;
\r
29 public int windowLength;
\r
31 // Graphical hints and tips
\r
32 public boolean editable = false;
\r
33 public boolean hasIcons; //
\r
34 public boolean hasText;
\r
35 public boolean visible = true;
\r
36 public int height=0;
\r
38 public AlignmentAnnotation(String label, String description, Annotation [] annotations)
\r
43 this.description = description;
\r
44 this.annotations = annotations;
\r
45 for(int i=0; i<annotations.length; i++)
\r
47 if (annotations[i]!=null &&(
\r
48 annotations[i].secondaryStructure == 'H' ||
\r
49 annotations[i].secondaryStructure == 'E'))
\r
52 if (annotations[i]!=null && annotations[i].displayCharacter.length()>0)
\r
57 public AlignmentAnnotation(String label, String description, Annotation [] annotations, float min, float max, int winLength)
\r
59 // graphs are not editable
\r
61 this.description = description;
\r
62 this.annotations = annotations;
\r
66 for(int i=0; i<annotations.length; i++)
\r
68 if(annotations[i]==null)
\r
70 if(annotations[i].value>max)
\r
71 max = annotations[i].value;
\r
72 if(annotations[i].value<min)
\r
73 min = annotations[i].value;
\r
79 windowLength = winLength;
\r
80 for(int i=0; i<annotations.length; i++)
\r
82 if (annotations[i]!=null &&(
\r
83 annotations[i].secondaryStructure == 'H' ||
\r
84 annotations[i].secondaryStructure == 'E'))
\r
87 if (annotations[i]!=null && annotations[i].displayCharacter.length()>0)
\r
92 public String toString()
\r
94 StringBuffer buffer = new StringBuffer();
\r
95 for(int i=0; i<annotations.length; i++)
\r
97 if(annotations[i]!=null)
\r
100 buffer.append(annotations[i].value);
\r
102 buffer.append(annotations[i].secondaryStructure);
\r
104 buffer.append(annotations[i].displayCharacter);
\r
107 buffer.append(", ");
\r
109 if(label.equals("Consensus"))
\r
111 buffer.append("\n");
\r
112 for (int i = 0; i < annotations.length; i++)
\r
114 if (annotations[i] != null)
\r
115 buffer.append(annotations[i].description);
\r
116 buffer.append(", ");
\r
119 return buffer.toString();
\r