1 package jalview.schemes;
3 import jalview.io.TCoffeeScoreFile;
8 * Defines the color score for T-Coffee MSA
10 * See http://tcoffee.org
13 * @author Paolo Di Tommaso
16 public class TCoffeeColourScheme extends ResidueColourScheme {
18 static final Color[] colors = {
19 new Color( 102, 102, 255 ), // #6666FF
20 new Color( 0, 255, 0), // #00FF00
21 new Color( 102, 255, 0), // #66FF00
22 new Color( 204, 255, 0), // #CCFF00
23 new Color( 255, 255, 0), // #FFFF00
24 new Color( 255, 204, 0), // #FFCC00
25 new Color( 255, 153, 0), // #FF9900
26 new Color( 255, 102, 0), // #FF6600
27 new Color( 255, 51, 0), // #FF3300
28 new Color( 255, 34, 0) // #FF2000
32 byte[][] scoreMatrix = null;
35 * Initialize the color sheme based on the content of the T-Coffee score file
39 public TCoffeeColourScheme(TCoffeeScoreFile scoreFile) {
41 scoreMatrix = scoreFile != null ? scoreFile.getScoresArray() : null;
46 public Color findColour(char c, int j, int sequenceIndex) {
48 if( scoreMatrix == null ) {
52 if( sequenceIndex<0 || sequenceIndex >= scoreMatrix.length ) {
53 System.out.printf("Sequence index out of range for the T-Coffee color scheme. Index: %s\n", sequenceIndex);
57 byte[] seqScores = scoreMatrix[sequenceIndex];
58 if( j < 0 || j>= seqScores.length ) {
59 System.out.printf("Residue index out of range for the T-Coffee color scheme. Sequence %s - residue: %s\n", sequenceIndex, j);
63 byte val = seqScores[j];
64 return val >= 0 && val < colors.length ? colors[val] : Color.white;