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.schemes;
\r
26 * @version $Revision$
\r
28 public class ColourSchemeProperty
\r
30 /** DOCUMENT ME!! */
\r
31 public static final int CLUSTAL = 0;
\r
33 /** DOCUMENT ME!! */
\r
34 public static final int BLOSUM = 1;
\r
36 /** DOCUMENT ME!! */
\r
37 public static final int PID = 2;
\r
39 /** DOCUMENT ME!! */
\r
40 public static final int ZAPPO = 3;
\r
42 /** DOCUMENT ME!! */
\r
43 public static final int TAYLOR = 4;
\r
45 /** DOCUMENT ME!! */
\r
46 public static final int HYDROPHOBIC = 5;
\r
48 /** DOCUMENT ME!! */
\r
49 public static final int HELIX = 6;
\r
51 /** DOCUMENT ME!! */
\r
52 public static final int STRAND = 7;
\r
54 /** DOCUMENT ME!! */
\r
55 public static final int TURN = 8;
\r
57 /** DOCUMENT ME!! */
\r
58 public static final int BURIED = 9;
\r
60 /** DOCUMENT ME!! */
\r
61 public static final int NUCLEOTIDE = 10;
\r
63 /** DOCUMENT ME!! */
\r
64 public static final int USER_DEFINED = 11;
\r
67 /** DOCUMENT ME!! */
\r
68 public static final int NONE = 12;
\r
73 * @param name DOCUMENT ME!
\r
75 * @return DOCUMENT ME!
\r
77 public static int getColourIndexFromName(String name)
\r
81 if (name.equalsIgnoreCase("Clustal"))
\r
85 else if (name.equalsIgnoreCase("Blosum62"))
\r
89 else if (name.equalsIgnoreCase("% Identity"))
\r
93 else if (name.equalsIgnoreCase("Zappo"))
\r
97 else if (name.equalsIgnoreCase("Taylor"))
\r
101 else if (name.equalsIgnoreCase("Hydrophobic"))
\r
105 else if (name.equalsIgnoreCase("Helix Propensity"))
\r
109 else if (name.equalsIgnoreCase("Strand Propensity"))
\r
113 else if (name.equalsIgnoreCase("Turn Propensity"))
\r
117 else if (name.equalsIgnoreCase("Buried Index"))
\r
121 else if (name.equalsIgnoreCase("Nucleotide"))
\r
125 else if (name.equalsIgnoreCase("User Defined"))
\r
127 ret = USER_DEFINED;
\r
136 * @param cs DOCUMENT ME!
\r
138 * @return DOCUMENT ME!
\r
140 public static String getColourName(ColourSchemeI cs)
\r
145 if (cs instanceof ClustalxColourScheme)
\r
149 else if (cs instanceof Blosum62ColourScheme)
\r
153 else if (cs instanceof PIDColourScheme)
\r
157 else if (cs instanceof ZappoColourScheme)
\r
161 else if (cs instanceof TaylorColourScheme)
\r
165 else if (cs instanceof HydrophobicColourScheme)
\r
167 index = HYDROPHOBIC;
\r
169 else if (cs instanceof HelixColourScheme)
\r
173 else if (cs instanceof StrandColourScheme)
\r
177 else if (cs instanceof TurnColourScheme)
\r
181 else if (cs instanceof BuriedColourScheme)
\r
185 else if (cs instanceof NucleotideColourScheme)
\r
187 index = NUCLEOTIDE;
\r
189 else if (cs instanceof UserColourScheme)
\r
191 index = USER_DEFINED;
\r
194 return getColourName(index);
\r
200 * @param index DOCUMENT ME!
\r
202 * @return DOCUMENT ME!
\r
204 public static String getColourName(int index)
\r
221 ret = "% Identity";
\r
235 ret = "Hydrophobic";
\r
240 ret = "Helix Propensity";
\r
245 ret = "Strand Propensity";
\r
250 ret = "Turn Propensity";
\r
255 ret = "Buried Index";
\r
260 ret = "Nucleotide";
\r
265 ret = "User Defined";
\r
281 * @param al DOCUMENT ME!
\r
282 * @param name DOCUMENT ME!
\r
284 * @return DOCUMENT ME!
\r
286 public static ColourSchemeI getColour(jalview.datamodel.AlignmentI al,
\r
289 return getColour(al.getSequences(), al.getWidth(), name);
\r
295 * @param seqs DOCUMENT ME!
\r
296 * @param width DOCUMENT ME!
\r
297 * @param name DOCUMENT ME!
\r
299 * @return DOCUMENT ME!
\r
301 public static ColourSchemeI getColour(java.util.Vector seqs, int width,
\r
304 return getColour(seqs, width, getColourIndexFromName(name));
\r
310 * @param seqs DOCUMENT ME!
\r
311 * @param width DOCUMENT ME!
\r
312 * @param index DOCUMENT ME!
\r
314 * @return DOCUMENT ME!
\r
316 public static ColourSchemeI getColour(java.util.Vector seqs, int width,
\r
319 ColourSchemeI cs = null;
\r
324 cs = new ClustalxColourScheme(seqs, width);
\r
329 cs = new Blosum62ColourScheme();
\r
334 cs = new PIDColourScheme();
\r
339 cs = new ZappoColourScheme();
\r
344 cs = new TaylorColourScheme();
\r
348 cs = new HydrophobicColourScheme();
\r
353 cs = new HelixColourScheme();
\r
358 cs = new StrandColourScheme();
\r
363 cs = new TurnColourScheme();
\r
368 cs = new BuriedColourScheme();
\r
373 cs = new NucleotideColourScheme();
\r
378 Color[] col = new Color[24];
\r
379 for (int i = 0; i < 24; i++)
\r
380 col[i] = Color.white;
\r
381 cs = new UserColourScheme(col);
\r
391 public static Color getAWTColorFromName(String name)
\r
394 name = name.toLowerCase();
\r
395 if(name.equals("black"))
\r
397 else if(name.equals("blue"))
\r
399 else if(name.equals("cyan"))
\r
401 else if(name.equals("darkGray"))
\r
402 col = Color.darkGray;
\r
403 else if(name.equals("gray"))
\r
405 else if(name.equals("green"))
\r
407 else if(name.equals("lightGray"))
\r
408 col = Color.lightGray;
\r
409 else if(name.equals("magenta"))
\r
410 col = Color.magenta;
\r
411 else if(name.equals("orange"))
\r
412 col = Color.orange;
\r
413 else if(name.equals("pink"))
\r
415 else if(name.equals("red"))
\r
417 else if(name.equals("white"))
\r
419 else if(name.equals("yellow"))
\r
420 col = Color.yellow;
\r