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.schemes;
\r
22 public class ColourSchemeProperty
\r
24 public static final int CLUSTAL = 0;
\r
25 public static final int BLOSUM = 1;
\r
26 public static final int PID = 2;
\r
27 public static final int ZAPPO = 3;
\r
28 public static final int HYDROPHOBIC=4;
\r
29 public static final int HELIX=5;
\r
30 public static final int STRAND=6;
\r
31 public static final int TURN = 7;
\r
32 public static final int BURIED = 8;
\r
33 public static final int NUCLEOTIDE = 9;
\r
34 public static final int USER_DEFINED = 10;
\r
35 public static final int NONE = 11;
\r
37 public static int getColourIndexFromName(String name)
\r
40 if(name.equalsIgnoreCase("Clustal"))
\r
42 else if(name.equalsIgnoreCase("Blosum62"))
\r
44 else if(name.equalsIgnoreCase("% Identity"))
\r
46 else if(name.equalsIgnoreCase("Zappo"))
\r
48 else if(name.equalsIgnoreCase("Hydrophobic"))
\r
50 else if(name.equalsIgnoreCase("Helix Propensity"))
\r
52 else if(name.equalsIgnoreCase("Strand Propensity"))
\r
54 else if(name.equalsIgnoreCase("Turn Propensity"))
\r
56 else if(name.equalsIgnoreCase("Buried Index"))
\r
58 else if(name.equalsIgnoreCase("Nucleotide"))
\r
60 else if(name.equalsIgnoreCase("User Defined"))
\r
66 public static String getColourName(ColourSchemeI cs)
\r
68 if(cs instanceof ConservationColourScheme)
\r
69 cs = ((ConservationColourScheme)cs).cs;
\r
73 if(cs instanceof ClustalxColourScheme)
\r
75 else if(cs instanceof Blosum62ColourScheme)
\r
77 else if(cs instanceof PIDColourScheme)
\r
79 else if(cs instanceof ZappoColourScheme)
\r
81 else if(cs instanceof HydrophobicColourScheme)
\r
82 index = HYDROPHOBIC;
\r
83 else if(cs instanceof HelixColourScheme)
\r
85 else if(cs instanceof StrandColourScheme)
\r
87 else if(cs instanceof TurnColourScheme)
\r
89 else if(cs instanceof BuriedColourScheme)
\r
91 else if(cs instanceof NucleotideColourScheme)
\r
93 else if(cs instanceof UserColourScheme)
\r
94 index = USER_DEFINED;
\r
96 return getColourName(index);
\r
99 public static String getColourName(int index)
\r
104 case CLUSTAL: ret = "Clustal"; break;
\r
105 case BLOSUM: ret = "Blosum62"; break;
\r
106 case PID: ret = "% Identity"; break;
\r
107 case ZAPPO: ret = "Zappo"; break;
\r
108 case HYDROPHOBIC: ret="Hydrophobic";break;
\r
109 case HELIX: ret="Helix Propensity";break;
\r
110 case STRAND: ret="Strand Propensity";break;
\r
111 case TURN: ret="Turn Propensity";break;
\r
112 case BURIED: ret="Buried Index";break;
\r
113 case NUCLEOTIDE:ret="Nucleotide"; break;
\r
114 case USER_DEFINED:ret="User Defined";break;
\r
115 default: ret = "None"; break;
\r
120 public static ColourSchemeI getColour(jalview.datamodel.AlignmentI al, String name)
\r
122 return getColour(al, getColourIndexFromName(name));
\r
125 public static ColourSchemeI getColour(jalview.datamodel.AlignmentI al, int index)
\r
127 ColourSchemeI cs = null;
\r
130 case CLUSTAL: cs = new ClustalxColourScheme(al.getSequences(), al.getWidth()); break;
\r
131 case BLOSUM: cs = new Blosum62ColourScheme(); break;
\r
132 case PID: cs = new PIDColourScheme(); break;
\r
133 case ZAPPO: cs = new ZappoColourScheme(); break;
\r
134 case HYDROPHOBIC: cs = new HydrophobicColourScheme(); break;
\r
135 case HELIX: cs = new HelixColourScheme(); break;
\r
136 case STRAND: cs = new StrandColourScheme(); break;
\r
137 case TURN: cs = new TurnColourScheme(); break;
\r
138 case BURIED: cs = new BuriedColourScheme(); break;
\r
139 case NUCLEOTIDE: cs = new NucleotideColourScheme(); break;
\r
140 case USER_DEFINED: cs = new UserColourScheme(null);
\r