1 /* Jalview - a java multiple alignment editor
2 * Copyright (C) 1998 Michele Clamp
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 package jalview.schemes;
21 import jalview.analysis.*;
22 import java.util.Vector;
24 public class ConservationColourScheme extends ResidueColourScheme {
25 public Conservation conserve;
26 public ColourSchemeI cs;
29 public ConservationColourScheme(Conservation cons, ColourSchemeI oldcs)
36 public void setConsensus(Vector consensus)
38 this.consensus = consensus;
39 cs.setConsensus(consensus);
42 public Color findColour(String s, int i)
44 Color c = Color.white;
48 char ch = conserve.getConsSequence().getSequence().charAt(i);
49 if (ch == '*' || ch == '+')
51 c = cs.findColour(s, i);
57 if (!jalview.util.Comparison.isGap(ch))
58 t = Integer.parseInt(ch + "");
60 c = cs.findColour(s, i);
74 public Color lighter(Color c, int inc) {
76 int blue = c.getBlue();
77 int green = c.getGreen();
79 if (red < 255-inc) { red = red +inc;} else {red = 255;}
80 if (blue < 255-inc) { blue = blue +inc;} else {blue = 255;}
81 if (green < 255-inc) { green = green +inc;} else {green = 255;}
83 return new Color(red,green,blue);