2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.schemes;
23 import static org.testng.Assert.assertEquals;
25 import java.awt.Color;
27 import org.testng.annotations.Test;
29 public class Blosum62ColourSchemeTest
32 * Test the method that determines colour as:
34 * <li>white if there is no consensus</li>
35 * <li>white if 'residue' is a gap</li>
36 * <li>dark blue if residue matches consensus (or joint consensus)</li>
37 * <li>else, total the residue's Blosum score with the consensus
40 * <li>if positive, light blue, else white</li>
44 @Test(groups = "Functional")
45 public void testFindColour()
47 ColourSchemeI blosum = new Blosum62ColourScheme();
48 Color lightBlue = new Color(204, 204, 255);
49 Color darkBlue = new Color(154, 154, 255);
52 * findColour does not use column, sequence or pid score
53 * we assume consensus residue is computed as upper case
55 assertEquals(blosum.findColour('A', 0, null, "A", 0f), darkBlue);
56 assertEquals(blosum.findColour('a', 0, null, "A", 0f), darkBlue);
59 * L has a Blosum score of
68 assertEquals(blosum.findColour('L', 0, null, "A", 0f), Color.white); // -1
69 assertEquals(blosum.findColour('L', 0, null, "B", 0f), Color.white); // -4
70 assertEquals(blosum.findColour('L', 0, null, "F", 0f), Color.white); // 0
71 assertEquals(blosum.findColour('L', 0, null, "I", 0f), lightBlue); // 2
72 assertEquals(blosum.findColour('L', 0, null, "TV", 0f), Color.white); // 0
73 assertEquals(blosum.findColour('L', 0, null, "IV", 0f), lightBlue); // 3
74 assertEquals(blosum.findColour('L', 0, null, "IT", 0f), lightBlue); // 1
75 assertEquals(blosum.findColour('L', 0, null, "IAT", 0f), Color.white); // 0