2 * Jalview - A Sequence Alignment Editor and Viewer
\r
3 * Copyright (C) 2007 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
27 * @version $Revision$
\r
29 public class ColourSchemeProperty
\r
31 /** DOCUMENT ME!! */
\r
32 public static final int CLUSTAL = 0;
\r
34 /** DOCUMENT ME!! */
\r
35 public static final int BLOSUM = 1;
\r
37 /** DOCUMENT ME!! */
\r
38 public static final int PID = 2;
\r
40 /** DOCUMENT ME!! */
\r
41 public static final int ZAPPO = 3;
\r
43 /** DOCUMENT ME!! */
\r
44 public static final int TAYLOR = 4;
\r
46 /** DOCUMENT ME!! */
\r
47 public static final int HYDROPHOBIC = 5;
\r
49 /** DOCUMENT ME!! */
\r
50 public static final int HELIX = 6;
\r
52 /** DOCUMENT ME!! */
\r
53 public static final int STRAND = 7;
\r
55 /** DOCUMENT ME!! */
\r
56 public static final int TURN = 8;
\r
58 /** DOCUMENT ME!! */
\r
59 public static final int BURIED = 9;
\r
61 /** DOCUMENT ME!! */
\r
62 public static final int NUCLEOTIDE = 10;
\r
64 /** DOCUMENT ME!! */
\r
65 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
381 col[i] = Color.white;
\r
383 cs = new UserColourScheme(col);
\r
393 public static Color getAWTColorFromName(String name)
\r
396 name = name.toLowerCase();
\r
397 if (name.equals("black"))
\r
401 else if (name.equals("blue"))
\r
405 else if (name.equals("cyan"))
\r
409 else if (name.equals("darkGray"))
\r
411 col = Color.darkGray;
\r
413 else if (name.equals("gray"))
\r
417 else if (name.equals("green"))
\r
421 else if (name.equals("lightGray"))
\r
423 col = Color.lightGray;
\r
425 else if (name.equals("magenta"))
\r
427 col = Color.magenta;
\r
429 else if (name.equals("orange"))
\r
431 col = Color.orange;
\r
433 else if (name.equals("pink"))
\r
437 else if (name.equals("red"))
\r
441 else if (name.equals("white"))
\r
445 else if (name.equals("yellow"))
\r
447 col = Color.yellow;
\r